Wiki

Clone wiki

blaze / Matrix-Vector Multiplication


In Blaze matrix/vector multiplications can be as intuitively formulated as in mathematical textbooks. Just as in textbooks there are two different multiplications between a matrix and a vector: a matrix/column vector multiplication and a row vector/matrix multiplication:

using blaze::StaticVector;
using blaze::DynamicVector;
using blaze::DynamicMatrix;

DynamicMatrix<int> M1( 39UL, 12UL );
StaticVector<int,12UL,columnVector> v1;

// ... Initialization of the matrix and the vector

DynamicVector<int,columnVector> v2 = M1 * v1;           // Matrix/column vector multiplication
DynamicVector<int,rowVector>    v3 = trans( v1 ) * M1;  // Row vector/matrix multiplication

Note that the storage order of the matrix poses no restrictions on the operation. Also note, that the highest performance for a multiplication between a dense matrix and a dense vector can be achieved if both the matrix and the vector have the same scalar element type.


Previous: Vector/Vector Division ---- Next: Matrix/Matrix Multiplication

Updated