scalar
sparse matrix (CSR format)
dense vector
scalar
dense vector
y = alpha * aᵀ × x + beta * y if beta does not equal null and y = alpha * aᵀ × x otherwise.
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);
General matrix-vector multiplication with transposition.