Description
For a zero-based diagonal index, return index × (index + 3) / 2 in row-wise lower storage and index × size - index × (index - 1) / 2 in row-wise upper storage.
Packed matrix storage omits a triangle and maps coordinates into a linear array. Row-wise versus column-wise order and diagonal inclusion change the offset formula.
For a zero-based diagonal index, return index × (index + 3) / 2 in row-wise lower storage and index × size - index × (index - 1) / 2 in row-wise upper storage.
When to use this tool
Use Matrix Lower To Upper Packed Diagonal Offset when you need an explicit packed or band-storage coordinate mapping.
How to use the tool and how it works
- Enter size, index. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read lowerOffset, upperOffset. Use the output convention below.
For a zero-based diagonal index, return index × (index + 3) / 2 in row-wise lower storage and index × size - index × (index - 1) / 2 in row-wise upper storage.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| size | Size | Required. Safe integer; minimum 1; maximum 1000000. |
| index | Index | Required. Safe integer; minimum 0. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| lowerOffset | Lower Offset | Required. Safe integer. |
| upperOffset | Upper Offset | Required. Safe integer. |
{
"input": {
"size": 4,
"index": 2
},
"output": {
"lowerOffset": 5,
"upperOffset": 7
}
} Limitations and assumptions
- Both conventions include the diagonal; these are offsets rather than a complete packed-array conversion.
- Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
- Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.
Alternative or Complementary methods
Check the consuming library's storage convention against several boundary coordinates before indexing its buffer.
References
Similar or alternative tools
- Matrix: Matrix Symmetric Packed Alias Index
Validate zero-based row and column within size.
- Matrix: Matrix Packed Upper Index
Validate an upper-triangle coordinate and row-wise packed storage.