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::Writer< ScalarType, OrdinalType > Class Template Reference

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

#include <Teuchos_MatrixMarket_Raw_Writer.hpp>

Public Member Functions

void writeFile (const std::string &filename, const ArrayView< const OrdinalType > &rowptr, const ArrayView< const OrdinalType > &colind, const ArrayView< const ScalarType > &values, const OrdinalType numRows, const OrdinalType numCols)
 Write the sparse matrix to the given file. More...
 
void write (std::ostream &out, const ArrayView< const OrdinalType > &rowptr, const ArrayView< const OrdinalType > &colind, const ArrayView< const ScalarType > &values, const OrdinalType numRows, const OrdinalType numCols)
 Write the sparse matrix to the given output stream. More...
 

Detailed Description

template<class ScalarType, class OrdinalType>
class Teuchos::MatrixMarket::Raw::Writer< ScalarType, OrdinalType >

Write a sparse matrix from raw CSR (compressed sparse row) storage to a Matrix Market file.

Template Parameters
ScalarTypeThe type of entries of the sparse matrix.
OrdinalTypeThe type of indices of the sparse matrix.

This class is useful for testing 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::Writer if you want to write a Tpetra::CrsMatrix to a Matrix Market file.

Definition at line 67 of file Teuchos_MatrixMarket_Raw_Writer.hpp.

Member Function Documentation

template<class ScalarType , class OrdinalType >
void Teuchos::MatrixMarket::Raw::Writer< ScalarType, OrdinalType >::writeFile ( const std::string &  filename,
const ArrayView< const OrdinalType > &  rowptr,
const ArrayView< const OrdinalType > &  colind,
const ArrayView< const ScalarType > &  values,
const OrdinalType  numRows,
const OrdinalType  numCols 
)
inline

Write the sparse matrix to the given file.

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

Parameters
filename[in] Name of the Matrix Market file to which to write the sparse matrix.
rowptr[in] 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[in] Column indices of the matrix. Same number of entries as values. colind[k] is the column index of values[k].
values[in] Values stored in the matrix.
numRows[in] Number of rows in the sparse matrix. This is redundant, because rowptr.size() == numRows on output.
numCols[in] Number of columns in the sparse matrix.

Definition at line 91 of file Teuchos_MatrixMarket_Raw_Writer.hpp.

template<class ScalarType , class OrdinalType >
void Teuchos::MatrixMarket::Raw::Writer< ScalarType, OrdinalType >::write ( std::ostream &  out,
const ArrayView< const OrdinalType > &  rowptr,
const ArrayView< const OrdinalType > &  colind,
const ArrayView< const ScalarType > &  values,
const OrdinalType  numRows,
const OrdinalType  numCols 
)
inline

Write the sparse matrix to the given output stream.

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

Parameters
out[in/out] Output stream to which to write the sparse matrix.
rowptr[in] 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[in] Column indices of the matrix. Same number of entries as values. colind[k] is the column index of values[k].
values[in] Values stored in the matrix.
numRows[in] Number of rows in the sparse matrix. This is redundant, because rowptr.size() == numRows on output.
numCols[in] Number of columns in 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 130 of file Teuchos_MatrixMarket_Raw_Writer.hpp.


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