yorick banner

Home

Manual

Packages

Global Index

Keywords

Quick Reference

Yorick Language Reference

Array Conformability Rules

Operands may be arrays, in which case the operation is performed on each element of the array(s) to produce an array result. Binary operands need not have identical dimensions, but their dimensions must be conformable. Two arrays are conformable if their first dimensions match, their second dimensions match, their third dimensions match, and so on up to the number of dimensions in the array with the fewer dimensions. Two array dimensions match if either of the following conditions is met:

  • the dimensions have the same length
  • one of the dimensions has unit length (1 element)

Unit length or missing dimensions are broadcast (by copying the single value) to the length of the corresponding dimension of the other operand. The result of the operation has the number of dimensions of the higher rank operand, and the length of each dimension is the longer of the lengths in the two operands.