Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Stokhos_EpetraMultiVectorOrthogPoly.cpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Stokhos Package
4 //
5 // Copyright 2009 NTESS and the Stokhos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
11 
17 {
18 }
19 
23  const Teuchos::RCP<const Epetra_BlockMap>& block_map) :
25  VectorOrthogPoly<Epetra_MultiVector>(basis, block_map),
26  ProductEpetraMultiVector(block_map)
27 {
28 }
29 
33  const Teuchos::RCP<const Epetra_BlockMap>& block_map,
34  const Teuchos::RCP<const Epetra_BlockMap>& coeff_map,
35  const Teuchos::RCP<const EpetraExt::MultiComm>& product_comm,
36  int num_vectors) :
38  VectorOrthogPoly<Epetra_MultiVector>(basis, block_map),
39  ProductEpetraMultiVector(block_map, coeff_map, product_comm, num_vectors)
40 {
41 }
42 
46  const Teuchos::RCP<const Epetra_BlockMap>& block_map,
47  const Teuchos::RCP<const Epetra_BlockMap>& coeff_map,
48  const Teuchos::RCP<const Epetra_BlockMap>& product_map,
49  const Teuchos::RCP<const EpetraExt::MultiComm>& product_comm,
50  int num_vectors) :
52  VectorOrthogPoly<Epetra_MultiVector>(basis, block_map),
53  ProductEpetraMultiVector(block_map, coeff_map, product_map, product_comm,
54  num_vectors)
55 {
56 }
57 
61  const Teuchos::RCP<const Epetra_BlockMap>& block_map,
62  const Teuchos::RCP<const Epetra_BlockMap>& coeff_map,
63  const Teuchos::RCP<const Epetra_BlockMap>& product_map,
64  const Teuchos::RCP<const EpetraExt::MultiComm>& product_comm,
66  const Epetra_MultiVector& block_vector) :
68  VectorOrthogPoly<Epetra_MultiVector>(basis, block_map),
69  ProductEpetraMultiVector(block_map, coeff_map, product_map, product_comm, CV,
70  block_vector)
71 {
72 }
73 
79 {
80 }
81 
84 
89  this->basis_ = v.basis_;
90  return *this;
91 }
92 
93 void
96  const Teuchos::RCP<const Stokhos::OrthogPolyBasis<int, double> >& new_basis,
97  const Teuchos::RCP<const Epetra_BlockMap>& block_map,
98  const Teuchos::RCP<const Epetra_BlockMap>& coeff_map,
99  const Teuchos::RCP<const EpetraExt::MultiComm>& product_comm,
100  int num_vectors)
101 {
102  ProductEpetraMultiVector::reset(block_map, coeff_map, product_comm,
103  num_vectors);
104  this->basis_ = new_basis;
105 }
106 
107 void
110  const Teuchos::RCP<const Stokhos::OrthogPolyBasis<int, double> >& new_basis,
111  const Teuchos::RCP<const Epetra_BlockMap>& block_map,
112  const Teuchos::RCP<const Epetra_BlockMap>& coeff_map,
113  const Teuchos::RCP<const Epetra_BlockMap>& product_map,
114  const Teuchos::RCP<const EpetraExt::MultiComm>& product_comm,
115  int num_vectors)
116 {
117  ProductEpetraMultiVector::reset(block_map, coeff_map, product_map,
118  product_comm, num_vectors);
119  this->basis_ = new_basis;
120 }
121 
122 void
125 {
126  int lid = this->map_->LID(0);
127  v.Scale(1.0, *(this->coeff_[lid]));
128 }
129 
130 void
133 {
134  const Teuchos::Array<double>& nrm2 = this->basis_->norm_squared();
135  v.PutScalar(0.0);
136  int i_gid;
137  for (int i=1; i<this->size(); i++) {
138  i_gid = this->map_->GID(i);
139  v.Multiply(nrm2[i_gid], *(this->coeff_[i]), *(this->coeff_[i]), 1.0);
140  }
141 }
142 
143 void
146 {
147  computeVariance(v);
148 
149  for (int j=0; j<v.NumVectors(); j++)
150  for (int i=0; i<v.MyLength(); i++)
151  v[j][i] = std::sqrt(v[j][i]);
152 }
KOKKOS_INLINE_FUNCTION PCE< Storage > sqrt(const PCE< Storage > &a)
void computeMean(Epetra_MultiVector &v) const
Compute mean.
EpetraMultiVectorOrthogPoly & operator=(const EpetraMultiVectorOrthogPoly &v)
Assignment.
void computeStandardDeviation(Epetra_MultiVector &v) const
Compute standard deviation.
void reset(const Teuchos::RCP< const Stokhos::OrthogPolyBasis< int, double > > &basis, const Teuchos::RCP< const Epetra_BlockMap > &block_map, const Teuchos::RCP< const Epetra_BlockMap > &coeff_map, const Teuchos::RCP< const EpetraExt::MultiComm > &product_comm, int num_vectors)
Reset to a new basis.
ProductEpetraMultiVector & operator=(const ProductEpetraMultiVector &v)
Assignment.
void computeVariance(Epetra_MultiVector &v) const
Compute variance.
void reset(const Teuchos::RCP< const Epetra_BlockMap > &block_map, const Teuchos::RCP< const Epetra_BlockMap > &coeff_map, const Teuchos::RCP< const EpetraExt::MultiComm > &product_comm, int num_vectors)
Reset to a new size.
A container class storing products of Epetra_MultiVector&#39;s.
Teuchos::RCP< const Stokhos::OrthogPolyBasis< ordinal_type, value_type > > basis_
Basis.
A product (in the mathematical sense) container class whose coefficients are vectors, operators, or in general any type that would have an expensive copy constructor.
A container class storing an orthogonal polynomial whose coefficients are vectors, operators, or in general any type that would have an expensive copy constructor.
Epetra_DataAccess
A container class storing an orthogonal polynomial whose coefficients are vectors, operators, or in general any type that would have an expensive copy constructor.