Description
For a valid row, set first = max(0, row - lower) and last = min(columns - 1, row + upper).
A matrix coordinate, a storage offset, and a block-local coordinate are different representations. Shape, stride, origin, and transpose conventions determine the correct mapping.
For a valid row, set first = max(0, row - lower) and last = min(columns - 1, row + upper).
When to use this tool
Use Matrix Banded Row First Last Column when you need one explicit matrix-coordinate or address conversion.
How to use the tool and how it works
- Enter row, rows, columns, lower, upper. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read first, last, count. Use the output convention below.
For a valid row, set first = max(0, row - lower) and last = min(columns - 1, row + upper). Return max(0, last - first + 1) as count.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| row | Row | Required. Safe integer; minimum 0. |
| rows | Rows | Required. Safe integer; minimum 1. |
| columns | Columns | Required. Safe integer; minimum 1. |
| lower | Lower | Required. Safe integer; minimum 0. |
| upper | Upper | Required. Safe integer; minimum 0. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| first | First candidate column; compare count before treating the interval as occupied. | Required. Safe integer. |
| last | Last candidate column; may be less than first for an empty band. | Required. Safe integer. |
| count | Count | Required. Safe integer. |
{
"input": {
"row": 0,
"rows": 5,
"columns": 5,
"lower": 1,
"upper": 2
},
"output": {
"first": 0,
"last": 2,
"count": 3
}
} Limitations and assumptions
- For an empty row band first can exceed last; use count before interpreting the interval, and no sparsity values are inspected.
- 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
Validate the full shape, memory span, and storage convention before using the resulting index.
References
Similar or alternative tools
- Matrix Symmetric Band Storage Offset
Use distance = column - row.
- Matrix: Matrix Diagonal Offset Length
For signed offset, skip max(0, -offset) rows and max(0, offset) columns.