Skip to content

Main content

Matrix: Matrix Broadcast Singleton Axis Check Tool

Resolve one NumPy-style broadcast axis, preserving zero axes and using -1 only when unequal non-singleton axes are incompatible.

Loading tool…

Description

Mark axes compatible when equal or either equals one.

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.

Mark axes compatible when equal or either equals one.

When to use this tool

Use Matrix: Matrix Broadcast Singleton Axis Check when you need a matrix shape, count, or structural entry classification.

How to use the tool and how it works

  1. Enter leftAxis, rightAxis. 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.

Mark axes compatible when equal or either equals one. Return the other dimension for a singleton expansion, the common dimension when equal, or outputAxis -1 when incompatible.1

Input fieldMeaning and unitsAccepted input
leftAxisLeft AxisRequired. Safe integer.
rightAxisRight AxisRequired. Safe integer.
Output fieldInterpretationReturned shape
resultResultRequired. Object.
result.compatibleCompatibleCalculated result member: boolean.
result.outputAxisOutput AxisCalculated result member: number.
json
{
  "input": {
    "leftAxis": 1,
    "rightAxis": 0
  },
  "output": {
    "result": {
      "compatible": true,
      "outputAxis": 0
    }
  }
}

Limitations and assumptions

  • Zero dimensions are allowed and broadcasting one with zero returns zero; a full shape must be aligned and checked axis by axis.
  • 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

Check all axes and actual data lengths when validating a complete matrix or broadcast operation.

References

  1. Calculation and input contract: matrix/matrix-broadcast-singleton-axis-check — tool.io

Similar or alternative tools