subtract#

Fully qualified name: isaacsim::common::array::subtract

Array isaacsim::common::array::subtract(
const Array &a,
const Array &b,
)#

Subtracts two arrays element-wise.

The operands are broadcast against each other: dimensions are compared from the trailing axis, and each must either be equal or be 1. Both operands are then cast to their common promoted dtype, which is also the dtype of the result. Promotion follows the same rules, so mixing a signed and an unsigned integer widens to a signed type large enough to hold both (falling back to float64 when no such integer type exists), and mixing an integer with float32 widens to float64 when the integer is wider than float32’s mantissa.

Subtracting boolean arrays is not supported.

Parameters:
  • a – [in] Left-hand operand.

  • b – [in] Right-hand operand.

Throws:

std::invalid_argument – if the operands reside on different devices, their shapes are not broadcast-compatible, or both operands are boolean.

Returns:

A new Array holding the element-wise difference.