Report a bug
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

# mir.glas.l2

## Level 2

This is a submodule of mir.glas.
The Level 2 BLAS perform matrix-vector operations.

Note GLAS is singe thread for now.

## Matrix-vector operations

Function Name Description
gemv general matrix-vector multiplication, partially optimized

Authors:
Ilya Yaroshenko
nothrow @nogc @system void `gemv`(A, B, C, SliceKind kindA, SliceKind kindB, SliceKind kindC)(C `alpha`, Slice!(const(A)*, 2, kindA) `asl`, Slice!(const(B)*, 1, kindB) `xsl`, C `beta`, Slice!(C*, 1, kindC) `ysl`)
if (allSatisfy!(isNumeric, A, B, C));
DRAFT Performs general matrix-vector multiplication.

Pseudo code y := `alpha` A × x + `beta` y.

Parameters:
 C `alpha` scalar Slice!(const(A)*, 2, kindA) `asl` m ⨉ n matrix Slice!(const(B)*, 1, kindB) `xsl` n ⨉ 1 vector C `beta` scalar. When `beta` is supplied as zero then the vector `ysl` need not be set on input. Slice!(C*, 1, kindC) `ysl` m ⨉ 1 vector

Note GLAS does not require transposition parameters. Use transposed  to perform zero cost Slice transposition.

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

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]);
```