bpp-core3  3.0.0
DualityDiagram.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #ifndef BPP_NUMERIC_STAT_MVA_DUALITYDIAGRAM_H
6 #define BPP_NUMERIC_STAT_MVA_DUALITYDIAGRAM_H
7 
8 
9 #include "../../Matrix/Matrix.h"
10 
11 namespace bpp
12 {
23  public virtual Clonable
24 {
25 private:
26  std::vector<double> rowWeights_;
27  std::vector<double> colWeights_;
28  size_t nbAxes_;
29  std::vector<double> eigenValues_;
35 
36 public:
42  rowWeights_(),
43  colWeights_(),
44  nbAxes_(),
45  eigenValues_(),
46  eigenVectors_(),
47  rowCoord_(),
48  colCoord_(),
49  ppalAxes_(),
50  ppalComponents_() {}
51 
64  const Matrix<double>& matrix,
65  const std::vector<double>& rowWeights,
66  const std::vector<double>& colWeights,
67  unsigned int nbAxes,
68  double tol = 0.0000001,
69  bool verbose = true);
70 
71  virtual ~DualityDiagram();
72 
73  DualityDiagram* clone() const { return new DualityDiagram(*this); }
74 
75 private:
76  void check_(
77  const Matrix<double>& matrix,
78  const std::vector<double>& rowWeights,
79  const std::vector<double>& colWeights,
80  unsigned int nbAxes);
81  void compute_(const Matrix<double>& matrix, double tol, bool verbose);
82 
83 public:
95  void setData(
96  const Matrix<double>& matrix,
97  const std::vector<double>& rowWeights,
98  const std::vector<double>& colWeights,
99  unsigned int nbAxes,
100  double tol = 0.0000001,
101  bool verbose = true);
102 
103  std::vector<double> computeVariancePercentagePerAxis();
104 
105  size_t getNbOfKeptAxes() const { return nbAxes_; }
106  const std::vector<double> getRowWeights() const { return rowWeights_; }
107  const std::vector<double> getColumnWeights() const { return colWeights_; }
108  const std::vector<double>& getEigenValues() const { return eigenValues_; }
109  const RowMatrix<double>& getRowCoordinates() const { return rowCoord_; }
110  const RowMatrix<double>& getColCoordinates() const { return colCoord_; }
111  const RowMatrix<double>& getPrincipalAxes() const { return ppalAxes_; }
113 };
114 } // end of namespace bpp.
115 #endif // BPP_NUMERIC_STAT_MVA_DUALITYDIAGRAM_H
The matrix template interface.
Definition: Matrix.h:22
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.
RowMatrix< double > eigenVectors_
const RowMatrix< double > & getColCoordinates() const
RowMatrix< double > colCoord_
std::vector< double > colWeights_
RowMatrix< double > rowCoord_
const RowMatrix< double > & getRowCoordinates() const
RowMatrix< double > ppalAxes_
std::vector< double > computeVariancePercentagePerAxis()
std::vector< double > eigenValues_
const std::vector< double > getColumnWeights() const
void check_(const Matrix< double > &matrix, const std::vector< double > &rowWeights, const std::vector< double > &colWeights, unsigned int nbAxes)
const std::vector< double > & getEigenValues() const
const std::vector< double > getRowWeights() const
std::vector< double > rowWeights_
The Clonable interface (allow an object to be cloned).
Definition: Clonable.h:63
size_t getNbOfKeptAxes() const
RowMatrix< double > ppalComponents_
const RowMatrix< double > & getPrincipalComponents() const
DualityDiagram()
Build an empty DualityDiagram object.
void compute_(const Matrix< double > &matrix, double tol, bool verbose)
const RowMatrix< double > & getPrincipalAxes() const
The core class of a multivariate analysis.
DualityDiagram * clone() const
Create a copy of this object and send a pointer to it.