queso-0.53.0
LinearLagrangeInterpolationSurrogate.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // QUESO - a library to support the Quantification of Uncertainty
5 // for Estimation, Simulation and Optimization
6 //
7 // Copyright (C) 2008-2015 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 #ifndef UQ_LINEAR_LAGRANGE_INTERPOLATION_SURROGATE_H
26 #define UQ_LINEAR_LAGRANGE_INTERPOLATION_SURROGATE_H
27 
28 // QUESO
29 #include <queso/InterpolationSurrogateBase.h>
30 
31 // C++
32 #include <vector>
33 #include <cmath>
34 
35 namespace QUESO
36 {
37  class GslVector;
38  class GslMatrix;
39 
41 
43  template<class V = GslVector, class M = GslMatrix>
45  {
46  public:
47 
49 
53 
55 
57  virtual double evaluate(const V & domainVector) const;
58 
60  unsigned int n_coeffs() const
61  { return std::pow( 2, this->m_data.dim() ); };
62 
63  protected:
64 
66 
69  void compute_interval_indices(const V & domainVector,
70  std::vector<unsigned int>& indices) const;
71 
73 
75  void compute_interval_values( const std::vector<unsigned int>& indices,
76  std::vector<double>& x_min,
77  std::vector<double>& x_max,
78  std::vector<double>& values ) const;
79 
81 
82  double eval_interpolant( const std::vector<double>& x_min,
83  const std::vector<double>& x_max,
84  const std::vector<double>& values,
85  const V & domainVector ) const;
86 
88 
94  unsigned int coordsToSingle( const std::vector<unsigned int>& indices ) const;
95 
97  void singleToCoords( unsigned int global, std::vector<unsigned int>& indices ) const;
98 
100 
102  double tensor_product_lagrange( const std::vector<double>& x_min,
103  const std::vector<double>& x_max,
104  const std::vector<unsigned int>& indices,
105  const V & domainVector ) const;
106 
108 
110  double lagrange_poly( double x0, double x1, double x, unsigned int index ) const;
111 
112  private:
113 
115 
116  };
117 
118 } // end namespace QUESO
119 
120 #endif // UQ_LINEAR_LAGRANGE_INTERPOLATION_SURROGATE_H
void singleToCoords(unsigned int global, std::vector< unsigned int > &indices) const
Inverse of map computed in coordsToSingle.
void compute_interval_indices(const V &domainVector, std::vector< unsigned int > &indices) const
Helper function to get lower bound indices for each dimension.
virtual double evaluate(const V &domainVector) const
Evaluates value of the interpolant for the given domainVector.
void compute_interval_values(const std::vector< unsigned int > &indices, std::vector< double > &x_min, std::vector< double > &x_max, std::vector< double > &values) const
Helper function to populate bounding values for the intervals in each dimension.
Base class for interpolation-based surrogates.
unsigned int n_coeffs() const
The number of coeffs for interpolating.
const InterpolationSurrogateData< V, M > & m_data
double eval_interpolant(const std::vector< double > &x_min, const std::vector< double > &x_max, const std::vector< double > &values, const V &domainVector) const
Evaluate multidimensional linear Lagrange interpolant.
double tensor_product_lagrange(const std::vector< double > &x_min, const std::vector< double > &x_max, const std::vector< unsigned int > &indices, const V &domainVector) const
Compute multidimensional Lagrange polynomial as tensor product of 1D polynomials. ...
double lagrange_poly(double x0, double x1, double x, unsigned int index) const
Evaluate a 1-D Lagrange polynomial at point x.
unsigned int coordsToSingle(const std::vector< unsigned int > &indices) const
Convert local indices to single &quot;global&quot; index.

Generated on Thu Jun 11 2015 13:52:33 for queso-0.53.0 by  doxygen 1.8.5