Description
Generate an integer source matrix, scale it safely and reuse Householder QR for an orthogonal factor with a caller-bounded Q-transpose-Q residual; rank-deficient and zero sources use the core's deterministic completion, not Haar-uniform sampling.
A matrix construction produces numeric arrays with a target algebraic property. Floating-point residuals check how closely a computed result satisfies that property, while conditioning determines how sensitive it is to numerical error.
Generate an integer source matrix, scale it safely and reuse Householder QR for an orthogonal factor with a caller-bounded Q-transpose-Q residual; rank-deficient and zero sources use the core's deterministic completion, not Haar-uniform sampling.
When to use this tool
Use this generator to create reproducible orthogonal matrix cases from the supplied model or bank. Inspect the returned evidence before using cases in a test or exercise.
How to use the tool and how it works
- Supply size, minimumInteger, maximumInteger, maximumResidual in the field shapes below. Set seed when you need an explicit replay.
- Run the tool and correct any input error. For generated controls, distinguish a successful fixture containing an invalid case from failure to generate the fixture.
- Read source, q, sourceWasZero, orthogonalityResidual. Use the conventions below and keep answer-bearing fields separate when presenting an exercise.
Draw an integer square matrix, scale by its largest magnitude, and delegate QR decomposition. Return Q and the maximum absolute entry of Q-transpose Q minus identity, rejecting results above maximumResidual.1
Delegated operations used for this result: transpose; multiply. Their calculation or parsing conventions apply to the corresponding result fields.2, 3
| Input field | Meaning and units | Accepted input |
|---|---|---|
| size | Size | Required. Safe integer; minimum 1; maximum 16. |
| minimumInteger | Minimum Integer | Required. Safe integer. |
| maximumInteger | Maximum Integer | Required. Safe integer. |
| maximumResidual | Maximum Residual | Required. Finite number; minimum 0. |
| seed | Optional numeric seed; takes precedence over context randomness. Without either, use the fixed tool.io default seed. | Optional. Safe integer. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| source | Source | Required. Array of Array of Finite number.; minimum items 1; maximum items 16.; minimum items 1; maximum items 16. |
| q | Q | Required. Array of Array of Finite number.; minimum items 1; maximum items 16.; minimum items 1; maximum items 16. |
| sourceWasZero | Source Was Zero | Required. Boolean. |
| orthogonalityResidual | Orthogonality Residual | Required. Finite number; minimum 0. |
| randomness | Replay metadata: source is seed or context; seed is the normalized 32-bit seed or null for a context source. | Required. Object; no unknown keys. |
| randomness.seed | Optional numeric replay seed; normalization and precedence are explained below. | Required. Safe integer. or Null. |
| randomness.source | Source | Required. Text; one of "context", "seed". |
An explicit safe-integer seed takes precedence over injected context randomness and is normalized to an unsigned 32-bit integer. With no seed and no context source, replay uses the fixed tool.io default seed. A context source must return finite values from zero inclusive to one exclusive; its advancing state must be retained separately. randomness records the source and normalized seed, or null for context. These generators are not cryptographic random sources.
{
"input": {
"size": 2,
"minimumInteger": -2,
"maximumInteger": 3,
"maximumResidual": 1e-10,
"seed": 42
},
"output": {
"source": [
[
1,
0
],
[
3,
2
]
],
"q": [
[
-0.3162277660168378,
-0.9486832980505138
],
[
-0.9486832980505139,
0.3162277660168379
]
],
"sourceWasZero": false,
"orthogonalityResidual": 1.6653345369377348e-16,
"randomness": {
"seed": 42,
"source": "seed"
}
}
} Limitations and assumptions
- A zero source is explicitly labeled and uses a scale of one. Numerical orthogonality is checked, but the matrix is not sampled uniformly from the orthogonal group and conditioning remains relevant.
- A replay requires the same complete input and implementation. Randomized construction does not guarantee uniform coverage of every feasible output; finite samples can repeat unless a distinct-selection rule is explicitly stated.
- The field tables state structural bounds; cross-field constraints and bounded search or output budgets also apply. Unknown keys are rejected where the object contract disallows them. Input errors are distinct from null fields and deliberate invalid controls in a successful output.
Alternative or Complementary methods
For a supplied example, inspect the returned construction or delegated check directly. To evaluate a consumer, also test cases chosen for its own boundaries; a generated finite corpus does not establish exhaustive coverage.
References
Similar or alternative tools
- Random Matrix Row Operation Trace Generator
Generate elementary row-operation traces with exact safe-integer intermediate matrices and delegated determinants inheriting 12-significant-digit core rounding.
- Random Positive-Definite Matrix Generator
Generate an integer matrix A and construct A-transpose A plus a supplied positive diagonal shift using existing matrix tools, then verify Cholesky and report a relative reconstruction residual; shifts lost to floating-point conditioning return a structured failure.