1 #ifndef BASISEXPANSION_H
2 #define BASISEXPANSION_H
12 namespace Approximation{
14 class MonotoneExpansion;
73 BasisExpansion(std::vector<std::shared_ptr<IndexedScalarBasis>>
const& basisCompsIn,
74 bool coeffInput=
false);
79 BasisExpansion(std::vector<std::shared_ptr<IndexedScalarBasis>>
const& basisCompsIn,
80 std::shared_ptr<muq::Utilities::MultiIndexSet> multisIn,
81 bool coeffInput=
false);
84 BasisExpansion(std::vector<std::shared_ptr<IndexedScalarBasis>>
const& basisCompsIn,
85 std::shared_ptr<muq::Utilities::MultiIndexSet> multisIn,
86 Eigen::MatrixXd
const& coeffsIn,
87 bool coeffInput=
false);
110 Eigen::MatrixXd
BuildDerivMatrix(Eigen::MatrixXd
const& evalPts,
int wrtDim)
const;
115 Eigen::VectorXd
const& evalPt,
116 Eigen::MatrixXd
const&
coeffs);
121 Eigen::VectorXd
const& evalPt);
125 void SetCoeffs(Eigen::MatrixXd
const& allCoeffs);
127 const std::shared_ptr<muq::Utilities::MultiIndexSet>
Multis()
const{
return multis;};
143 virtual void ToHDF5(std::string filename, std::string groupName=
"/")
const;
170 static std::shared_ptr<BasisExpansion>
FromHDF5(std::string filename, std::string groupName=
"/");
183 static Eigen::VectorXi
GetInputSizes(std::shared_ptr<muq::Utilities::MultiIndexSet> multisIn,
184 Eigen::MatrixXd
const& coeffsIn,
187 static Eigen::VectorXi
GetOutputSizes(std::shared_ptr<muq::Utilities::MultiIndexSet> multisIn,
188 Eigen::MatrixXd
const& coeffsIn);
193 unsigned int const wrtOut,
199 Eigen::VectorXd
GetAllTerms(Eigen::VectorXd
const& x)
const;
204 Eigen::MatrixXd
GetAllDerivs(Eigen::VectorXd
const& x)
const;
207 std::vector<Eigen::MatrixXd>
GetHessians(Eigen::VectorXd
const& x)
const;
216 std::shared_ptr<muq::Utilities::MultiIndexSet>
multis;
Class for defining expansions of basis functions defined by a MultiIndexSet and collection of IndexSc...
std::vector< Eigen::MatrixXd > GetHessians(Eigen::VectorXd const &x) const
void ProcessCoeffs(Eigen::VectorXd const &newCoeffs)
Eigen::VectorXd GetAllTerms(Eigen::VectorXd const &x) const
virtual void JacobianImpl(unsigned int const wrtIn, unsigned int const wrtOut, muq::Modeling::ref_vector< Eigen::VectorXd > const &inputs) override
friend class MonotoneExpansion
Eigen::MatrixXd BuildDerivMatrix(Eigen::MatrixXd const &evalPts, int wrtDim) const
std::shared_ptr< muq::Utilities::MultiIndexSet > multis
static std::shared_ptr< BasisExpansion > FromHDF5(std::string filename, std::string groupName="/")
Loads an expansion from an HDF5 file.
Eigen::MatrixXd BuildVandermonde(Eigen::MatrixXd const &evalPts) const
virtual unsigned NumTerms() const
const std::shared_ptr< muq::Utilities::MultiIndexSet > Multis() const
static Eigen::VectorXi GetOutputSizes(std::shared_ptr< muq::Utilities::MultiIndexSet > multisIn, Eigen::MatrixXd const &coeffsIn)
BasisExpansion(std::vector< std::shared_ptr< IndexedScalarBasis >> const &basisCompsIn, bool coeffInput=false)
Eigen::MatrixXd GetCoeffs() const
Eigen::MatrixXd GetAllDerivs(Eigen::VectorXd const &x) const
Eigen::MatrixXd SecondDerivative(unsigned outputDim, unsigned wrtDim1, unsigned wrtDim2, Eigen::VectorXd const &evalPt, Eigen::MatrixXd const &coeffs)
static Eigen::VectorXi GetInputSizes(std::shared_ptr< muq::Utilities::MultiIndexSet > multisIn, Eigen::MatrixXd const &coeffsIn, bool coeffInput)
std::vector< std::shared_ptr< IndexedScalarBasis > > basisComps
virtual void EvaluateImpl(muq::Modeling::ref_vector< Eigen::VectorXd > const &inputs) override
virtual ~BasisExpansion()=default
void SetCoeffs(Eigen::MatrixXd const &allCoeffs)
virtual void ToHDF5(std::string filename, std::string groupName="/") const
Saves the expansion to group in an HDF5 file.
Provides an abstract interface for defining vector-valued model components.
std::vector< std::reference_wrapper< const T > > ref_vector
A vector of references to something ...