gemv

DRAFT Performs general matrix-vector multiplication.

More...
nothrow @nogc @system
@fastmath
void
gemv
(
A
B
C
SliceKind kindA
SliceKind kindB
SliceKind kindC
)
(,
Slice!(const(A)*, 2, kindA) asl
,
Slice!(const(B)*, 1, kindB) xsl
,,
Slice!(C*, 1, kindC) ysl
)
if (
allSatisfy!(isNumeric, A, B, C)
)

Parameters

alpha C

scalar

asl Slice!(const(A)*, 2, kindA)

m ⨉ n matrix

xsl Slice!(const(B)*, 1, kindB)

n ⨉ 1 vector

beta C

scalar. When beta is supplied as zero then the vector ysl need not be set on input.

ysl Slice!(C*, 1, kindC)

m ⨉ 1 vector

Note: GLAS does not require transposition parameters. Use $(NDSLICEREF iteration, transposed) to perform zero cost Slice transposition.

BLAS: SGEMV, DGEMV, (CGEMV, ZGEMV are not implemented for now)

Detailed Description

Pseudo code

y := alpha A × x + beta y.

Examples

import mir.ndslice;

auto a = slice!double(3, 5);
a[] =
    [[-5,  1,  7, 7, -4],
     [-1, -5,  6, 3, -3],
     [-5, -2, -3, 6,  0]];

auto b = slice!double(5);
b[] =
    [-5.0,
      4.0,
     -4.0,
     -1.0,
      9.0];

auto c = slice!double(3);

gemv!(double, double, double)(1.0, a, b, 0.0, c);

assert(c ==
    [-42.0,
     -69.0,
      23.0]);

Meta