Clone wiki

blaze / Matrices


General Concepts

The Blaze library currently offers four dense matrix types (StaticMatrix, DynamicMatrix, HybridMatrix, and CustomMatrix) and one sparse matrix type (CompressedMatrix). All matrices can either be stored as row-major matrices or column-major matrices:

using blaze::DynamicMatrix;
using blaze::rowMajor;
using blaze::columnMajor;

// Setup of the 2x3 row-major dense matrix
//
//    ( 1  2  3 )
//    ( 4  5  6 )
//
DynamicMatrix<int,rowMajor> A{ { 1, 2, 3 },
                               { 4, 5, 6 } };

// Setup of the 3x2 column-major dense matrix
//
//    ( 1  4 )
//    ( 2  5 )
//    ( 3  6 )
//
DynamicMatrix<int,columnMajor> B{ { 1, 4 },
                                  { 2, 5 },
                                  { 3, 6 } };

Per default, all matrices in Blaze are row-major matrices:

// Instantiation of a 3x3 row-major matrix
blaze::DynamicMatrix<int> C( 3UL, 3UL );

Matrix Details


Examples

using blaze::StaticMatrix;
using blaze::DynamicMatrix;
using blaze::CompressedMatrix;
using blaze::rowMajor;
using blaze::columnMajor;

StaticMatrix<double,6UL,20UL> A;      // Instantiation of a 6x20 row-major static matrix
CompressedMatrix<double,rowMajor> B;  // Instantiation of a row-major compressed matrix
DynamicMatrix<double,columnMajor> C;  // Instantiation of a column-major dynamic matrix

// ... Resizing and initialization

C = A * B;

Previous: Vector Operations ---- Next: Matrix Types

Updated