Matrix.opBinary

  1. Matrix opBinary(T fprimitive)
  2. ColumnType opBinary(RowType x)
  3. auto opBinary(U x)
  4. Matrix opBinary(U rhs)
    struct Matrix(T, ubyte R, ubyte C = R)
    const
    opBinary
    (
    string op
    U
    )
    (
    U rhs
    )
    if (
    op == "+" ||
    op == "-"
    )
    if (
    R >= 2 &&
    R <= 4
    &&
    C >= 2
    &&
    C <= 4
    )

Examples

const m1 = Matrix2I(1, 3, /**/ -1, 4);
const m2 = Matrix2I(5, 2, /**/ 1, 0);
const m3 = m1 + m2;
assert(m3.v == [6, 5, /**/ 0, 4]);
const m4 = m1 - 7;
assert(m4.v == [-6, -4, /**/ -8, -3]);

Meta