10#ifndef __Teuchos_MatrixMarket_Raw_Writer_hpp 
   11#define __Teuchos_MatrixMarket_Raw_Writer_hpp 
   13#include <Teuchos_SetScientific.hpp> 
   14#include "Teuchos_ArrayView.hpp" 
   34      template<
class ScalarType, 
class OrdinalType>
 
   66          std::ofstream out (
filename.c_str ());
 
   68            "Failed to open file \"" << 
filename << 
"\" for writing.");
 
 
  116    std::string dataType;
 
  117    if (STS::isComplex) {
 
  118      dataType = 
"complex";
 
  119    } 
else if (STS::isOrdinal) {
 
  120      dataType = 
"integer";
 
  127          out << 
"%%MatrixMarket matrix coordinate " << dataType << 
" general" 
  141    out << numRows << 
" " << numCols << 
" " << 
rowptr[numRows] << 
endl;
 
  143    for (size_type 
i = 0; 
i < numRows; ++
i) {
 
  149        out << (
i+1) << 
" " << (
j+1) << 
" ";
 
  150        if (STS::isComplex) {
 
  151    out << STS::real (
A_ij) << 
" " << STS::imag (
A_ij);
 
 
 
Templated Parameter List class.
 
Write a sparse matrix from raw CSR (compressed sparse row) storage to a Matrix Market file.
 
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.
 
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.
 
Smart reference counting pointer class for automatic garbage collection.
 
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
 
Matrix Market file utilities.
 
"Raw" input of sparse matrices from Matrix Market files.
 
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...