bpp-core3  3.0.0
bpp::DualityDiagram Class Reference

The core class of a multivariate analysis. More...

#include <Bpp/Numeric/Stat/Mva/DualityDiagram.h>

+ Inheritance diagram for bpp::DualityDiagram:
+ Collaboration diagram for bpp::DualityDiagram:

Public Member Functions

 DualityDiagram ()
 Build an empty DualityDiagram object. More...
 
 DualityDiagram (const Matrix< double > &matrix, const std::vector< double > &rowWeights, const std::vector< double > &colWeights, unsigned int nbAxes, double tol=0.0000001, bool verbose=true)
 Build a new DualityDiagram object. More...
 
virtual ~DualityDiagram ()
 
DualityDiagramclone () const
 Create a copy of this object and send a pointer to it. More...
 
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. More...
 
std::vector< double > computeVariancePercentagePerAxis ()
 
size_t getNbOfKeptAxes () const
 
const std::vector< double > getRowWeights () const
 
const std::vector< double > getColumnWeights () const
 
const std::vector< double > & getEigenValues () const
 
const RowMatrix< double > & getRowCoordinates () const
 
const RowMatrix< double > & getColCoordinates () const
 
const RowMatrix< double > & getPrincipalAxes () const
 
const RowMatrix< double > & getPrincipalComponents () const
 

Private Member Functions

void check_ (const Matrix< double > &matrix, const std::vector< double > &rowWeights, const std::vector< double > &colWeights, unsigned int nbAxes)
 
void compute_ (const Matrix< double > &matrix, double tol, bool verbose)
 

Private Attributes

std::vector< double > rowWeights_
 
std::vector< double > colWeights_
 
size_t nbAxes_
 
std::vector< double > eigenValues_
 
RowMatrix< double > eigenVectors_
 
RowMatrix< double > rowCoord_
 
RowMatrix< double > colCoord_
 
RowMatrix< double > ppalAxes_
 
RowMatrix< double > ppalComponents_
 

Detailed Description

The core class of a multivariate analysis.

In the constructor, the eigen values and vectors of the variance-covariance or correlation matrix are calculated. Eigen values and vectors are stored in the eigenValues_ and eigenVectors_ respectively. Furthermore, four matrices are calculated: the row and column coordinates as well as the principal axes and components.

The code of this class is deeply inspired from the R code of the as.dudi function available in the ade4 package.

Definition at line 22 of file DualityDiagram.h.

Constructor & Destructor Documentation

◆ DualityDiagram() [1/2]

bpp::DualityDiagram::DualityDiagram ( )
inline

Build an empty DualityDiagram object.

Definition at line 41 of file DualityDiagram.h.

References ~DualityDiagram().

Referenced by clone().

◆ DualityDiagram() [2/2]

DualityDiagram::DualityDiagram ( const Matrix< double > &  matrix,
const std::vector< double > &  rowWeights,
const std::vector< double > &  colWeights,
unsigned int  nbAxes,
double  tol = 0.0000001,
bool  verbose = true 
)

Build a new DualityDiagram object.

Parameters
matrixThe input data to analyse.
rowWeightsA vector of values specifying the weights of rows.
colWeightsA vector of values specifying the weights of columns.
nbAxesThe number of kept axes during the analysis.
tolTolerance threshold for null eigenvalues (a value less than tol times the first one is considered as null)
verboseShould warnings be dispayed.
Exceptions
Exceptionif an error occured.

Definition at line 16 of file DualityDiagram.cpp.

References check_(), and compute_().

◆ ~DualityDiagram()

DualityDiagram::~DualityDiagram ( )
virtual

Definition at line 254 of file DualityDiagram.cpp.

Referenced by DualityDiagram().

Member Function Documentation

◆ check_()

void DualityDiagram::check_ ( const Matrix< double > &  matrix,
const std::vector< double > &  rowWeights,
const std::vector< double > &  colWeights,
unsigned int  nbAxes 
)
private

◆ clone()

DualityDiagram* bpp::DualityDiagram::clone ( ) const
inlinevirtual

Create a copy of this object and send a pointer to it.

Returns
A pointer toward the copy object.

Implements bpp::Clonable.

Reimplemented in bpp::PrincipalComponentAnalysis.

Definition at line 73 of file DualityDiagram.h.

References check_(), compute_(), computeVariancePercentagePerAxis(), DualityDiagram(), and setData().

◆ compute_()

◆ computeVariancePercentagePerAxis()

std::vector<double> bpp::DualityDiagram::computeVariancePercentagePerAxis ( )

Referenced by clone().

◆ getColCoordinates()

const RowMatrix<double>& bpp::DualityDiagram::getColCoordinates ( ) const
inline

Definition at line 110 of file DualityDiagram.h.

References colCoord_.

◆ getColumnWeights()

const std::vector<double> bpp::DualityDiagram::getColumnWeights ( ) const
inline

Definition at line 107 of file DualityDiagram.h.

References colWeights_.

◆ getEigenValues()

const std::vector<double>& bpp::DualityDiagram::getEigenValues ( ) const
inline

Definition at line 108 of file DualityDiagram.h.

References eigenValues_.

◆ getNbOfKeptAxes()

size_t bpp::DualityDiagram::getNbOfKeptAxes ( ) const
inline

Definition at line 105 of file DualityDiagram.h.

References nbAxes_.

◆ getPrincipalAxes()

const RowMatrix<double>& bpp::DualityDiagram::getPrincipalAxes ( ) const
inline

Definition at line 111 of file DualityDiagram.h.

References ppalAxes_.

◆ getPrincipalComponents()

const RowMatrix<double>& bpp::DualityDiagram::getPrincipalComponents ( ) const
inline

Definition at line 112 of file DualityDiagram.h.

References ppalComponents_.

◆ getRowCoordinates()

const RowMatrix<double>& bpp::DualityDiagram::getRowCoordinates ( ) const
inline

Definition at line 109 of file DualityDiagram.h.

References rowCoord_.

◆ getRowWeights()

const std::vector<double> bpp::DualityDiagram::getRowWeights ( ) const
inline

Definition at line 106 of file DualityDiagram.h.

References rowWeights_.

◆ setData()

void DualityDiagram::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.

Parameters
matrixThe input data to analyse.
rowWeightsA vector of values specifying the weights of rows.
colWeightsA vector of values specifying the weights of columns.
nbAxesThe number of kept axes during the analysis.
tolTolerance threshold for null eigenvalues (a value less than tol times the first one is considered as null)
verboseShould warnings be dispayed.
Exceptions
Exceptionif an error occured.

Definition at line 66 of file DualityDiagram.cpp.

References check_(), colWeights_, compute_(), nbAxes_, and rowWeights_.

Referenced by clone(), bpp::CorrespondenceAnalysis::CorrespondenceAnalysis(), and bpp::PrincipalComponentAnalysis::PrincipalComponentAnalysis().

Member Data Documentation

◆ colCoord_

RowMatrix<double> bpp::DualityDiagram::colCoord_
private

Definition at line 32 of file DualityDiagram.h.

Referenced by compute_(), and getColCoordinates().

◆ colWeights_

std::vector<double> bpp::DualityDiagram::colWeights_
private

Definition at line 27 of file DualityDiagram.h.

Referenced by compute_(), getColumnWeights(), and setData().

◆ eigenValues_

std::vector<double> bpp::DualityDiagram::eigenValues_
private

Definition at line 29 of file DualityDiagram.h.

Referenced by compute_(), and getEigenValues().

◆ eigenVectors_

RowMatrix<double> bpp::DualityDiagram::eigenVectors_
private

Definition at line 30 of file DualityDiagram.h.

Referenced by compute_().

◆ nbAxes_

size_t bpp::DualityDiagram::nbAxes_
private

Definition at line 28 of file DualityDiagram.h.

Referenced by compute_(), getNbOfKeptAxes(), and setData().

◆ ppalAxes_

RowMatrix<double> bpp::DualityDiagram::ppalAxes_
private

Definition at line 33 of file DualityDiagram.h.

Referenced by compute_(), and getPrincipalAxes().

◆ ppalComponents_

RowMatrix<double> bpp::DualityDiagram::ppalComponents_
private

Definition at line 34 of file DualityDiagram.h.

Referenced by compute_(), and getPrincipalComponents().

◆ rowCoord_

RowMatrix<double> bpp::DualityDiagram::rowCoord_
private

Definition at line 31 of file DualityDiagram.h.

Referenced by compute_(), and getRowCoordinates().

◆ rowWeights_

std::vector<double> bpp::DualityDiagram::rowWeights_
private

Definition at line 26 of file DualityDiagram.h.

Referenced by compute_(), getRowWeights(), and setData().


The documentation for this class was generated from the following files: