22 #include "EpetraExt_RowMatrixOut.h"
50 MPI_Init(&argc,&argv);
56 "This example generates the sparsity pattern for the block stochastic Galerkin matrix.\n");
58 CLP.
setOption(
"dimension", &d,
"Stochastic dimension");
60 CLP.
setOption(
"order", &p,
"Polynomial order");
61 double drop = 1.0e-15;
62 CLP.
setOption(
"drop", &drop,
"Drop tolerance");
63 std::string file_base =
"A";
64 CLP.
setOption(
"base filename", &file_base,
"Base filename for matrix market files");
70 CLP.
setOption(
"full",
"linear", &full,
"Use full or linear expansion");
72 CLP.
setOption(
"old",
"new", &use_old,
"Use old or new Cijk algorithm");
75 CLP.
parse( argc, argv );
79 for (
int i=0; i<d; i++) {
84 else if (basis_type ==
RYS)
96 num_k = basis->size();
97 Cijk = basis->computeTripleProductTensor();
100 num_k = basis->dimension()+1;
101 Cijk = basis->computeLinearTripleProductTensor();
104 std::cout <<
"basis size = " << basis->size()
105 <<
" num nonzero Cijk entries = " << Cijk->num_entries()
115 int num_rows = basis->size();
124 for (Cijk_type::k_iterator k_it=Cijk->k_begin();
125 k_it!=Cijk->k_end(); ++k_it) {
128 for (Cijk_type::kj_iterator j_it = Cijk->j_begin(k_it);
129 j_it != Cijk->j_end(k_it); ++j_it) {
131 for (Cijk_type::kji_iterator i_it = Cijk->i_begin(j_it);
132 i_it != Cijk->i_end(j_it); ++i_it) {
140 std::stringstream ss;
141 ss << file_base <<
"_" << k <<
".mm";
142 std::string file = ss.str();
145 EpetraExt::RowMatrixToMatrixMarketFile(file.c_str(), mat);
149 catch (std::exception& e) {
150 std::cout << e.what() << std::endl;
Hermite polynomial basis.
SparseArrayIterator< index_iterator, value_iterator >::value_type index(const SparseArrayIterator< index_iterator, value_iterator > &it)
const char * basis_type_names[]
const BasisType basis_type_values[]
virtual int InsertGlobalValues(int GlobalRow, int NumEntries, const double *Values, const int *Indices)
int FillComplete(bool OptimizeDataStorage=true)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void setOption(const char option_true[], const char option_false[], bool *option_val, const char documentation[]=NULL)
EParseCommandLineReturn parse(int argc, char *argv[], std::ostream *errout=&std::cerr) const
Legendre polynomial basis.
Stokhos::Sparse3Tensor< int, double > Cijk_type
int main(int argc, char **argv)
void setDocString(const char doc_string[])
const int num_basis_types