Matrix.opBinary

  1. Matrix opBinary(T factor)
  2. ColumnType opBinary(RowType x)
  3. auto opBinary(U x)
  4. Matrix opBinary(U rhs)
    struct Matrix(T, ubyte R, ubyte C = R, MatrixOrder O = CurrentMatrixOrder)
    pure nothrow const @safe @nogc
    static if(O == MatrixOrder.RowMajor)
    opBinary
    (
    string op
    U
    )
    (
    U rhs
    )
    if (
    op == "+" ||
    op == "-"
    )
    if (
    R >= 2 &&
    R <= 4
    &&
    C >= 2
    &&
    C <= 4
    )

Examples

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

Meta