Skip to content

Latest commit

 

History

History
44 lines (31 loc) · 1.18 KB

README.Blaze.md

File metadata and controls

44 lines (31 loc) · 1.18 KB

Blaze (blaze-lib) Matrix Market

fast_matrix_market provides read/write methods for Blaze sparse and dense matrices and vectors.

Usage

#include <fast_matrix_market/app/Blaze.hpp>
blaze::CompressedMatrix<double> A;
// or
blaze::DynamicMatrix<double> A;
// or
blaze::CompressedVector<double> A;
// or
blaze::DynamicVector<double> A;

Not restricted to double matrices. Any type supported by Blaze that makes sense in Matrix Market is also supported, such as int64_t, float, std::complex<double>, etc.

Reading

std::ifstream f("input.mtx");

fast_matrix_market::read_matrix_market_blaze(f, A);

Note: if A is a Vector type then the Matrix Market file must be either a vector or a 1-by-N row or M-by-1 column matrix. Any other matrix will cause an exception to be thrown.

Writing

std::ofstream f("output.mtx", std::ios_base::binary);

fast_matrix_market::write_matrix_market_blaze(f, A);

Compatibility Note: Blaze Vector objects are written as vector Matrix Market files. Many MatrixMarket loaders cannot read vector files. If this is a problem write the vector as a 1-by-N or M-by-1 matrix.