Warning: this documentation for the development version is under construction.

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) or 'P' (pattern) as first character; complex-valued matrices ('C') are not supported;
  • 'U' (unsymmetric) or 'R' (rectangular) as second character; 'S' (symmetric), '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 or .cua extension), symmetric matrices will be written as unsymmetric matrices.

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 "Seldon.hxx"
using namespace Seldon;

#include "matrix_sparse/IOMatrixMarket.cxx"

int main(int argc, char** argv)
{

  TRY;

  Matrix<double, General, ColSparse> A;

  ReadHarwellBoeing(argv[1], A);

  A.Print();

  WriteHarwellBoeing(A, "result.rua");

  END;

  return 0;

}