gemtv

General matrix-vector multiplication with transposition.

void
gemtv
(
CR
CL
SliceKind kind1
T1
I1
J1
SliceKind kind2
Iterator2
SliceKind kind3
Iterator3
)
(
in CR alpha
,
Slice!(ChopIterator!(J1*, Series!(I1*, T1*)), 1, kind1) a
,
Slice!(Iterator2, 1, kind2) x
,
in CL beta
,
Slice!(Iterator3, 1, kind3) y
)

Parameters

alpha CR

scalar

a Slice!(ChopIterator!(J1*, Series!(I1*, T1*)), 1, kind1)

sparse matrix (CSR format)

x Slice!(Iterator2, 1, kind2)

dense vector

beta CL

scalar

y Slice!(Iterator3, 1, kind3)

dense vector

Return Value

Type: void

y = alpha * aᵀ × x + beta * y if beta does not equal null and y = alpha * aᵀ × x otherwise.

Examples

import mir.ndslice;
import mir.sparse;

auto slice = sparse!double(5, 3);
slice[] =
    [[0.0,  6.0,  6.0],
     [2.0,  0.0,  0.0],
     [3.0, 30.0, 30.0],
     [0.0,  8.0,  8.0],
     [0.0,  0.0,  0.0]];
auto alpha = 3.0;
auto a = slice.compress;
auto x =  [ 17.0, 19, 31, 3, 5].sliced;
auto beta = 2.0;
auto y = [1.0, 2, 3].sliced;
auto t = [131.0, 1056.0, 1056.0].sliced;
t[] *= alpha;
import mir.glas.l1: axpy;
axpy(beta, y, t);
gemtv(alpha, a, x, beta, y);
assert(t == y);

Meta