Matrix.opBinary

Returns the result of Matrix multiplication.

  1. T[columnSize] opBinary(T[rowSize] vec)
  2. Matrix!(T, OtherColumns, columnSize) opBinary(Matrix!(T, OtherColumns, rowSize) other)
    struct Matrix(T, uint numColumns, uint numRows = numColumns)
    const
    Matrix!(T, OtherColumns, columnSize)
    opBinary
    (
    string op : "*"
    uint OtherColumns
    )
    (
    const auto ref Matrix!(T, OtherColumns, rowSize) other
    )
    if (
    numColumns > 0 &&
    numRows > 0
    )

Examples

alias Mat23 = Matrix!(int, 2, 3);
alias Mat12 = Matrix!(int, 1, 2);

Mat23 m1 = Mat23.fromRows(1, 1,
                          2, 2,
                          3, 3);
Mat12 m2 = Mat12.fromRows(4,
                          5);
auto result = m1 * m2;
assert(result.elements == [
    1*4 + 1*5,
    2*4 + 2*5,
    3*4 + 3*5,
]);

Meta