bpp-seq3  3.0.0
bpp::SimpleIndexDistance Class Reference

Simple dissimilarity distance. More...

#include <Bpp/Seq/AlphabetIndex/SimpleIndexDistance.h>

+ Inheritance diagram for bpp::SimpleIndexDistance:
+ Collaboration diagram for bpp::SimpleIndexDistance:

Public Member Functions

 SimpleIndexDistance (std::shared_ptr< AlphabetIndex1 > index)
 
 SimpleIndexDistance (const SimpleIndexDistance &sid)
 
SimpleIndexDistanceoperator= (const SimpleIndexDistance &sid)
 
virtual ~SimpleIndexDistance ()
 
double getIndex (int state1, int state2) const override
 Get the index associated to a pair of states. More...
 
double getIndex (const std::string &state1, const std::string &state2) const override
 Get the index associated to a pair of states. More...
 
std::shared_ptr< const AlphabetgetAlphabet () const override
 Get the alphabet associated to this index. More...
 
const Alphabetalphabet () const override
 Get the alphabet associated to this index. More...
 
SimpleIndexDistanceclone () const override
 
const Matrix< double > & getIndexMatrix () const override
 
void setSymmetric (bool yn)
 
bool isSymmetric () const override
 
std::shared_ptr< const AlphabetIndex1getAlphabetIndex1 () const
 

Protected Member Functions

void computeIndexMatrix_ ()
 

Private Attributes

std::shared_ptr< AlphabetIndex1index_
 
size_t size_
 
RowMatrix< double > indexMatrix_
 
bool sym_
 

Detailed Description

Simple dissimilarity distance.

Take a one-dimensional index and return the difference between the indexes of two states.

Definition at line 27 of file SimpleIndexDistance.h.

Constructor & Destructor Documentation

◆ SimpleIndexDistance() [1/2]

bpp::SimpleIndexDistance::SimpleIndexDistance ( std::shared_ptr< AlphabetIndex1 index)
inline

Definition at line 37 of file SimpleIndexDistance.h.

References computeIndexMatrix_().

Referenced by clone().

◆ SimpleIndexDistance() [2/2]

bpp::SimpleIndexDistance::SimpleIndexDistance ( const SimpleIndexDistance sid)
inline

Definition at line 46 of file SimpleIndexDistance.h.

◆ ~SimpleIndexDistance()

virtual bpp::SimpleIndexDistance::~SimpleIndexDistance ( )
inlinevirtual

Definition at line 62 of file SimpleIndexDistance.h.

Member Function Documentation

◆ alphabet()

const Alphabet& bpp::SimpleIndexDistance::alphabet ( ) const
inlineoverridevirtual

Get the alphabet associated to this index.

Returns
Alphabet The alphabet associated to this index.

Implements bpp::AlphabetIndex2.

Definition at line 77 of file SimpleIndexDistance.h.

References index_.

◆ clone()

SimpleIndexDistance* bpp::SimpleIndexDistance::clone ( ) const
inlineoverridevirtual

Implements bpp::AlphabetIndex2.

Definition at line 79 of file SimpleIndexDistance.h.

References SimpleIndexDistance().

◆ computeIndexMatrix_()

void bpp::SimpleIndexDistance::computeIndexMatrix_ ( )
inlineprotected

Definition at line 84 of file SimpleIndexDistance.h.

References getAlphabet(), index_, indexMatrix_, size_, and sym_.

Referenced by setSymmetric(), and SimpleIndexDistance().

◆ getAlphabet()

std::shared_ptr<const Alphabet> bpp::SimpleIndexDistance::getAlphabet ( ) const
inlineoverridevirtual

Get the alphabet associated to this index.

Returns
Alphabet The alphabet associated to this index.

Implements bpp::AlphabetIndex2.

Definition at line 75 of file SimpleIndexDistance.h.

References index_.

Referenced by computeIndexMatrix_(), and getIndex().

◆ getAlphabetIndex1()

std::shared_ptr<const AlphabetIndex1> bpp::SimpleIndexDistance::getAlphabetIndex1 ( ) const
inline
Returns
The AlphabetIndex1 object associated to this object.

Definition at line 109 of file SimpleIndexDistance.h.

References index_.

◆ getIndex() [1/2]

double bpp::SimpleIndexDistance::getIndex ( const std::string &  state1,
const std::string &  state2 
) const
inlineoverridevirtual

Get the index associated to a pair of states.

Parameters
state1First state to consider, as a string value.
state2Second state to consider, as a string value.
Returns
The index associated to the pair of states.

Implements bpp::AlphabetIndex2.

Definition at line 70 of file SimpleIndexDistance.h.

References getAlphabet(), and indexMatrix_.

◆ getIndex() [2/2]

double bpp::SimpleIndexDistance::getIndex ( int  state1,
int  state2 
) const
inlineoverridevirtual

Get the index associated to a pair of states.

Parameters
state1First state to consider, as a int value in the Alphabet
state2Second state to consider, as a int value in the Alphabet
Returns
The index associated to the pair of states.

Implements bpp::AlphabetIndex2.

Definition at line 65 of file SimpleIndexDistance.h.

References getAlphabet(), and indexMatrix_.

◆ getIndexMatrix()

const Matrix<double>& bpp::SimpleIndexDistance::getIndexMatrix ( ) const
inlineoverridevirtual
Returns
A matrix object with all indices.

Implements bpp::AlphabetIndex2.

Definition at line 81 of file SimpleIndexDistance.h.

References indexMatrix_.

◆ isSymmetric()

bool bpp::SimpleIndexDistance::isSymmetric ( ) const
inlineoverridevirtual
Returns
True if the index is symetric (that is, index(i,j) == index(j, i)).

Implements bpp::AlphabetIndex2.

Definition at line 104 of file SimpleIndexDistance.h.

References sym_.

◆ operator=()

SimpleIndexDistance& bpp::SimpleIndexDistance::operator= ( const SimpleIndexDistance sid)
inline

Definition at line 53 of file SimpleIndexDistance.h.

References index_, indexMatrix_, size_, and sym_.

◆ setSymmetric()

void bpp::SimpleIndexDistance::setSymmetric ( bool  yn)
inline

Definition at line 98 of file SimpleIndexDistance.h.

References computeIndexMatrix_(), and sym_.

Member Data Documentation

◆ index_

std::shared_ptr<AlphabetIndex1> bpp::SimpleIndexDistance::index_
private

◆ indexMatrix_

RowMatrix<double> bpp::SimpleIndexDistance::indexMatrix_
private

Definition at line 33 of file SimpleIndexDistance.h.

Referenced by computeIndexMatrix_(), getIndex(), getIndexMatrix(), and operator=().

◆ size_

size_t bpp::SimpleIndexDistance::size_
private

Definition at line 32 of file SimpleIndexDistance.h.

Referenced by computeIndexMatrix_(), and operator=().

◆ sym_

bool bpp::SimpleIndexDistance::sym_
private

Definition at line 34 of file SimpleIndexDistance.h.

Referenced by computeIndexMatrix_(), isSymmetric(), operator=(), and setSymmetric().


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