Skip to content

Main content

Matrix Offdiagonal Entry Count Tool

Calculate matrix offdiagonal entry count from explicit caller-supplied inputs.

Loading tool…

Description

Compute rows × columns - min(rows, columns) using exact integers and return the off-diagonal count as decimal text.

Matrix shapes can be empty or have singleton axes without containing a scalar. Broadcasting expands singleton dimensions under an explicit axis-by-axis compatibility rule.

Compute rows × columns - min(rows, columns) using exact integers and return the off-diagonal count as decimal text.

When to use this tool

Use Matrix Offdiagonal Entry Count when you need a matrix shape, count, or structural entry classification.

How to use the tool and how it works

  1. Enter rows, columns. 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 offDiagonalDecimal. Use the output convention below.

Compute rows × columns - min(rows, columns) using exact integers and return the off-diagonal count as decimal text.1

Input fieldMeaning and unitsAccepted input
rowsRowsRequired. Safe integer; minimum 0.
columnsColumnsRequired. Safe integer; minimum 0.
Output fieldInterpretationReturned shape
offDiagonalDecimalOff Diagonal DecimalRequired. Text; maximum UTF-16 length 8192.
json
{
  "input": {
    "rows": 3,
    "columns": 4
  },
  "output": {
    "offDiagonalDecimal": "9"
  }
}

Limitations and assumptions

  • The rectangular main diagonal has min(rows, columns) positions; this counts locations rather than nonzero values.
  • 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 all axes and actual data lengths when validating a complete matrix or broadcast operation.

References

  1. Calculation and input contract: matrix/matrix-offdiagonal-entry-count — tool.io

Similar or alternative tools