#include <KernelSolution.h>
Definition at line 30 of file KernelSolution.h.
Enumerator |
---|
NONE |
|
CHOLESKY_LDLT |
|
CHOLESKY_LLT |
|
LU |
|
EIGENVECTOR |
|
Definition at line 36 of file KernelSolution.h.
lsst::ip::diffim::KernelSolution::KernelSolution |
( |
boost::shared_ptr< Eigen::MatrixXd > |
mMat, |
|
|
boost::shared_ptr< Eigen::VectorXd > |
bVec, |
|
|
bool |
fitForBackground |
|
) |
| |
|
explicit |
Definition at line 57 of file KernelSolution.cc.
KernelSolvedBy _solvedBy
Type of algorithm used to make solution.
static int _SolutionId
Unique identifier for solution.
bool _fitForBackground
Background terms included in fit.
int _id
Unique ID for object.
boost::shared_ptr< Eigen::VectorXd > _bVec
Derived least squares B vector.
boost::shared_ptr< Eigen::VectorXd > _aVec
Derived least squares solution matrix.
boost::shared_ptr< Eigen::MatrixXd > _mMat
Derived least squares M matrix.
lsst::ip::diffim::KernelSolution::KernelSolution |
( |
bool |
fitForBackground | ) |
|
|
explicit |
Definition at line 70 of file KernelSolution.cc.
KernelSolvedBy _solvedBy
Type of algorithm used to make solution.
static int _SolutionId
Unique identifier for solution.
bool _fitForBackground
Background terms included in fit.
int _id
Unique ID for object.
boost::shared_ptr< Eigen::VectorXd > _bVec
Derived least squares B vector.
boost::shared_ptr< Eigen::VectorXd > _aVec
Derived least squares solution matrix.
boost::shared_ptr< Eigen::MatrixXd > _mMat
Derived least squares M matrix.
lsst::ip::diffim::KernelSolution::KernelSolution |
( |
| ) |
|
|
explicit |
Definition at line 81 of file KernelSolution.cc.
KernelSolvedBy _solvedBy
Type of algorithm used to make solution.
static int _SolutionId
Unique identifier for solution.
bool _fitForBackground
Background terms included in fit.
int _id
Unique ID for object.
boost::shared_ptr< Eigen::VectorXd > _bVec
Derived least squares B vector.
boost::shared_ptr< Eigen::VectorXd > _aVec
Derived least squares solution matrix.
boost::shared_ptr< Eigen::MatrixXd > _mMat
Derived least squares M matrix.
virtual lsst::ip::diffim::KernelSolution::~KernelSolution |
( |
| ) |
|
|
inlinevirtual |
boost::shared_ptr<Eigen::VectorXd> lsst::ip::diffim::KernelSolution::getB |
( |
| ) |
|
|
inline |
Definition at line 64 of file KernelSolution.h.
boost::shared_ptr< Eigen::VectorXd > _bVec
Derived least squares B vector.
double lsst::ip::diffim::KernelSolution::getConditionNumber |
( |
ConditionNumberType |
conditionType | ) |
|
|
virtual |
Definition at line 94 of file KernelSolution.cc.
virtual double getConditionNumber(ConditionNumberType conditionType)
boost::shared_ptr< Eigen::MatrixXd > _mMat
Derived least squares M matrix.
double lsst::ip::diffim::KernelSolution::getConditionNumber |
( |
Eigen::MatrixXd |
mMat, |
|
|
ConditionNumberType |
conditionType |
|
) |
| |
|
virtual |
Definition at line 98 of file KernelSolution.cc.
100 switch (conditionType) {
103 Eigen::SelfAdjointEigenSolver<Eigen::MatrixXd> eVecValues(mMat);
104 Eigen::VectorXd eValues = eVecValues.eigenvalues();
105 double eMax = eValues.maxCoeff();
106 double eMin = eValues.minCoeff();
107 pexLog::TTrace<5>(
"lsst.ip.diffim.KernelSolution.getConditionNumber",
108 "EIGENVALUE eMax / eMin = %.3e", eMax / eMin);
109 return (eMax / eMin);
114 Eigen::VectorXd sValues = mMat.jacobiSvd().singularValues();
115 double sMax = sValues.maxCoeff();
116 double sMin = sValues.minCoeff();
117 pexLog::TTrace<5>(
"lsst.ip.diffim.KernelSolution.getConditionNumber",
118 "SVD eMax / eMin = %.3e", sMax / sMin);
119 return (sMax / sMin);
124 throw LSST_EXCEPT(pexExcept::InvalidParameterError,
125 "Undefined ConditionNumberType : only EIGENVALUE, SVD allowed.");
#define LSST_EXCEPT(type,...)
int lsst::ip::diffim::KernelSolution::getId |
( |
| ) |
const |
|
inline |
boost::shared_ptr<Eigen::MatrixXd> lsst::ip::diffim::KernelSolution::getM |
( |
| ) |
|
|
inline |
Definition at line 63 of file KernelSolution.h.
boost::shared_ptr< Eigen::MatrixXd > _mMat
Derived least squares M matrix.
Definition at line 59 of file KernelSolution.h.
KernelSolvedBy _solvedBy
Type of algorithm used to make solution.
void lsst::ip::diffim::KernelSolution::printA |
( |
| ) |
|
|
inline |
Definition at line 67 of file KernelSolution.h.
67 {std::cout << *
_aVec << std::endl;}
boost::shared_ptr< Eigen::VectorXd > _aVec
Derived least squares solution matrix.
void lsst::ip::diffim::KernelSolution::printB |
( |
| ) |
|
|
inline |
Definition at line 66 of file KernelSolution.h.
66 {std::cout << *
_bVec << std::endl;}
boost::shared_ptr< Eigen::VectorXd > _bVec
Derived least squares B vector.
void lsst::ip::diffim::KernelSolution::printM |
( |
| ) |
|
|
inline |
Definition at line 65 of file KernelSolution.h.
65 {std::cout << *
_mMat << std::endl;}
boost::shared_ptr< Eigen::MatrixXd > _mMat
Derived least squares M matrix.
void lsst::ip::diffim::KernelSolution::solve |
( |
| ) |
|
|
virtual |
void lsst::ip::diffim::KernelSolution::solve |
( |
Eigen::MatrixXd |
mMat, |
|
|
Eigen::VectorXd |
bVec |
|
) |
| |
|
virtual |
Definition at line 131 of file KernelSolution.cc.
135 std::cout <<
"M " << std::endl;
136 std::cout << mMat << std::endl;
137 std::cout <<
"B " << std::endl;
138 std::cout << bVec << std::endl;
141 Eigen::VectorXd aVec = Eigen::VectorXd::Zero(bVec.size());
146 pexLog::TTrace<4>(
"lsst.ip.difim.KernelSolution.solve",
147 "Solving for kernel");
149 Eigen::FullPivLU<Eigen::MatrixXd> lu(mMat);
150 if (lu.isInvertible()) {
151 aVec = lu.solve(bVec);
153 pexLog::TTrace<5>(
"lsst.ip.diffim.KernelSolution.solve",
154 "Unable to determine kernel via LU");
159 Eigen::SelfAdjointEigenSolver<Eigen::MatrixXd> eVecValues(mMat);
160 Eigen::MatrixXd
const& rMat = eVecValues.eigenvectors();
161 Eigen::VectorXd eValues = eVecValues.eigenvalues();
163 for (
int i = 0; i != eValues.rows(); ++i) {
164 if (eValues(i) != 0.0) {
165 eValues(i) = 1.0/eValues(i);
169 aVec = rMat * eValues.asDiagonal() * rMat.transpose() * bVec;
173 pexLog::TTrace<5>(
"lsst.ip.diffim.KernelSolution.solve",
174 "Unable to determine kernel via eigen-values");
180 double time = t.elapsed();
181 pexLog::TTrace<5>(
"lsst.ip.diffim.KernelSolution.solve",
182 "Compute time for matrix math : %.2f s", time);
185 std::cout <<
"A " << std::endl;
186 std::cout << aVec << std::endl;
189 _aVec = boost::shared_ptr<Eigen::VectorXd>(
new Eigen::VectorXd(aVec));
KernelSolvedBy _solvedBy
Type of algorithm used to make solution.
#define LSST_EXCEPT(type,...)
boost::shared_ptr< Eigen::VectorXd > _aVec
Derived least squares solution matrix.
boost::shared_ptr<Eigen::VectorXd> lsst::ip::diffim::KernelSolution::_aVec |
|
protected |
boost::shared_ptr<Eigen::VectorXd> lsst::ip::diffim::KernelSolution::_bVec |
|
protected |
bool lsst::ip::diffim::KernelSolution::_fitForBackground |
|
protected |
int lsst::ip::diffim::KernelSolution::_id |
|
protected |
boost::shared_ptr<Eigen::MatrixXd> lsst::ip::diffim::KernelSolution::_mMat |
|
protected |
int lsst::ip::diffim::KernelSolution::_SolutionId = 0 |
|
staticprotected |
The documentation for this class was generated from the following files: