Description
Return row × columns + column for flatIndex.
A matrix coordinate, a storage offset, and a block-local coordinate are different representations. Shape, stride, origin, and transpose conventions determine the correct mapping.
Return row × columns + column for flatIndex.
When to use this tool
Use Matrix Flat Index Row Major when you need one explicit matrix-coordinate or address conversion.
How to use the tool and how it works
- Enter row, column, rows, columns. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read flatIndex. Use the output convention below.
Require positive rows and columns and valid zero-based row and column. Return row × columns + column for flatIndex.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| row | Row | Required. Safe integer; minimum 0. |
| column | Column | Required. Safe integer; minimum 0. |
| rows | Supplied row count; actual matrix entries are not provided. | Required. Safe integer; minimum 1. |
| columns | Supplied column count; actual matrix entries are not provided. | Required. Safe integer; minimum 1. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| flatIndex | Flat Index | Required. Safe integer. |
{
"input": {
"row": 2,
"column": 1,
"rows": 4,
"columns": 3
},
"output": {
"flatIndex": 7
}
} Limitations and assumptions
- This assumes contiguous row-major storage without a base offset or strides; no data buffer or address bounds are checked.
- 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 Flat Index Column Major
Validate positive shape and zero-based coordinate, then return column × rows + row for flatIndex.
- Matrix Diagonal Sign Mask
Require a nonempty square numeric matrix and return Math.sign of each diagonal entry.