Skip to content

Latest commit

 

History

History
36 lines (24 loc) · 922 Bytes

README.Armadillo.md

File metadata and controls

36 lines (24 loc) · 922 Bytes

Armadillo Matrix Market

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

Usage

#include <fast_matrix_market/app/Armadillo.hpp>
arma::Mat<double> A;
// or
arma::SpMat<double> A;

Not restricted to double matrices. Any type supported by Armadillo 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_arma(f, A);

Note: Armadillo versions older than 10.5 did not zero-initialize memory. On those versions reading any Matrix Market file into a dense arma::Mat is not supported.

Writing

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

fast_matrix_market::write_matrix_market_arma(f, A);