44#ifndef STOKHOS_SPARSE_3_TENSOR_UTILITIES_HPP
45#define STOKHOS_SPARSE_3_TENSOR_UTILITIES_HPP
53#include "EpetraExt_RowMatrixOut.h"
65 template <
typename ordinal_type,
typename value_type>
66 Teuchos::RCP<Epetra_CrsGraph>
75 ordinal_type num_rows = basis.
size();
81 Teuchos::RCP<Epetra_CrsGraph> graph =
86 for (
typename Cijk_type::k_iterator k_it=Cijk.
k_begin();
87 k_it!=Cijk.
k_end(); ++k_it) {
88 for (
typename Cijk_type::kj_iterator j_it = Cijk.
j_begin(k_it);
89 j_it != Cijk.
j_end(k_it); ++j_it) {
90 ordinal_type
j = index(j_it);
91 for (
typename Cijk_type::kji_iterator i_it = Cijk.
i_begin(j_it);
92 i_it != Cijk.
i_end(j_it); ++i_it) {
93 ordinal_type i = index(i_it);
94 graph->InsertGlobalIndices(i, 1, &
j);
100 graph->FillComplete();
113 template <
typename ordinal_type,
typename value_type>
114 Teuchos::RCP<Epetra_CrsGraph>
122 Teuchos::RCP<Epetra_CrsGraph> graph =
127 for (
typename Cijk_type::k_iterator k_it=Cijk.
k_begin();
128 k_it!=Cijk.
k_end(); ++k_it) {
129 for (
typename Cijk_type::kj_iterator j_it = Cijk.
j_begin(k_it);
130 j_it != Cijk.
j_end(k_it); ++j_it) {
131 ordinal_type
j = index(j_it);
132 for (
typename Cijk_type::kji_iterator i_it = Cijk.
i_begin(j_it);
133 i_it != Cijk.
i_end(j_it); ++i_it) {
134 ordinal_type i = index(i_it);
135 graph->InsertGlobalIndices(i, 1, &
j);
141 graph->FillComplete();
146 template <
typename ordinal_type,
typename value_type>
152 const std::string& file)
154 Teuchos::RCP<Epetra_CrsGraph> graph =
159 EpetraExt::RowMatrixToMatrixMarketFile(file.c_str(), mat);
162 template <
typename ordinal_type,
typename value_type>
167 const std::string& file)
169 Teuchos::RCP<Epetra_CrsGraph> graph =
174 EpetraExt::RowMatrixToMatrixMarketFile(file.c_str(), mat);
int FillComplete(bool OptimizeDataStorage=true)
int PutScalar(double ScalarConstant)
Abstract base class for multivariate orthogonal polynomials.
virtual ordinal_type size() const =0
Return total size of basis.
Data structure storing a sparse 3-tensor C(i,j,k) in a a compressed format.
kj_iterator j_end(const k_iterator &k) const
Iterator pointing to last j entry for given k.
k_iterator k_begin() const
Iterator pointing to first k entry.
kji_iterator i_begin(const kj_iterator &j) const
Iterator pointing to first i entry for given j and k.
kj_iterator j_begin(const k_iterator &k) const
Iterator pointing to first j entry for given k.
kji_iterator i_end(const kj_iterator &j) const
Iterator pointing to last i entry for given j and k.
k_iterator k_end() const
Iterator pointing to last k entry.
Top-level namespace for Stokhos classes and functions.
Teuchos::RCP< Epetra_CrsGraph > sparse3Tensor2CrsGraph(const Stokhos::OrthogPolyBasis< ordinal_type, value_type > &basis, const Stokhos::Sparse3Tensor< ordinal_type, value_type > &Cijk, const Epetra_Comm &comm)
Build an Epetra_CrsGraph from a sparse 3 tensor.
void sparse3Tensor2MatrixMarket(const Stokhos::OrthogPolyBasis< ordinal_type, value_type > &basis, const Stokhos::Sparse3Tensor< ordinal_type, value_type > &Cijk, const Epetra_Comm &comm, const std::string &file)