Teuchos - Trilinos Tools Package  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
Teuchos::MatrixMarket::Raw::Reader< Scalar, Ordinal > Class Template Reference

Read a sparse matrix from a Matrix Market file into raw CSR (compressed sparse row) storage. More...

#include <Teuchos_MatrixMarket_Raw_Reader.hpp>

Public Member Functions

 Reader (const bool tolerant, const bool debug)
 Constructor that takes Boolean parameters. More...
 
 Reader ()
 Constructor that sets default Boolean parameters. More...
 
 Reader (const RCP< ParameterList > &params)
 Constructor that takes a ParameterList of parameters. More...
 
void setParameters (const RCP< ParameterList > &params)
 Set parameters from the given ParameterList. More...
 
RCP< const ParameterListgetValidParameters () const
 Get a list of valid default parameters, with documentation. More...
 
bool readFile (ArrayRCP< Ordinal > &rowptr, ArrayRCP< Ordinal > &colind, ArrayRCP< Scalar > &values, Ordinal &numRows, Ordinal &numCols, const std::string &filename)
 Read the sparse matrix from the given file into CSR storage. More...
 
bool read (ArrayRCP< Ordinal > &rowptr, ArrayRCP< Ordinal > &colind, ArrayRCP< Scalar > &values, Ordinal &numRows, Ordinal &numCols, std::istream &in)
 Read the sparse matrix from the given input stream into CSR storage. More...
 

Detailed Description

template<class Scalar, class Ordinal>
class Teuchos::MatrixMarket::Raw::Reader< Scalar, Ordinal >

Read a sparse matrix from a Matrix Market file into raw CSR (compressed sparse row) storage.

Template Parameters
ScalarThe type of entries of the sparse matrix.
OrdinalThe type of indices of the sparse matrix.

This class is useful for benchmarking local sparse kernels. It should only be called by one MPI process at a time and is not aware of parallel communication. Use Tpetra::MatrixMarket::Reader if you want to read a Tpetra::CrsMatrix from a Matrix Market file.

Definition at line 69 of file Teuchos_MatrixMarket_Raw_Reader.hpp.

Constructor & Destructor Documentation

template<class Scalar , class Ordinal >
Teuchos::MatrixMarket::Raw::Reader< Scalar, Ordinal >::Reader ( const bool  tolerant,
const bool  debug 
)
inline

Constructor that takes Boolean parameters.

Parameters
tolerant[in] Whether to parse the Matrix Market files tolerantly.
debug[in] Whether to print (possibly copious) debugging output to stderr.

Definition at line 77 of file Teuchos_MatrixMarket_Raw_Reader.hpp.

template<class Scalar , class Ordinal >
Teuchos::MatrixMarket::Raw::Reader< Scalar, Ordinal >::Reader ( )
inline

Constructor that sets default Boolean parameters.

Definition at line 84 of file Teuchos_MatrixMarket_Raw_Reader.hpp.

template<class Scalar , class Ordinal >
Teuchos::MatrixMarket::Raw::Reader< Scalar, Ordinal >::Reader ( const RCP< ParameterList > &  params)
inline

Constructor that takes a ParameterList of parameters.

Parameters (all of them have type bool, all default to false):

  • "Parse tolerantly": Whether to parse Matrix Market files tolerantly.
  • "Debug mode": Whether to print (possibly copious) debugging output to stderr.

Definition at line 97 of file Teuchos_MatrixMarket_Raw_Reader.hpp.

Member Function Documentation

template<class Scalar , class Ordinal >
void Teuchos::MatrixMarket::Raw::Reader< Scalar, Ordinal >::setParameters ( const RCP< ParameterList > &  params)
inline

Set parameters from the given ParameterList.

See constructor documentation for the accepted parameters.

Definition at line 108 of file Teuchos_MatrixMarket_Raw_Reader.hpp.

template<class Scalar , class Ordinal >
RCP<const ParameterList> Teuchos::MatrixMarket::Raw::Reader< Scalar, Ordinal >::getValidParameters ( ) const
inline

Get a list of valid default parameters, with documentation.

Definition at line 126 of file Teuchos_MatrixMarket_Raw_Reader.hpp.

template<class Scalar , class Ordinal >
bool Teuchos::MatrixMarket::Raw::Reader< Scalar, Ordinal >::readFile ( ArrayRCP< Ordinal > &  rowptr,
ArrayRCP< Ordinal > &  colind,
ArrayRCP< Scalar > &  values,
Ordinal &  numRows,
Ordinal &  numCols,
const std::string &  filename 
)
inline

Read the sparse matrix from the given file into CSR storage.

The outputs rowptr, colind, values together form the common three-arrays representation of compressed sparse row (CSR) storage.

Parameters
rowptr[out] Array of numRows+1 offsets, where numRows is the number of rows in the sparse matrix. For row i (zero-based indexing), the entries of that row are in indices rowptr[i] .. rowptr[i+1]-1 of colind and values.
colind[out] Column indices of the matrix. Same number of entries as values. colind[k] is the column index of values[k].
values[out] Values stored in the matrix.
numRows[out] Number of rows in the sparse matrix. This is redundant, because rowptr.size() == numRows on output.
numCols[out] Number of columns in the sparse matrix.
filename[in] Name of the Matrix Market file from which to read the sparse matrix.
Returns
If parsing tolerantly: false if the Matrix Market file has any syntax errors, else true. If not parsing tolerantly, this should always return true.

Definition at line 168 of file Teuchos_MatrixMarket_Raw_Reader.hpp.

template<class Scalar , class Ordinal >
bool Teuchos::MatrixMarket::Raw::Reader< Scalar, Ordinal >::read ( ArrayRCP< Ordinal > &  rowptr,
ArrayRCP< Ordinal > &  colind,
ArrayRCP< Scalar > &  values,
Ordinal &  numRows,
Ordinal &  numCols,
std::istream &  in 
)
inline

Read the sparse matrix from the given input stream into CSR storage.

The outputs rowptr, colind, values together form the common three-arrays representation of compressed sparse row (CSR) storage.

Parameters
rowptr[out] Array of numRows+1 offsets, where numRows is the number of rows in the sparse matrix. For row i (zero-based indexing), the entries of that row are in indices rowptr[i] .. rowptr[i+1]-1 of colind and values.
colind[out] Column indices of the matrix. Same number of entries as values. colind[k] is the column index of values[k].
values[out] Values stored in the matrix.
numRows[out] Number of rows in the sparse matrix. This is redundant, because rowptr.size() == numRows on output.
numCols[out] Number of columns in the sparse matrix.
in[in/out] Input stream from which to read the sparse matrix.
Returns
If parsing tolerantly: false if the Matrix Market file has any syntax errors, else true. If not parsing tolerantly, this should always return true.

Definition at line 208 of file Teuchos_MatrixMarket_Raw_Reader.hpp.


The documentation for this class was generated from the following file: