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