8 #ifndef IMPISD_GAUSSIAN_PROCESS_INTERPOLATION_SPARSE_H
9 #define IMPISD_GAUSSIAN_PROCESS_INTERPOLATION_SPARSE_H
11 #include <IMP/isd/isd_config.h>
13 #ifdef IMP_ISD_USE_CHOLMOD
16 #include <boost/scoped_ptr.hpp>
19 #include <Eigen/Dense>
20 #define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET
21 #include <Eigen/Sparse>
22 #include <unsupported/Eigen/CholmodSupport>
23 #include <ufsparse/cholmod.h>
26 IMPISD_BEGIN_NAMESPACE
28 using Eigen::SparseMatrix;
29 using Eigen::MatrixXd;
30 using Eigen::VectorXd;
33 class GaussianProcessInterpolationRestraintSparse;
42 class IMPISDEXPORT GaussianProcessInterpolationSparse :
public base::Object
59 GaussianProcessInterpolationSparse(
FloatsList x,
63 UnivariateFunction *mean_function,
64 BivariateFunction *covariance_function,
89 double get_posterior_mean(
Floats x);
90 double get_posterior_covariance(
Floats x1,
95 void force_mean_update();
96 void force_covariance_update();
98 friend class GaussianProcessInterpolationRestraintSparse;
101 out <<
"GaussianProcessInterpolationSparse :"
102 "learning from " << M_ <<
" "
103 << N_ <<
"-dimensional observations" << std::endl,
105 cholmod_free_factor(&L_, c_);
106 cholmod_free_dense(&WSIm_, c_);
107 cholmod_free_sparse(&WS_,c_);
113 VectorXd get_I()
const {
return I_;}
117 cholmod_sparse *get_wx_vector(
Floats xval);
119 SparseMatrix<double> get_S()
const {
return S_;}
121 SparseMatrix<double> get_W();
123 cholmod_sparse *get_WS();
125 cholmod_factor *get_L();
127 cholmod_dense *get_WSIm();
134 void update_flags_mean();
135 void update_flags_covariance();
145 void compute_I(
Floats mean);
152 cholmod_common *get_cholmod_common() {
return c_; }
160 IMP::internal::OwnerPointer<UnivariateFunction> mean_function_;
162 IMP::internal::OwnerPointer<BivariateFunction> covariance_function_;
164 SparseMatrix<double> S_,W_,wx_;
167 cholmod_dense *WSIm_;
169 bool flag_m_, flag_m_gpir_, flag_WS_, flag_WSIm_, flag_W_, flag_W_gpir_;
171 cholmod_common Common_, *c_;