bpp-core3  3.0.0
DualityDiagram.h
Go to the documentation of this file.
1 //
2 // File: DualityDiagram.h
3 // Authors:
4 // Mathieu Groussin
5 // Created: 2011-02-27 22:03:00
6 //
7 
8 /*
9  Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
10 
11  This software is a computer program whose purpose is to provide basal and
12  utilitary classes. This file belongs to the Bio++ Project.
13 
14  This software is governed by the CeCILL license under French law and
15  abiding by the rules of distribution of free software. You can use,
16  modify and/ or redistribute the software under the terms of the CeCILL
17  license as circulated by CEA, CNRS and INRIA at the following URL
18  "http://www.cecill.info".
19 
20  As a counterpart to the access to the source code and rights to copy,
21  modify and redistribute granted by the license, users are provided only
22  with a limited warranty and the software's author, the holder of the
23  economic rights, and the successive licensors have only limited
24  liability.
25 
26  In this respect, the user's attention is drawn to the risks associated
27  with loading, using, modifying and/or developing or reproducing the
28  software by the user in light of its specific status of free software,
29  that may mean that it is complicated to manipulate, and that also
30  therefore means that it is reserved for developers and experienced
31  professionals having in-depth computer knowledge. Users are therefore
32  encouraged to load and test the software's suitability as regards their
33  requirements in conditions enabling the security of their systems and/or
34  data to be ensured and, more generally, to use and operate it in the
35  same conditions as regards security.
36 
37  The fact that you are presently reading this means that you have had
38  knowledge of the CeCILL license and that you accept its terms.
39 */
40 
41 #ifndef BPP_NUMERIC_STAT_MVA_DUALITYDIAGRAM_H
42 #define BPP_NUMERIC_STAT_MVA_DUALITYDIAGRAM_H
43 
44 
45 #include "../../Matrix/Matrix.h"
46 
47 namespace bpp
48 {
59  public virtual Clonable
60 {
61 private:
62  std::vector<double> rowWeights_;
63  std::vector<double> colWeights_;
64  size_t nbAxes_;
65  std::vector<double> eigenValues_;
71 
72 public:
78  rowWeights_(),
79  colWeights_(),
80  nbAxes_(),
81  eigenValues_(),
82  eigenVectors_(),
83  rowCoord_(),
84  colCoord_(),
85  ppalAxes_(),
86  ppalComponents_() {}
87 
100  const Matrix<double>& matrix,
101  const std::vector<double>& rowWeights,
102  const std::vector<double>& colWeights,
103  unsigned int nbAxes,
104  double tol = 0.0000001,
105  bool verbose = true);
106 
107  virtual ~DualityDiagram();
108 
109  DualityDiagram* clone() const { return new DualityDiagram(*this); }
110 
111 private:
112  void check_(
113  const Matrix<double>& matrix,
114  const std::vector<double>& rowWeights,
115  const std::vector<double>& colWeights,
116  unsigned int nbAxes);
117  void compute_(const Matrix<double>& matrix, double tol, bool verbose);
118 
119 public:
131  void setData(
132  const Matrix<double>& matrix,
133  const std::vector<double>& rowWeights,
134  const std::vector<double>& colWeights,
135  unsigned int nbAxes,
136  double tol = 0.0000001,
137  bool verbose = true);
138 
139  std::vector<double> computeVariancePercentagePerAxis();
140 
141  size_t getNbOfKeptAxes() const { return nbAxes_; }
142  const std::vector<double> getRowWeights() const { return rowWeights_; }
143  const std::vector<double> getColumnWeights() const { return colWeights_; }
144  const std::vector<double>& getEigenValues() const { return eigenValues_; }
145  const RowMatrix<double>& getRowCoordinates() const { return rowCoord_; }
146  const RowMatrix<double>& getColCoordinates() const { return colCoord_; }
147  const RowMatrix<double>& getPrincipalAxes() const { return ppalAxes_; }
149 };
150 } // end of namespace bpp.
151 #endif // BPP_NUMERIC_STAT_MVA_DUALITYDIAGRAM_H
The Clonable interface (allow an object to be cloned).
Definition: Clonable.h:103
The core class of a multivariate analysis.
const RowMatrix< double > & getPrincipalAxes() const
std::vector< double > colWeights_
RowMatrix< double > ppalComponents_
const RowMatrix< double > & getPrincipalComponents() const
std::vector< double > eigenValues_
const std::vector< double > & getEigenValues() const
RowMatrix< double > ppalAxes_
DualityDiagram * clone() const
Create a copy of this object and send a pointer to it.
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_
const RowMatrix< double > & getColCoordinates() const
std::vector< double > rowWeights_
std::vector< double > computeVariancePercentagePerAxis()
const RowMatrix< double > & getRowCoordinates() const
const std::vector< double > getColumnWeights() const
size_t getNbOfKeptAxes() const
const std::vector< double > getRowWeights() const
RowMatrix< double > colCoord_
RowMatrix< double > rowCoord_
DualityDiagram()
Build an empty DualityDiagram object.
The matrix template interface.
Definition: Matrix.h:61