Skip to content

Main content

Matrix: Matrix Block Local Coordinate Tool

Resolve one matrix coordinate relative to an explicit half-open block, returning -1 local coordinates when outside rather than clamping.

Loading tool…

Description

Check membership in the half-open row and column ranges of the block.

A matrix coordinate, a storage offset, and a block-local coordinate are different representations. Shape, stride, origin, and transpose conventions determine the correct mapping.

Check membership in the half-open row and column ranges of the block.

When to use this tool

Use Matrix: Matrix Block Local Coordinate when you need one explicit matrix-coordinate or address conversion.

How to use the tool and how it works

  1. Enter row, column, blockRowStart, blockColumnStart, blockRows, blockColumns. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read result. Expand result to inspect the returned fields.

Check membership in the half-open row and column ranges of the block. Return zero-based local coordinates when inside, otherwise -1 for both.1

Input fieldMeaning and unitsAccepted input
rowRowRequired. Safe integer.
columnColumnRequired. Safe integer.
blockRowStartBlock Row StartRequired. Safe integer.
blockColumnStartBlock Column StartRequired. Safe integer.
blockRowsBlock RowsRequired. Safe integer.
blockColumnsBlock ColumnsRequired. Safe integer.
Output fieldInterpretationReturned shape
resultResultRequired. Object.
result.insideInsideCalculated result member: boolean.
result.localRowLocal RowCalculated result member: number.
result.localColumnLocal ColumnCalculated result member: number.
json
{
  "input": {
    "row": 4,
    "column": 6,
    "blockRowStart": 3,
    "blockColumnStart": 4,
    "blockRows": 2,
    "blockColumns": 3
  },
  "output": {
    "result": {
      "inside": true,
      "localRow": 1,
      "localColumn": 2
    }
  }
}

Limitations and assumptions

  • Zero-sized blocks contain no entries; sentinel coordinates must be read with inside rather than used as array indices.
  • Outputs are nested inside result. 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

  1. Calculation and input contract: matrix/matrix-block-local-coordinate — tool.io

Similar or alternative tools