Miscellaneous Documentation on Matrices

Loading Matrices from the "Matrix Market"

The Matrix Market is a repository with hundreds of sparse matrices. Most of these matrices can be downloaded in a file in Harwell-Boeing format. Seldon provides a function to read a subset of these files.

A file from the Matrix Market is associated with a type encoded in three characters (which is usually its extension). The supported types have:

  • 'R' (real), 'C' (complex) or 'P' (pattern) as first character;
  • 'U' (unsymmetric), 'S' (symmetric) or 'R' (rectangular) as second character; 'H' (Hermitian) and 'Z' (skew symmetric) are not supported;
  • 'A' (assembled) as third character; 'E' (elemental) is not supported.

In short, Seldon can read Harwell-Boeing files from the Matrix Market providing their extensions meet the regular expression [rp][ur]a. Once read, the matrix is stored in a matrix of type Matrix<double, Prop, ColSparse, Allocator> or Matrix<float, Prop, ColSparse, Allocator>. Seldon can also write real and complex matrices in Harwell-Boeing files (.rua, .rsa, .cua or .csa extension). The coordinate format (.mtx extension) is also supported by functions ReadMatrixMarket/WriteMatrixMarket.

See the functions:

Note that these functions are only available after the file matrix_sparse/IOMatrixMarket.cxx has been included:

doc/example/matrix_market.cpp
#define SELDON_DEBUG_LEVEL_2
#include "SeldonLib.hxx"
using namespace Seldon;
int main(int argc, char** argv)
{
if (argc != 2)
{
cout << "Enter the file name where the matrix is stored" << endl;
cout << "Usage : ./a.out matrice.rua" << endl;
abort();
}
TRY;
ReadHarwellBoeing(argv[1], A);
A.Print();
WriteHarwellBoeing(A, "result.rua");
END;
return 0;
}
Seldon::Matrix
Definition: SeldonHeader.hxx:226
Seldon
Seldon namespace.
Definition: Array.cxx:24