42 #include "../../../App/ApplicationTools.h"
43 #include "../../Matrix/EigenValue.h"
44 #include "../../Matrix/Matrix.h"
45 #include "../../Matrix/MatrixTools.h"
53 const vector<double>& rowWeights,
54 const vector<double>& colWeights,
56 double tol,
bool verbose) :
57 rowWeights_(rowWeights),
58 colWeights_(colWeights),
67 check_(matrix, rowWeights, colWeights, verbose);
73 const vector<double>& rowWeights,
74 const vector<double>& colWeights,
80 if (rowWeights.size() != rowNb)
81 throw Exception(
"DualityDiagram::check_. The number of row weigths has to be equal to the number of rows!");
82 if (colWeights.size() != colNb)
83 throw Exception(
"DualityDiagram::check_. The number of column weigths has to be equal to the number of columns!");
86 for (vector<double>::const_iterator it = rowWeights.begin(); it != rowWeights.end(); it++)
89 throw Exception(
"DualityDiagram::check_. All row weights have to be positive");
93 for (vector<double>::const_iterator it = colWeights.begin(); it != colWeights.end(); it++)
96 throw Exception(
"DualityDiagram::check_. All column weights have to be positive");
103 const vector<double>& rowWeights,
104 const vector<double>& colWeights,
106 double tol,
bool verbose)
108 check_(matrix, rowWeights, colWeights, verbose);
116 double tol,
bool verbose)
122 bool transpose = (rowNb < colNb);
126 for (
unsigned int i = 0; i <
rowWeights_.size(); i++)
136 for (
unsigned int i = 0; i <
colWeights_.size(); i++)
155 throw Exception(
"DualityDiagram (constructor). The variance-covariance or correlation matrix should be symmetric...");
170 throw Exception(
"DualityDiagram (constructor). The number of axes to keep must be positive.");
181 vector<double> tmpEigenValues(
nbAxes_);
203 for (
size_t i = 0; i < dval.size(); i++)
208 vector<double> invDval(
nbAxes_);
209 for (
size_t i = 0; i < invDval.size(); i++)
217 vector<double> tmpColWeights(colNb);
218 for (
unsigned int i = 0; i <
colWeights_.size(); i++)
251 vector<double> tmpRowWeights(rowNb);
252 for (
unsigned int i = 0; i <
rowWeights_.size(); i++)
std::vector< double > colWeights_
RowMatrix< double > ppalComponents_
std::vector< double > eigenValues_
virtual ~DualityDiagram()
RowMatrix< double > ppalAxes_
void setData(const Matrix< double > &matrix, const std::vector< double > &rowWeights, const std::vector< double > &colWeights, unsigned int nbAxes, double tol=0.0000001, bool verbose=true)
Set the data and perform computations.
void compute_(const Matrix< double > &matrix, double tol, bool verbose)
void check_(const Matrix< double > &matrix, const std::vector< double > &rowWeights, const std::vector< double > &colWeights, unsigned int nbAxes)
RowMatrix< double > eigenVectors_
std::vector< double > rowWeights_
RowMatrix< double > colCoord_
RowMatrix< double > rowCoord_
DualityDiagram()
Build an empty DualityDiagram object.
Computes eigenvalues and eigenvectors of a real (non-complex) matrix.
const RowMatrix< Real > & getV() const
Return the eigenvector matrix.
const std::vector< Real > & getRealEigenValues() const
Return the real parts of the eigenvalues.
Exception base class. Overload exception constructor (to control the exceptions mechanism)....
The matrix template interface.
virtual size_t getNumberOfColumns() const =0
virtual size_t getNumberOfRows() const =0
size_t getNumberOfRows() const
size_t getNumberOfColumns() const
void resize(size_t nRows, size_t nCols)
Resize the matrix.