Stokhos Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
Stokhos_CompletePolynomialBasis.hpp
Go to the documentation of this file.
1// @HEADER
2// ***********************************************************************
3//
4// Stokhos Package
5// Copyright (2009) Sandia Corporation
6//
7// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8// license for use of this work by or on behalf of the U.S. Government.
9//
10// Redistribution and use in source and binary forms, with or without
11// modification, are permitted provided that the following conditions are
12// met:
13//
14// 1. Redistributions of source code must retain the above copyright
15// notice, this list of conditions and the following disclaimer.
16//
17// 2. Redistributions in binary form must reproduce the above copyright
18// notice, this list of conditions and the following disclaimer in the
19// documentation and/or other materials provided with the distribution.
20//
21// 3. Neither the name of the Corporation nor the names of the
22// contributors may be used to endorse or promote products derived from
23// this software without specific prior written permission.
24//
25// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36//
37// Questions? Contact Eric T. Phipps (etphipp@sandia.gov).
38//
39// ***********************************************************************
40// @HEADER
41
42#ifndef STOKHOS_COMPLETEPOLYNOMIALBASIS_HPP
43#define STOKHOS_COMPLETEPOLYNOMIALBASIS_HPP
44
45#include "Teuchos_RCP.hpp"
46#include "Teuchos_SerialDenseMatrix.hpp"
47
52
53namespace Stokhos {
54
71 template <typename ordinal_type, typename value_type>
73 public ProductBasis<ordinal_type,value_type>,
74 public DerivBasis<ordinal_type, value_type> {
75 public:
76
78
90 const Teuchos::Array< Teuchos::RCP<const OneDOrthogPolyBasis<ordinal_type,
91 value_type> > >& bases,
92 const value_type& sparse_tol = 1.0e-12,
93 bool use_old_cijk_alg = false,
94 const Teuchos::RCP< Teuchos::Array<value_type> >& deriv_coeffs = Teuchos::null);
95
98
100
101
103 ordinal_type order() const;
104
106 ordinal_type dimension() const;
107
109 virtual ordinal_type size() const;
110
112
116 virtual const Teuchos::Array<value_type>& norm_squared() const;
117
119 virtual const value_type& norm_squared(ordinal_type i) const;
120
122
128 virtual
129 Teuchos::RCP< Stokhos::Sparse3Tensor<ordinal_type, value_type> >
131
133 virtual
134 Teuchos::RCP< Stokhos::Sparse3Tensor<ordinal_type, value_type> >
136
138 virtual value_type evaluateZero(ordinal_type i) const;
139
141
145 virtual void evaluateBases(
146 const Teuchos::ArrayView<const value_type>& point,
147 Teuchos::Array<value_type>& basis_vals) const;
148
150 virtual void print(std::ostream& os) const;
151
153 virtual const std::string& getName() const;
154
156
158
159
161
166 virtual const MultiIndex<ordinal_type>& term(ordinal_type i) const;
167
169
173 virtual ordinal_type index(const MultiIndex<ordinal_type>& term) const;
174
176
179 Teuchos::Array< Teuchos::RCP<const OneDOrthogPolyBasis<ordinal_type,
180 value_type> > >
181 getCoordinateBases() const;
182
185
187
189
190
201 virtual
202 Teuchos::RCP< Stokhos::Dense3Tensor<ordinal_type, value_type> >
204 const Teuchos::RCP< const Teuchos::SerialDenseMatrix<ordinal_type, value_type> >& Bij,
205 const Teuchos::RCP< const Stokhos::Sparse3Tensor<ordinal_type, value_type> >& Cijk
206 ) const;
207
217 virtual
218 Teuchos::RCP< Teuchos::SerialDenseMatrix<ordinal_type, value_type> >
220
222
223 protected:
224
226 virtual
227 Teuchos::RCP< Stokhos::Sparse3Tensor<ordinal_type, value_type> >
228 computeTripleProductTensorOld(ordinal_type order) const;
229
231 virtual
232 Teuchos::RCP< Stokhos::Sparse3Tensor<ordinal_type, value_type> >
233 computeTripleProductTensorNew(ordinal_type order) const;
234
235 private:
236
237 // Prohibit copying
239
240 // Prohibit Assignment
242
243 protected:
244
246
248 std::string name;
249
251 ordinal_type p;
252
254 ordinal_type d;
255
257 ordinal_type sz;
258
260 Teuchos::Array< Teuchos::RCP<const OneDOrthogPolyBasis<ordinal_type, value_type> > > bases;
261
263 Teuchos::Array<ordinal_type> basis_orders;
264
266 value_type sparse_tol;
267
270
272 Teuchos::RCP< Teuchos::Array<value_type> > deriv_coeffs;
273
275 Teuchos::Array<value_type> norms;
276
278 Teuchos::Array< MultiIndex<ordinal_type> > terms;
279
281 Teuchos::Array<ordinal_type> num_terms;
282
284 mutable Teuchos::Array< Teuchos::Array<value_type> > basis_eval_tmp;
285
288
289 }; // class CompletePolynomialBasis
290
291} // Namespace Stokhos
292
293// Include template definitions
295
296#endif
Utilities for indexing a multi-variate complete polynomial basis.
Multivariate orthogonal polynomial basis generated from a total-order complete-polynomial tensor prod...
virtual value_type evaluateZero(ordinal_type i) const
Evaluate basis polynomial i at zero.
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeTripleProductTensor() const
Compute triple product tensor.
value_type sparse_tol
Tolerance for computing sparse Cijk.
virtual const MultiIndex< ordinal_type > & term(ordinal_type i) const
Get orders of each coordinate polynomial given an index i.
virtual ordinal_type index(const MultiIndex< ordinal_type > &term) const
Get index of the multivariate polynomial given orders of each coordinate.
virtual void print(std::ostream &os) const
Print basis to stream os.
CompletePolynomialBasis(const CompletePolynomialBasis &)
Teuchos::Array< Teuchos::RCP< const OneDOrthogPolyBasis< ordinal_type, value_type > > > getCoordinateBases() const
Return coordinate bases.
Teuchos::Array< ordinal_type > num_terms
Number of terms up to each order.
virtual MultiIndex< ordinal_type > getMaxOrders() const
Return maximum order allowable for each coordinate basis.
virtual void evaluateBases(const Teuchos::ArrayView< const value_type > &point, Teuchos::Array< value_type > &basis_vals) const
Evaluate basis polynomials at given point point.
Stokhos::CompletePolynomialBasisUtils< ordinal_type, value_type > CPBUtils
Teuchos::Array< Teuchos::RCP< const OneDOrthogPolyBasis< ordinal_type, value_type > > > bases
Array of bases.
CompletePolynomialBasis & operator=(const CompletePolynomialBasis &b)
Teuchos::Array< MultiIndex< ordinal_type > > terms
2-D array of basis terms
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeLinearTripleProductTensor() const
Compute linear triple product tensor where k = 0,1,..,d.
bool use_old_cijk_alg
Use old algorithm for computing Cijk.
virtual ordinal_type size() const
Return total size of basis.
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeTripleProductTensorNew(ordinal_type order) const
Compute triple product tensor using new algorithm.
virtual Teuchos::RCP< Teuchos::SerialDenseMatrix< ordinal_type, value_type > > computeDerivDoubleProductTensor() const
Compute double product tensor where represents the derivative of in the direction .
ordinal_type order() const
Return order of basis.
Stokhos::Sparse3Tensor< ordinal_type, value_type > Cijk_type
Short-hand for Cijk.
Teuchos::RCP< Teuchos::Array< value_type > > deriv_coeffs
Coefficients for derivative.
virtual const std::string & getName() const
Return string name of basis.
Teuchos::Array< value_type > norms
Norms.
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeTripleProductTensorOld(ordinal_type order) const
Compute triple product tensor using old algorithm.
virtual const Teuchos::Array< value_type > & norm_squared() const
Return array storing norm-squared of each basis polynomial.
virtual Teuchos::RCP< Stokhos::Dense3Tensor< ordinal_type, value_type > > computeDerivTripleProductTensor(const Teuchos::RCP< const Teuchos::SerialDenseMatrix< ordinal_type, value_type > > &Bij, const Teuchos::RCP< const Stokhos::Sparse3Tensor< ordinal_type, value_type > > &Cijk) const
Compute triple product tensor where represents the derivative of in the direction .
ordinal_type dimension() const
Return dimension of basis.
Teuchos::Array< Teuchos::Array< value_type > > basis_eval_tmp
Temporary array used in basis evaluation.
Teuchos::Array< ordinal_type > basis_orders
Array storing order of each basis.
ordinal_type d
Total dimension of basis.
Abstract base class for multivariate orthogonal polynomials that support computing double and triple ...
A multidimensional index.
Abstract base class for 1-D orthogonal polynomials.
Abstract base class for multivariate orthogonal polynomials generated from tensor products of univari...
Data structure storing a sparse 3-tensor C(i,j,k) in a a compressed format.
Top-level namespace for Stokhos classes and functions.