mtimes

General matrix-matrix multiplication.

  1. Slice!(BlasType!(IteratorA, IteratorB)*, 2) mtimes(Slice!(IteratorA, 2, kindA) a, Slice!(IteratorB, 2, kindB) b)
  2. Slice!(BlasType!(IteratorA, IteratorB)*) mtimes(Slice!(IteratorA, 2, kindA) a, Slice!(IteratorB, 1, kindB) b)
  3. Slice!(BlasType!(IteratorA, IteratorB)*) mtimes(Slice!(IteratorB, 1, kindB) a, Slice!(IteratorA, 2, kindA) b)
    Slice!(BlasType!(IteratorA, IteratorB)*)
    mtimes
    (
    IteratorA
    SliceKind kindA
    IteratorB
    SliceKind kindB
    )
    (
    Slice!(IteratorB, 1, kindB) a
    ,
    Slice!(IteratorA, 2, kindA) b
    )
  4. CommonType!(BlasType!IteratorA, BlasType!IteratorB) mtimes(Slice!(IteratorB, 1, kindB) a, Slice!(IteratorA, 1, kindA) b)

Parameters

a Slice!(IteratorB, 1, kindB)

1(rows) x k(cols) vector

b Slice!(IteratorA, 2, kindA)

k(rows) x n(cols) matrix Result: 1(rows) x n(cols)

Examples

import mir.ndslice;

auto a =
    [-5,  1,  7, 7, -4,
     -1, -5,  6, 3, -3,
     -5, -2, -3, 6,  0]
        .sliced(3, 5)
        .universal
        .transposed;

auto b = slice!double(5);
b[] = [-5, 4,-4,-1, 9];

assert(mtimes(b, a) == [-42, -69, 23]);

Meta