Blaze 3.9
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:

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
DynamicVector<int,columnVector> v4 = mult( M1, v1 ); // Alternative syntax
DynamicVector<int,rowVector> v5 = mult( trans( v1 ), M1 ); // Alternative syntax
Efficient implementation of a dynamic matrix.
Definition: DynamicMatrix.h:242
Efficient implementation of an arbitrary sized vector.
Definition: DynamicVector.h:223
Efficient implementation of a fixed-sized vector.
Definition: StaticVector.h:230
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:766
BLAZE_ALWAYS_INLINE constexpr decltype(auto) mult(T1 &&lhs, T2 &&rhs) noexcept(noexcept(lhs *rhs))
Multiplication of the two given arguments.
Definition: Mult.h:66

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