Tpetra parallel linear algebra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Static Public Member Functions | List of all members
Tpetra::MatrixMarket::Writer< SparseMatrixType > Class Template Reference

Matrix Market file writer for CrsMatrix and MultiVector. More...

#include <MatrixMarket_Tpetra.hpp>

Public Types

typedef SparseMatrixType sparse_matrix_type
 Template parameter of this class; specialization of CrsMatrix. More...
 
typedef
SparseMatrixType::scalar_type 
scalar_type
 Type of the entries of the sparse matrix. More...
 
typedef
SparseMatrixType::local_ordinal_type 
local_ordinal_type
 Type of the local indices of the sparse matrix. More...
 
typedef
SparseMatrixType::global_ordinal_type 
global_ordinal_type
 Type of indices as read from the Matrix Market file. More...
 
typedef SparseMatrixType::node_type node_type
 The Kokkos Node type; fourth template parameter of Tpetra::CrsMatrix. More...
 
typedef MultiVector
< scalar_type,
local_ordinal_type,
global_ordinal_type, node_type
multivector_type
 Specialization of Tpetra::MultiVector that matches SparseMatrixType. More...
 
typedef Map
< local_ordinal_type,
global_ordinal_type, node_type
map_type
 Specialization of Tpetra::Map that matches SparseMatrixType. More...
 
typedef CrsGraph
< local_ordinal_type,
global_ordinal_type, node_type
crs_graph_type
 Specialization of Tpetra::CrsGraph that matches SparseMatrixType. More...
 

Static Public Member Functions

static void writeSparseFile (const std::string &filename, const sparse_matrix_type &matrix, const std::string &matrixName, const std::string &matrixDescription, const bool debug=false)
 Print the sparse matrix in Matrix Market format, with comments. More...
 
static void writeSparseFile (const std::string &filename, const Teuchos::RCP< const sparse_matrix_type > &pMatrix, const std::string &matrixName, const std::string &matrixDescription, const bool debug=false)
 Only for backwards compatibility; prefer the overload above. More...
 
static void writeSparseFile (const std::string &filename, const sparse_matrix_type &matrix, const bool debug=false)
 Print the sparse matrix in Matrix Market format. More...
 
static void writeSparseFile (const std::string &filename, const Teuchos::RCP< const sparse_matrix_type > &pMatrix, const bool debug=false)
 Only for backwards compatibility; prefer the overload above. More...
 
static void writeSparse (std::ostream &out, const sparse_matrix_type &matrix, const std::string &matrixName, const std::string &matrixDescription, const bool debug=false)
 Print the sparse matrix in Matrix Market format, with comments. More...
 
static void writeSparse (std::ostream &out, const Teuchos::RCP< const sparse_matrix_type > &pMatrix, const std::string &matrixName, const std::string &matrixDescription, const bool debug=false)
 Only for backwards compatibility; prefer the overload above. More...
 
static void writeSparseGraph (std::ostream &out, const crs_graph_type &graph, const std::string &graphName, const std::string &graphDescription, const bool debug=false)
 Print the sparse graph in Matrix Market format to the given output stream. More...
 
static void writeSparseGraph (std::ostream &out, const crs_graph_type &graph, const bool debug=false)
 Print the sparse graph in Matrix Market format to the given output stream, with no comments. More...
 
static void writeSparseGraphFile (const std::string &filename, const crs_graph_type &graph, const std::string &graphName, const std::string &graphDescription, const bool debug=false)
 Print the sparse graph in Matrix Market format to the given file (by filename). More...
 
static void writeSparseGraphFile (const std::string &filename, const crs_graph_type &graph, const bool debug=false)
 Print the sparse graph in Matrix Market format to the given file (by filename), with no comments. More...
 
static void writeSparseGraphFile (const std::string &filename, const Teuchos::RCP< const crs_graph_type > &pGraph, const std::string &graphName, const std::string &graphDescription, const bool debug=false)
 Print the sparse graph in Matrix Market format to the given file (by filename), taking the graph by Teuchos::RCP. More...
 
static void writeSparseGraphFile (const std::string &filename, const Teuchos::RCP< const crs_graph_type > &pGraph, const bool debug=false)
 Print the sparse graph in Matrix Market format to the given file (by filename), with no comments, taking the graph by Teuchos::RCP. More...
 
static void writeSparse (std::ostream &out, const sparse_matrix_type &matrix, const bool debug=false)
 Print the sparse matrix in Matrix Market format. More...
 
static void writeSparse (std::ostream &out, const Teuchos::RCP< const sparse_matrix_type > &pMatrix, const bool debug=false)
 Only for backwards compatibility; prefer the overload above. More...
 
static void writeDenseFile (const std::string &filename, const multivector_type &X, const std::string &matrixName, const std::string &matrixDescription, const Teuchos::RCP< Teuchos::FancyOStream > &err=Teuchos::null, const Teuchos::RCP< Teuchos::FancyOStream > &dbg=Teuchos::null)
 Print the multivector in Matrix Market format, with matrix name and description. More...
 
static void writeDenseFile (const std::string &filename, const Teuchos::RCP< const multivector_type > &X, const std::string &matrixName, const std::string &matrixDescription, const Teuchos::RCP< Teuchos::FancyOStream > &err=Teuchos::null, const Teuchos::RCP< Teuchos::FancyOStream > &dbg=Teuchos::null)
 Print the multivector in Matrix Market format, with matrix name and description. More...
 
static void writeDenseFile (const std::string &filename, const multivector_type &X, const Teuchos::RCP< Teuchos::FancyOStream > &err=Teuchos::null, const Teuchos::RCP< Teuchos::FancyOStream > &dbg=Teuchos::null)
 Print the multivector in Matrix Market format, with no matrix name or description. More...
 
static void writeDenseFile (const std::string &filename, const Teuchos::RCP< const multivector_type > &X, const Teuchos::RCP< Teuchos::FancyOStream > &err=Teuchos::null, const Teuchos::RCP< Teuchos::FancyOStream > &dbg=Teuchos::null)
 Print the multivector in Matrix Market format, with no matrix name or description. More...
 
static void writeDense (std::ostream &out, const multivector_type &X, const std::string &matrixName, const std::string &matrixDescription, const Teuchos::RCP< Teuchos::FancyOStream > &err=Teuchos::null, const Teuchos::RCP< Teuchos::FancyOStream > &dbg=Teuchos::null)
 Print the multivector in Matrix Market format, with matrix name and description. More...
 
static void writeDense (std::ostream &out, const Teuchos::RCP< const multivector_type > &X, const std::string &matrixName, const std::string &matrixDescription, const Teuchos::RCP< Teuchos::FancyOStream > &err=Teuchos::null, const Teuchos::RCP< Teuchos::FancyOStream > &dbg=Teuchos::null)
 Print the multivector in Matrix Market format, with matrix name and or description. More...
 
static void writeDense (std::ostream &out, const multivector_type &X, const Teuchos::RCP< Teuchos::FancyOStream > &err=Teuchos::null, const Teuchos::RCP< Teuchos::FancyOStream > &dbg=Teuchos::null)
 Print the multivector in Matrix Market format, with no matrix name or description. More...
 
static void writeDense (std::ostream &out, const Teuchos::RCP< const multivector_type > &X, const Teuchos::RCP< Teuchos::FancyOStream > &err=Teuchos::null, const Teuchos::RCP< Teuchos::FancyOStream > &dbg=Teuchos::null)
 Print the multivector in Matrix Market format, with no matrix name or description. More...
 
static void writeMap (std::ostream &out, const map_type &map, const bool debug=false)
 Print the Map to the given output stream. More...
 
static void writeMap (std::ostream &out, const map_type &map, const Teuchos::RCP< Teuchos::FancyOStream > &err, const bool debug=false)
 Print the Map to the given output stream out. More...
 
static void writeMapFile (const std::string &filename, const map_type &map)
 Write the Map to the given file. More...
 
static void writeOperator (const std::string &fileName, operator_type const &A)
 Write a Tpetra::Operator to a file. More...
 
static void writeOperator (std::ostream &out, const operator_type &A)
 Write a Tpetra::Operator to an output stream. More...
 
static void writeOperator (const std::string &fileName, const operator_type &A, const Teuchos::ParameterList &params)
 Write a Tpetra::Operator to a file, with options. More...
 
static void writeOperator (std::ostream &out, const operator_type &A, const Teuchos::ParameterList &params)
 Write a Tpetra::Operator to an output stream, with options. More...
 

Detailed Description

template<class SparseMatrixType>
class Tpetra::MatrixMarket::Writer< SparseMatrixType >

Matrix Market file writer for CrsMatrix and MultiVector.

Template Parameters
SparseMatrixTypeA specialization of Tpetra::CrsMatrix.
Author
Mark Hoemmen

The Matrix Market (see their web site for details) defines a human-readable ASCII text file format for interchange of sparse and dense matrices. This class defines methods for writing sparse and dense matrices to a Matrix Market file or input stream.

All methods of this class assume that the file is only openable resp. the input stream is only writeable, on MPI Process 0 (with respect to the MPI communicator over which the given CrsMatrix or MultiVector is to be distributed).

We define the MultiVector type accepted by writeDense() and writeDenseFile() using the scalar_type, local_ordinal_type, global_ordinal_type, and node_type typedefs in SparseMatrixType. This ensures that the Tpetra::MultiVector objects returned by those methods have a type compatible with the Tpetra::CrsMatrix sparse matrices accepted by writeSparse() and writeSparseFile(). We do this because the typical use case of Matrix Market files in Trilinos is to test sparse matrix methods, which usually involves reading a sparse matrix A and perhaps also a dense right-hand side b.

Definition at line 5754 of file MatrixMarket_Tpetra.hpp.

Member Typedef Documentation

template<class SparseMatrixType >
typedef SparseMatrixType Tpetra::MatrixMarket::Writer< SparseMatrixType >::sparse_matrix_type

Template parameter of this class; specialization of CrsMatrix.

Definition at line 5757 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
typedef SparseMatrixType::scalar_type Tpetra::MatrixMarket::Writer< SparseMatrixType >::scalar_type

Type of the entries of the sparse matrix.

Definition at line 5761 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
typedef SparseMatrixType::local_ordinal_type Tpetra::MatrixMarket::Writer< SparseMatrixType >::local_ordinal_type

Type of the local indices of the sparse matrix.

Definition at line 5763 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
typedef SparseMatrixType::global_ordinal_type Tpetra::MatrixMarket::Writer< SparseMatrixType >::global_ordinal_type

Type of indices as read from the Matrix Market file.

Indices of the sparse matrix are stored as global ordinals, since Matrix Market files represent the whole matrix and don't have a notion of distribution.

Definition at line 5769 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
typedef SparseMatrixType::node_type Tpetra::MatrixMarket::Writer< SparseMatrixType >::node_type

The Kokkos Node type; fourth template parameter of Tpetra::CrsMatrix.

Definition at line 5771 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
typedef MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type> Tpetra::MatrixMarket::Writer< SparseMatrixType >::multivector_type

Specialization of Tpetra::MultiVector that matches SparseMatrixType.

Definition at line 5777 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
typedef Map<local_ordinal_type, global_ordinal_type, node_type> Tpetra::MatrixMarket::Writer< SparseMatrixType >::map_type

Specialization of Tpetra::Map that matches SparseMatrixType.

Definition at line 5779 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
typedef CrsGraph<local_ordinal_type, global_ordinal_type, node_type> Tpetra::MatrixMarket::Writer< SparseMatrixType >::crs_graph_type

Specialization of Tpetra::CrsGraph that matches SparseMatrixType.

Definition at line 5781 of file MatrixMarket_Tpetra.hpp.

Member Function Documentation

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeSparseFile ( const std::string &  filename,
const sparse_matrix_type matrix,
const std::string &  matrixName,
const std::string &  matrixDescription,
const bool  debug = false 
)
inlinestatic

Print the sparse matrix in Matrix Market format, with comments.

Write the given Tpetra::CrsMatrix sparse matrix to the given file, using the Matrix Market "coordinate" format. MPI Proc 0 is the only MPI process that opens or writes to the file. Include the matrix name and description in the comments section of the file (after the initial banner line, but before the matrix metadata and data).

Parameters
filename[in] Name of the file to which to write the given sparse matrix. The matrix is distributed, but only Proc 0 opens the file and writes to it.
matrix[in] The sparse matrix to write to the file.
matrixName[in] Name of the matrix, to print in the comments section of the output file. If empty, we don't print anything (not even an empty line).
matrixDescription[in] Matrix description, to print in the comments section of the output file. If empty, we don't print anything (not even an empty line).
debug[in] Whether to print possibly copious debugging output to stderr on Proc 0.
Warning
The current implementation gathers the whole matrix onto MPI Proc 0. This will cause out-of-memory errors if the matrix is too big to fit on one process. This will be fixed in the future.

Definition at line 5818 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeSparseFile ( const std::string &  filename,
const Teuchos::RCP< const sparse_matrix_type > &  pMatrix,
const std::string &  matrixName,
const std::string &  matrixDescription,
const bool  debug = false 
)
inlinestatic

Only for backwards compatibility; prefer the overload above.

Definition at line 5843 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeSparseFile ( const std::string &  filename,
const sparse_matrix_type matrix,
const bool  debug = false 
)
inlinestatic

Print the sparse matrix in Matrix Market format.

Write the given Tpetra::CrsMatrix sparse matrix to the given file, using the Matrix Market "coordinate" format. MPI Proc 0 is the only MPI process that opens or writes to the file.

Parameters
filename[in] Name of the file to which to write the given sparse matrix. The matrix is distributed, but only Proc 0 opens the file and writes to it.
matrix[in] The sparse matrix to write to the file.
debug[in] Whether to print possibly copious debugging output to stderr on Proc 0.
Warning
The current implementation gathers the whole matrix onto MPI Proc 0. This will cause out-of-memory errors if the matrix is too big to fit on one process. This will be fixed in the future.

Definition at line 5876 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeSparseFile ( const std::string &  filename,
const Teuchos::RCP< const sparse_matrix_type > &  pMatrix,
const bool  debug = false 
)
inlinestatic

Only for backwards compatibility; prefer the overload above.

Definition at line 5885 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeSparse ( std::ostream &  out,
const sparse_matrix_type matrix,
const std::string &  matrixName,
const std::string &  matrixDescription,
const bool  debug = false 
)
inlinestatic

Print the sparse matrix in Matrix Market format, with comments.

Write the given Tpetra::CrsMatrix sparse matrix to an output stream, using the Matrix Market "coordinate" format. MPI Proc 0 is the only MPI process that writes to the output stream.

Parameters
out[out] Name of the output stream to which to write the given sparse matrix. The matrix is distributed, but only Proc 0 writes to the output stream.
matrix[in] The sparse matrix to write to the given output stream.
matrixName[in] Name of the matrix, to print in the comments section of the output stream. If empty, we don't print anything (not even an empty line).
matrixDescription[in] Matrix description, to print in the comments section of the output stream. If empty, we don't print anything (not even an empty line).
debug[in] Whether to print possibly copious debugging output to stderr on Proc 0.
Warning
The current implementation gathers the whole matrix onto MPI Process 0. This will cause out-of-memory errors if the matrix is too big to fit on one process. This will be fixed in the future.

Definition at line 5923 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeSparse ( std::ostream &  out,
const Teuchos::RCP< const sparse_matrix_type > &  pMatrix,
const std::string &  matrixName,
const std::string &  matrixDescription,
const bool  debug = false 
)
inlinestatic

Only for backwards compatibility; prefer the overload above.

Definition at line 6178 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeSparseGraph ( std::ostream &  out,
const crs_graph_type graph,
const std::string &  graphName,
const std::string &  graphDescription,
const bool  debug = false 
)
inlinestatic

Print the sparse graph in Matrix Market format to the given output stream.

Write the given Tpetra::CrsGraph sparse graph to an output stream, using the Matrix Market "coordinate" format.

Parameters
out[out] Name of the output stream to which to write the given sparse graph. The graph is distributed, but only Process 0 in the graph's communicator writes to the output stream. Thus, the output stream need only be valid (writeable) on Process 0.
graph[in] The sparse graph to write.
graphName[in] Name of the graph, to print in the comments section of the output stream. If empty, we don't print anything (not even an empty line).
graphDescription[in] Graph description, to print in the comments section of the output stream. If empty, we don't print anything (not even an empty line).
debug[in] Whether to print possibly copious debugging output to stderr on Process 0 of the graph's communicator. False (do NOT print) by default.
Warning
The current implementation gathers the whole graph onto Process 0 in the graph's communicator. This will cause out-of-memory errors if the graph is too big to fit on one process. This will be fixed in the future.

Definition at line 6221 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeSparseGraph ( std::ostream &  out,
const crs_graph_type graph,
const bool  debug = false 
)
inlinestatic

Print the sparse graph in Matrix Market format to the given output stream, with no comments.

See the above five-argument version of this function for full documentation.

Definition at line 6464 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeSparseGraphFile ( const std::string &  filename,
const crs_graph_type graph,
const std::string &  graphName,
const std::string &  graphDescription,
const bool  debug = false 
)
inlinestatic

Print the sparse graph in Matrix Market format to the given file (by filename).

Write the given Tpetra::CrsGraph sparse graph to the given file, using the Matrix Market "coordinate" format. Process 0 in the graph's communicator is the only MPI process that opens or writes to the file. Include the graph name and description in the comments section of the file (after the initial banner line, but before the graph metadata and data).

Parameters
filename[in] Name of the file to which to write the given sparse graph. The graph is distributed, but only Process 0 in the graph's communicator opens the file and writes to it.
graph[in] The sparse graph to write.
graphName[in] Name of the graph, to print in the comments section of the output stream. If empty, we don't print anything (not even an empty line).
graphDescription[in] Graph description, to print in the comments section of the output stream. If empty, we don't print anything (not even an empty line).
debug[in] Whether to print possibly copious debugging output to stderr on Process 0 of the graph's communicator. False (do NOT print) by default.
Warning
The current implementation gathers the whole graph onto Process 0 in the graph's communicator. This will cause out-of-memory errors if the graph is too big to fit on one process. This will be fixed in the future.

Definition at line 6506 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeSparseGraphFile ( const std::string &  filename,
const crs_graph_type graph,
const bool  debug = false 
)
inlinestatic

Print the sparse graph in Matrix Market format to the given file (by filename), with no comments.

See the above five-argument overload for full documentation.

Definition at line 6539 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeSparseGraphFile ( const std::string &  filename,
const Teuchos::RCP< const crs_graph_type > &  pGraph,
const std::string &  graphName,
const std::string &  graphDescription,
const bool  debug = false 
)
inlinestatic

Print the sparse graph in Matrix Market format to the given file (by filename), taking the graph by Teuchos::RCP.

This is just a convenience for users who don't want to remember to dereference the Teuchos::RCP. For documentation, see the above overload of this function that takes the graph by const reference, rather than by Teuchos::RCP.

Definition at line 6555 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeSparseGraphFile ( const std::string &  filename,
const Teuchos::RCP< const crs_graph_type > &  pGraph,
const bool  debug = false 
)
inlinestatic

Print the sparse graph in Matrix Market format to the given file (by filename), with no comments, taking the graph by Teuchos::RCP.

This is just a convenience for users who don't want to remember to dereference the Teuchos::RCP. For documentation, see the above overload of this function that takes the graph by const reference, rather than by Teuchos::RCP.

Definition at line 6574 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeSparse ( std::ostream &  out,
const sparse_matrix_type matrix,
const bool  debug = false 
)
inlinestatic

Print the sparse matrix in Matrix Market format.

Write the given Tpetra::CrsMatrix sparse matrix to an output stream, using the Matrix Market "coordinate" format. MPI Proc 0 is the only MPI process that writes to the output stream.

Parameters
out[out] Name of the output stream to which to write the given sparse matrix. The matrix is distributed, but only Proc 0 writes to the output stream.
matrix[in] The sparse matrix to write to the given output stream.
debug[in] Whether to print possibly copious debugging output to stderr on Proc 0.
Warning
The current implementation gathers the whole matrix onto MPI Proc 0. This will cause out-of-memory errors if the matrix is too big to fit on one process. This will be fixed in the future.

Definition at line 6604 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeSparse ( std::ostream &  out,
const Teuchos::RCP< const sparse_matrix_type > &  pMatrix,
const bool  debug = false 
)
inlinestatic

Only for backwards compatibility; prefer the overload above.

Definition at line 6613 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeDenseFile ( const std::string &  filename,
const multivector_type X,
const std::string &  matrixName,
const std::string &  matrixDescription,
const Teuchos::RCP< Teuchos::FancyOStream > &  err = Teuchos::null,
const Teuchos::RCP< Teuchos::FancyOStream > &  dbg = Teuchos::null 
)
inlinestatic

Print the multivector in Matrix Market format, with matrix name and description.

Write the given Tpetra::MultiVector matrix to the given file, using the Matrix Market "array" format for dense matrices. MPI Process 0 is the only MPI process that opens or writes to the file.

This is the preferred overload of writeDenseFile. It is used to implement all other overloads of writeDenseFile.

Parameters
filename[in] Name of the output file to create (on MPI Proc 0 only).
X[in] The dense matrix (stored as a multivector) to write to the output file.
matrixName[in] Name of the matrix, to print in the comments section of the output file. If empty, we don't print anything (not even an empty line).
matrixDescription[in] Matrix description, to print in the comments section of the output file. If empty, we don't print anything (not even an empty line).
err[out] If nonnull, print any error messages to it.
dbg[out] If nonnull, print copious debugging output to it.

Definition at line 6649 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeDenseFile ( const std::string &  filename,
const Teuchos::RCP< const multivector_type > &  X,
const std::string &  matrixName,
const std::string &  matrixDescription,
const Teuchos::RCP< Teuchos::FancyOStream > &  err = Teuchos::null,
const Teuchos::RCP< Teuchos::FancyOStream > &  dbg = Teuchos::null 
)
inlinestatic

Print the multivector in Matrix Market format, with matrix name and description.

See the documentation of the above six-argument version of writeDenseFile().

Definition at line 6677 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeDenseFile ( const std::string &  filename,
const multivector_type X,
const Teuchos::RCP< Teuchos::FancyOStream > &  err = Teuchos::null,
const Teuchos::RCP< Teuchos::FancyOStream > &  dbg = Teuchos::null 
)
inlinestatic

Print the multivector in Matrix Market format, with no matrix name or description.

See the documentation of the above six-argument version of writeDenseFile().

Definition at line 6696 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeDenseFile ( const std::string &  filename,
const Teuchos::RCP< const multivector_type > &  X,
const Teuchos::RCP< Teuchos::FancyOStream > &  err = Teuchos::null,
const Teuchos::RCP< Teuchos::FancyOStream > &  dbg = Teuchos::null 
)
inlinestatic

Print the multivector in Matrix Market format, with no matrix name or description.

See the documentation of the above six-argument version of writeDenseFile().

Definition at line 6710 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeDense ( std::ostream &  out,
const multivector_type X,
const std::string &  matrixName,
const std::string &  matrixDescription,
const Teuchos::RCP< Teuchos::FancyOStream > &  err = Teuchos::null,
const Teuchos::RCP< Teuchos::FancyOStream > &  dbg = Teuchos::null 
)
inlinestatic

Print the multivector in Matrix Market format, with matrix name and description.

Write the given Tpetra::MultiVector matrix to an output stream, using the Matrix Market "array" format for dense matrices. MPI Process 0 in the given MultiVector's communicator is the only MPI process that may write to the given output stream.

This is the preferred overload of writeDense(). It is used to implement all other overloads of writeDense(), and is also used to implement all overloads of writeDenseFile().

Parameters
out[out] The output stream to which to write (on MPI Process 0 only).
X[in] The Tpetra::MultiVector to write to the given output file out.
matrixName[in] Name of the matrix, to print in the comments section of the output stream. If empty, we don't print anything (not even an empty line).
matrixDescription[in] Matrix description, to print in the comments section of the output stream. If empty, we don't print anything (not even an empty line).
err[out] If nonnull, print any error messages to it.
dbg[out] If nonnull, print copious debugging output to it.

Definition at line 6753 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeDense ( std::ostream &  out,
const Teuchos::RCP< const multivector_type > &  X,
const std::string &  matrixName,
const std::string &  matrixDescription,
const Teuchos::RCP< Teuchos::FancyOStream > &  err = Teuchos::null,
const Teuchos::RCP< Teuchos::FancyOStream > &  dbg = Teuchos::null 
)
inlinestatic

Print the multivector in Matrix Market format, with matrix name and or description.

See the documentation of the above six-argument version of writeDense().

Definition at line 7501 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeDense ( std::ostream &  out,
const multivector_type X,
const Teuchos::RCP< Teuchos::FancyOStream > &  err = Teuchos::null,
const Teuchos::RCP< Teuchos::FancyOStream > &  dbg = Teuchos::null 
)
inlinestatic

Print the multivector in Matrix Market format, with no matrix name or description.

See the documentation of the above six-argument version of writeDense().

Definition at line 7520 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeDense ( std::ostream &  out,
const Teuchos::RCP< const multivector_type > &  X,
const Teuchos::RCP< Teuchos::FancyOStream > &  err = Teuchos::null,
const Teuchos::RCP< Teuchos::FancyOStream > &  dbg = Teuchos::null 
)
inlinestatic

Print the multivector in Matrix Market format, with no matrix name or description.

See the documentation of the above six-argument version of writeDense().

Definition at line 7534 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeMap ( std::ostream &  out,
const map_type map,
const bool  debug = false 
)
inlinestatic

Print the Map to the given output stream.

Parameters
out[out] Output stream to which to print. This only needs to be accessible on Process 0 in the Map's communicator; no other process will do anything with it.
map[in] The Map to print.
debug[in] Whether to print copious debugging output to stderr on all processes in the Map's communicator.

We print the Map in Matrix Market format as a dense nonsymmetric integer matrix with two columns. The first column holds global indices (GIDs), and the second column holds process ranks (PIDs). In any row of the matrix, the first entry is a GID, and the second is a PID that owns the GID. Multiple PIDs may own the same GID, and the order of rows with respect to a given PID is significant.

Definition at line 7565 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeMap ( std::ostream &  out,
const map_type map,
const Teuchos::RCP< Teuchos::FancyOStream > &  err,
const bool  debug = false 
)
inlinestatic

Print the Map to the given output stream out.

This version of writeMap() comes with an extra debug output stream err, that is only used if debug is true.

Warning
We make no promises of backwards compatibility with this method. It may go away or its interface may change at any time.

Definition at line 7581 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeMapFile ( const std::string &  filename,
const map_type map 
)
inlinestatic

Write the Map to the given file.

Definition at line 8082 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeOperator ( const std::string &  fileName,
operator_type const &  A 
)
inlinestatic

Write a Tpetra::Operator to a file.

This method works by applying the Operator to columns of the identity matrix. As a result, it effectively turns the Operator into a dense matrix. However, it writes the Operator in sparse matrix format. As such, you may read it back in again using Reader::readSparseFile.

Probing calls apply() on the input Operator, using a MultiVector with a small, fixed number of columns. If you want to change the number of columns used, you must invoke the overload of this method that takes an input Teuchos::ParameterList (see below).

Parameters
fileName[in] The name of the file to which to write. Only Process 0 in the input Operator's communicator will write to the file.
A[in] The input Tpetra::Operator to write.

Definition at line 8162 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeOperator ( std::ostream &  out,
const operator_type A 
)
inlinestatic

Write a Tpetra::Operator to an output stream.

This method works by applying the Operator to columns of the identity matrix. As a result, it effectively turns the Operator into a dense matrix. However, it writes the Operator in sparse matrix format. As such, you may read it back in again using Reader::readSparseFile.

Probing calls apply() on the input Operator, using a MultiVector with a small, fixed number of columns. If you want to change the number of columns used, you must invoke the overload of this method that takes an input Teuchos::ParameterList (see below).

Parameters
out[in] Output stream to which to write. Only Process 0 in the input Operator's communicator will write to the output stream. Other processes will not write to it or call any methods on it. Thus, the stream need only be valid on Process 0.
A[in] The input Tpetra::Operator to write.

Definition at line 8188 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeOperator ( const std::string &  fileName,
const operator_type A,
const Teuchos::ParameterList &  params 
)
inlinestatic

Write a Tpetra::Operator to a file, with options.

This method works by applying the Operator to columns of the identity matrix. As a result, it effectively turns the Operator into a dense matrix. However, it writes the Operator in sparse matrix format. As such, you may read it back in again using Reader::readSparseFile.

Probing calls apply() on the input Operator, using a MultiVector with a small, fixed number of columns. You may set this number of columns in the input ParameterList.

Parameters
fileName[in] The name of the file to which to write. Only Process 0 in the Operator's communicator will write to the file.
A[in] The input Tpetra::Operator to write.
params[in] List of options. An empty list means "use default values of options."

If you always want the default options, use the overload of this method above that takes two arguments (the filename and the Operator). This three-argument overload lets the user pass in options. The currently supported options are:

  • "probing size" (integer [10]): number of columns to use in the probing MultiVector
  • "precision" (integer [C++ default]): precision to use when writing floating-point values
  • "print MatrixMarket header" (boolean [true]): whether to print the MatrixMarket header
  • "zero-based indexing" (boolean [false]): print matrix using zero-based indexing. The Matrix Market format uses one-based indexing, so setting this option to true violates the Matrix Market format standard.

Definition at line 8230 of file MatrixMarket_Tpetra.hpp.

template<class SparseMatrixType >
static void Tpetra::MatrixMarket::Writer< SparseMatrixType >::writeOperator ( std::ostream &  out,
const operator_type A,
const Teuchos::ParameterList &  params 
)
inlinestatic

Write a Tpetra::Operator to an output stream, with options.

This method works by applying the Operator to columns of the identity matrix. As a result, it effectively turns the Operator into a dense matrix. However, it writes the Operator in sparse matrix format. As such, you may read it back in again using Reader::readSparseFile.

Probing calls apply() on the input Operator, using a MultiVector with a small, fixed number of columns. You may set this number of columns in the input ParameterList.

Parameters
out[in] Output stream to which to write. Only Process 0 in the input Operator's communicator will write to the output stream. Other processes will not write to it or call any methods on it. Thus, the stream need only be valid on Process 0.
A[in] The input Tpetra::Operator to write.
params[in] List of options. An empty list means "use default values of options."

If you always want the default options, use the overload of this method above that takes two arguments (the filename and the Operator). This three-argument overload lets the user pass in options. The currently supported options are:

  • "probing size" (integer [10]): number of columns to use in the probing MultiVector
  • "precision" (integer [C++ default]): precision to use when writing floating-point values
  • "print MatrixMarket header" (boolean [true]): whether to print the MatrixMarket header
  • "zero-based indexing" (boolean [false]): print matrix using zero-based indexing. The Matrix Market format uses one-based indexing, so setting this option to true violates the Matrix Market format standard.

Definition at line 8319 of file MatrixMarket_Tpetra.hpp.


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