Report a bug
If you spot a problem with this page, click here to create a GitHub issue.
Improve this page
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.sparse.blas.gemv
License:
Authors:
Ilya Yaroshenko
- void
gemv
(CR, CL, SliceKind kind1, T1, I1, J1, SliceKind kind2, Iterator2, SliceKind kind3, Iterator3)(in CRalpha
, Slice!(ChopIterator!(J1*, Series!(I1*, T1*)), 1, kind1)a
, Slice!(Iterator2, 1, kind2)x
, in CLbeta
, Slice!(Iterator3, 1, kind3)y
); - General matrix-vector multiplication.Parameters:
CR alpha
scalar Slice!(ChopIterator!(J1*, Series!(I1*, T1*)), 1, kind1) a
sparse matrix (CSR format) Slice!(Iterator2, 1, kind2) x
dense vector CL beta
scalar Slice!(Iterator3, 1, kind3) y
dense vector Returns:y
=alpha
*a
×x
+beta
*y
if beta does not equal null andy
=alpha
*a
×x
otherwise.Examples:import mir.ndslice; import mir.sparse; auto slice = sparse!double(3, 5); slice[] = [[ 0.0, 2.0, 3.0, 0.0, 0.0], [ 6.0, 0.0, 30.0, 8.0, 0.0], [ 6.0, 0.0, 30.0, 8.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); gemv(alpha, a, x, beta, y); assert(t == y);
- void
gemtv
(CR, CL, SliceKind kind1, T1, I1, J1, SliceKind kind2, Iterator2, SliceKind kind3, Iterator3)(in CRalpha
, Slice!(ChopIterator!(J1*, Series!(I1*, T1*)), 1, kind1)a
, Slice!(Iterator2, 1, kind2)x
, in CLbeta
, Slice!(Iterator3, 1, kind3)y
); - General matrix-vector multiplication with transposition.Parameters:
CR alpha
scalar Slice!(ChopIterator!(J1*, Series!(I1*, T1*)), 1, kind1) a
sparse matrix (CSR format) Slice!(Iterator2, 1, kind2) x
dense vector CL beta
scalar Slice!(Iterator3, 1, kind3) y
dense vector Returns:y
=alpha
*a
ᵀ ×x
+beta
*y
if beta does not equal null andy
=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);
- void
gemv
(CR, CL, SliceKind kind1, Iterator1, T2, I2, SliceKind kind3, Iterator3)(in CRalpha
, Slice!(Iterator1, 2, kind1)a
, Series!(I2*, T2*)x
, in CLbeta
, Slice!(Iterator3, 1, kind3)y
); - General matrix-vector multiplication for sparse vectors.Parameters:
CR alpha
scalar Slice!(Iterator1, 2, kind1) a
dense matrix Series!(I2*, T2*) x
sparse vector CL beta
scalar Slice!(Iterator3, 1, kind3) y
dense vector Returns:y
=alpha
*a
×x
+beta
*y
if beta does not equal null andy
=alpha
*a
×x
otherwise.Examples:import mir.ndslice; import mir.sparse; auto slice = sparse!double(3, 5); slice[] = [[ 0.0, 2.0, 3.0, 0.0, 0.0], [ 6.0, 0.0, 30.0, 8.0, 0.0], [ 6.0, 0.0, 30.0, 8.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); gemv(alpha, a, x, beta, y); assert(t == y);
- void
selectiveGemv
(string op = "", SliceKind kind1, SliceKind kind2, T, T3, I3)(Slice!(T*, 2, kind1)a
, Slice!(T*, 1, kind2)x
, Series!(I3*, T3*)y
); - Selective general matrix-vector multiplication with a selector sparse vector.Parameters:
Slice!(T*, 2, kind1) a
dense matrix Slice!(T*, 1, kind2) x
dense vector Series!(I3*, T3*) y
sparse vector (compressed) Returns:y
[available indexes] <op>= (alpha *a
×x
)[available indexes].
Copyright © 2016-2020 by Ilya Yaroshenko | Page generated by
Ddoc on Sun Nov 15 09:37:39 2020