8 #ifndef IMPISD_MULTIVARIATE_FNORMAL_SUFFICIENT_H
9 #define IMPISD_MULTIVARIATE_FNORMAL_SUFFICIENT_H
11 #include <IMP/isd/isd_config.h>
12 #include "internal/timer.h"
18 #include <Eigen/Dense>
19 #include <Eigen/Cholesky>
20 #include <IMP/isd/internal/cg_eigen.h>
22 IMPISD_BEGIN_NAMESPACE
23 using Eigen::MatrixXd;
24 using Eigen::VectorXd;
27 #define IMP_MVN_TIMER_NFUNCS 11
93 VectorXd FM_, Fbar_, epsilon_,Peps_;
94 double JF_,lJF_,norm_,lnorm_;
95 MatrixXd P_,W_,Sigma_,FX_,PW_;
99 Eigen::LDLT<MatrixXd, Eigen::Upper> ldlt_;
101 bool flag_FM_, flag_FX_, flag_Fbar_,
102 flag_W_, flag_Sigma_, flag_epsilon_,
103 flag_PW_, flag_P_, flag_ldlt_, flag_norms_,
107 bool use_cg_, first_PW_, first_PWP_;
112 internal::CallTimer<IMP_MVN_TIMER_NFUNCS> timer_;
124 const VectorXd& FM,
const MatrixXd& Sigma,
double factor=1);
137 const VectorXd& FM,
int Nobs,
const MatrixXd& W,
138 const MatrixXd& Sigma,
double factor=1);
141 double density()
const;
144 double evaluate()
const;
147 VectorXd evaluate_derivative_FM()
const;
150 MatrixXd evaluate_derivative_Sigma()
const;
153 double evaluate_derivative_factor()
const;
156 MatrixXd evaluate_second_derivative_FM_FM()
const;
161 MatrixXd evaluate_second_derivative_FM_Sigma(
unsigned l)
const;
164 MatrixXd evaluate_second_derivative_Sigma_Sigma(
unsigned k,
unsigned l)
const;
168 void set_FX(
const MatrixXd& f);
169 MatrixXd get_FX()
const;
171 void set_Fbar(
const VectorXd& f);
172 VectorXd get_Fbar()
const;
174 void set_jacobian(
double f);
175 double get_jacobian()
const;
176 void set_minus_log_jacobian(
double f);
177 double get_minus_log_jacobian()
const;
179 void set_FM(
const VectorXd& f);
180 VectorXd get_FM()
const;
182 void set_W(
const MatrixXd& f);
183 MatrixXd get_W()
const;
185 void set_Sigma(
const MatrixXd& f);
186 MatrixXd get_Sigma()
const;
188 void set_factor(
double f);
189 double get_factor()
const;
195 void set_use_cg(
bool use,
double tol);
201 VectorXd get_Sigma_eigenvalues()
const;
204 double get_Sigma_condition_number()
const;
207 MatrixXd solve(MatrixXd B)
const;
210 double get_mean_square_residuals()
const;
216 double get_minus_exponent()
const;
222 double get_minus_log_normalization()
const;
238 MatrixXd get_P()
const;
239 void set_P(
const MatrixXd& P);
242 MatrixXd get_PW()
const;
243 MatrixXd compute_PW_direct()
const;
244 MatrixXd compute_PW_cg()
const;
245 void set_PW(
const MatrixXd& PW);
248 VectorXd get_Peps()
const;
249 void set_Peps(
const VectorXd& Peps);
252 VectorXd get_epsilon()
const;
253 void set_epsilon(
const VectorXd& eps);
257 Eigen::LDLT<MatrixXd, Eigen::Upper> get_ldlt()
const;
258 void set_ldlt(
const Eigen::LDLT<MatrixXd, Eigen::Upper>& ldlt);
261 void set_norms(
double norm,
double lnorm);
262 std::vector<double> get_norms()
const;
265 double trace_WP()
const;
268 MatrixXd compute_PTP()
const;
271 MatrixXd compute_PWP()
const;
274 void compute_epsilon();
MultivariateFNormalSufficient.
Import IMP/kernel/constants.h in the namespace.
Import IMP/kernel/macros.h in the namespace.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Storage of a model, its restraints, constraints and particles.
Common base class for heavy weight IMP objects.
A shared base class to help in debugging and things.