mtimes

Undocumented in source.
  1. Slice!(RCI!T, 2) mtimes(Slice!(const(T)*, 2, kindA) a, Slice!(const(T)*, 2, kindB) b)
  2. Slice!(RCI!(Unqual!A), 2) mtimes(Slice!(RCI!A, 2, kindA) a, Slice!(RCI!B, 2, kindB) b)
  3. Slice!(RCI!(Unqual!A), 2) mtimes(Slice!(RCI!A, 2, kindA) a, Slice!(const(B)*, 2, kindB) b)
  4. Slice!(RCI!(Unqual!A), 2) mtimes(Slice!(const(A)*, 2, kindA) a, Slice!(RCI!B, 2, kindB) b)
    @safe pure nothrow @nogc
    Slice!(RCI!(Unqual!A), 2)
    mtimes
    (
    A
    B
    SliceKind kindA
    SliceKind kindB
    )
    (
    Slice!(const(A)*, 2, kindA) a
    ,
    auto ref const Slice!(RCI!B, 2, kindB) b
    )
    if (
    is(Unqual!A == Unqual!B)
    )

Examples

Real numbers

import mir.ndslice;
import mir.math;

auto a = mininitRcslice!double(3, 5);
auto b = mininitRcslice!double(5, 4);

a[] =
[[-5,  1,  7, 7, -4],
 [-1, -5,  6, 3, -3],
 [-5, -2, -3, 6,  0]];

b[] =
[[-5, -3,  3,  1],
 [ 4,  3,  6,  4],
 [-4, -2, -2,  2],
 [-1,  9,  4,  8],
 [ 9,  8,  3, -2]];

assert(mtimes!(double, double)(a, b) ==
    [[-42,  35,  -7, 77],
     [-69, -21, -42, 21],
     [ 23,  69,   3, 29]]);

Complex numbers

import mir.complex;
import mir.ndslice;
import mir.math;

auto a = mininitRcslice!(Complex!double)(3, 5);
auto b = mininitRcslice!(Complex!double)(5, 4);

a[] =
[[-5,  1,  7, 7, -4],
 [-1, -5,  6, 3, -3],
 [-5, -2, -3, 6,  0]];

b[] =
[[-5, -3,  3,  1],
 [ 4,  3,  6,  4],
 [-4, -2, -2,  2],
 [-1,  9,  4,  8],
 [ 9, 8,  3, -2]];

assert(mtimes!((Complex!double), (Complex!double))(a, b) ==
    [[-42,  35,  -7, 77],
     [-69, -21, -42, 21],
     [ 23,  69,   3, 29]]);

Meta