#include <crbscm.hpp>
SCM algorithm.
TruthModelType | the type of the class that describes the truth (e.g. fem) model problem |
TruthModelType must support a certain interface: affine decomposition, solve for fm problem and problem associated with with affine decomposition. As to the SCM, it should problem
Public Types | |
Typedefs | |
typedef TruthModelType | truth_model_type |
typedef truth_model_type | model_type |
typedef boost::shared_ptr < truth_model_type > | truth_model_ptrtype |
typedef double | value_type |
typedef boost::tuple< double, double > | bounds_type |
typedef ParameterSpace < TruthModelType::ParameterSpaceDimension > | parameterspace_type |
typedef boost::shared_ptr < parameterspace_type > | parameterspace_ptrtype |
typedef parameterspace_type::element_type | parameter_type |
typedef parameterspace_type::element_ptrtype | parameter_ptrtype |
typedef parameterspace_type::sampling_type | sampling_type |
typedef parameterspace_type::sampling_ptrtype | sampling_ptrtype |
typedef boost::tuple< double, parameter_type, size_type, double, double > | relative_error_type |
typedef model_type::backend_type | backend_type |
typedef model_type::sparse_matrix_ptrtype | sparse_matrix_ptrtype |
typedef model_type::vector_ptrtype | vector_ptrtype |
typedef model_type::beta_vector_type | beta_vector_type |
typedef Eigen::VectorXd | y_type |
typedef Eigen::VectorXd | vector_type |
typedef std::vector < std::vector< y_type > > | y_set_type |
typedef std::vector < std::vector< boost::tuple < double, double > > > | y_bounds_type |
Public Member Functions | |
sampling_ptrtype | c () const |
Constructors, destructor | |
CRBSCM () | |
default constructor | |
CRBSCM (std::string const &name, po::variables_map const &vm) | |
constructor from command line options | |
CRBSCM (std::string const &name, po::variables_map const &vm, truth_model_ptrtype const &model) | |
constructor from command line options | |
CRBSCM (std::string const &name, po::variables_map const &vm, truth_model_ptrtype const &model, bool scm_for_mass_matrix) | |
constructor from command line options | |
CRBSCM (CRBSCM const &o) | |
copy constructor | |
~CRBSCM () | |
destructor | |
Operator overloads | |
CRBSCM & | operator= (CRBSCM const &o) |
copy operator | |
Accessors | |
size_type | KMax () const |
Returns maximum value of K. | |
int | maxIter () const |
return max iterations | |
parameterspace_ptrtype | Dmu () const |
return the parameter space | |
int | Mplus () const |
get M+ | |
int | Malpha () |
get Malpha | |
Mutators | |
void | setTolerance (double tolerance) |
set offline tolerance | |
void | setMplus (int Mplus) |
set M+ | |
void | setMalpha (int Malpha) |
set Malpha | |
void | setTruthModel (truth_model_ptrtype const &model) |
set the truth offline model | |
void | setMaxIter (int K) |
set Kmax | |
void | setScmForMassMatrix (bool b) |
set bool ( if we do scm for mass matrix or not ) | |
int | mMax (int q) const |
int | nb_decomposition_terms_q (void) const |
int | nb_decomposition_terms_qm (void) const |
Methods | |
void | generate () |
void | checkC (size_type K) const |
boost::tuple< value_type, value_type > | ex (parameter_type const &mu) const |
boost::tuple< value_type, value_type > | lb (parameter_type const &mu, size_type K=invalid_size_type_value, int indexmu=-1) const |
boost::tuple< value_type, value_type > | lbSCM (parameter_type const &mu, size_type K=invalid_size_type_value, int indexmu=-1) const |
boost::tuple< value_type, value_type > | lbNoSCM (parameter_type const &mu, size_type K=invalid_size_type_value, int indexmu=-1) const |
boost::tuple< value_type, value_type > | lb (parameter_ptrtype const &mu, size_type K=invalid_size_type_value, int indexmu=-1) const |
boost::tuple< value_type, value_type > | ub (parameter_type const &mu, size_type K=invalid_size_type_value) const |
boost::tuple< value_type, value_type > | ub (parameter_ptrtype const &mu, size_type K=invalid_size_type_value) const |
std::vector< boost::tuple < double, double, double > > | offline () |
std::vector< boost::tuple < double, double, double > > | offlineSCM () |
std::vector< boost::tuple < double, double, double > > | offlineNoSCM () |
bounds_type | online () const |
relative_error_type | maxRelativeError (size_type K) const |
Retuns maximum value of the relative error. More... | |
void | computeYBounds () |
compute the bounds for ![]() | |
std::vector< double > | run (parameter_type const &mu, int K) |
void | run (const double *X, unsigned long N, double *Y, unsigned long P) |
void | saveDB () |
bool | loadDB () |
bool | rebuildDB () |
bool | doScmForMassMatrix () |
![]() | |
CRBDB () | |
default constructor | |
CRBDB (std::string prefixdir, std::string name, std::string dbprefix, po::variables_map const &vm) | |
constructor from command line options | |
CRBDB (CRBDB const &) | |
copy constructor | |
virtual | ~CRBDB () |
destructor | |
CRBDB & | operator= (CRBDB const &o) |
copy operator | |
std::string const & | prefixDirectory () const |
std::string const & | name () const |
std::string const & | dbFilename () const |
fs::path | dbLocalPath () const |
fs::path | dbSystemPath () const |
fs::path | lookForDB () const |
po::variables_map | vm () |
po::variables_map | vm () const |
bool | isDBLoaded () const |
void | setDBFilename (std::string const &filename) |
set the DB filename | |
Friends | |
class | boost::serialization::access |
Additional Inherited Members | |
![]() | |
template<class Archive > | |
void | load (Archive &ar, const unsigned int version) |
template<class Archive > | |
void | save (Archive &ar, const unsigned int version) const |
void | setIsLoaded (bool isloaded) |
void Feel::CRBSCM< TruthModelType >::checkC | ( | size_type | K) | const |
check properties
K | dimension of ![]() |
References Feel::CRBSCM< TruthModelType >::lb(), and Feel::CRBSCM< TruthModelType >::ub().
void Feel::CRBSCM< TruthModelType >::generate | ( | ) |
generate offline the space
boost::tuple< typename CRBSCM< TruthModelType >::value_type, double > Feel::CRBSCM< TruthModelType >::lb | ( | parameter_type const & | mu, |
size_type | K = invalid_size_type_value , |
||
int | indexmu = -1 |
||
) | const |
Returns the lower bound of the coercive constant given a parameter
mu | ![]() |
K | the dimension of ![]() |
|
inline |
Returns the lower bound of the coercive constant given a parameter
mu | ![]() |
K | the dimension of ![]() |
References Feel::CRBSCM< TruthModelType >::lb().
|
virtual |
CRBSCM< TruthModelType >::relative_error_type Feel::CRBSCM< TruthModelType >::maxRelativeError | ( | size_type | K) | const |
Retuns maximum value of the relative error.
Xi | fine sampling of the parameter space |
References Feel::CRBSCM< TruthModelType >::lb(), and Feel::CRBSCM< TruthModelType >::ub().
std::vector< boost::tuple< double, double, double > > Feel::CRBSCM< TruthModelType >::offline | ( | ) |
Offline computation
|
inline |
Online computation
std::vector< double > Feel::CRBSCM< TruthModelType >::run | ( | parameter_type const & | mu, |
int | K | ||
) |
K | size of C_K |
mu | parameter set |
References Feel::CRBSCM< TruthModelType >::lb(), and Feel::CRBSCM< TruthModelType >::ub().
void Feel::CRBSCM< TruthModelType >::run | ( | const double * | X, |
unsigned long | N, | ||
double * | Y, | ||
unsigned long | P | ||
) |
run scm for a set of parameter
X | - input parameter |
N | - number of input parameter |
Y | - outputs |
P | - number of outputs |
the output is the lower/upper bounds, hence P=2
References Feel::CRBSCM< TruthModelType >::KMax(), Feel::CRBSCM< TruthModelType >::lb(), and Feel::CRBSCM< TruthModelType >::ub().
|
virtual |
save the CRB database
Reimplemented from Feel::CRBDB.
References Feel::CRBDB::dbFilename(), and Feel::CRBDB::dbLocalPath().
boost::tuple< typename CRBSCM< TruthModelType >::value_type, double > Feel::CRBSCM< TruthModelType >::ub | ( | parameter_type const & | mu, |
size_type | K = invalid_size_type_value |
||
) | const |
Returns the upper bound of the coercive constant given a parameter
mu | ![]() |
K | the dimension of ![]() |
References Feel::invalid_size_type_value, and Feel::CRBSCM< TruthModelType >::KMax().
|
inline |
Returns the upper bound of the coercive constant given a parameter
mu | ![]() |
K | the dimension of ![]() |
References Feel::CRBSCM< TruthModelType >::ub().