bpp-seq3
3.0.0
|
A Matrix class to store phylogenetic distances. More...
#include <Bpp/Seq/DistanceMatrix.h>
Public Member Functions | |
DistanceMatrix (const std::vector< std::string > &names) | |
Build a new distance matrix with specified names. The dimension of the matrix will be equal to the number of names. More... | |
DistanceMatrix (std::size_t n) | |
Build a new distance matrix with specified size. Row names will be named 'Taxon 0', 'Taxon 1', and so on. More... | |
DistanceMatrix (const DistanceMatrix &dist) | |
DistanceMatrix & | operator= (const DistanceMatrix &dist) |
DistanceMatrix * | clone () const |
void | reset () |
Reset the distance matrix: all distances are set to 0. More... | |
std::size_t | size () const |
const std::vector< std::string > & | getNames () const |
const std::string & | getName (std::size_t i) const |
void | setName (std::size_t i, const std::string &name) |
Set the ith name. More... | |
void | setNames (const std::vector< std::string > &names) |
Set the names associated to the matrix. More... | |
std::size_t | getNameIndex (const std::string &name) const |
Get the index of a given name. More... | |
void | resize (std::size_t n) |
Change the dimension of the matrix. More... | |
virtual const double & | operator() (const std::string &iName, const std::string &jName) const |
Access by name. More... | |
virtual double & | operator() (const std::string &iName, const std::string &jName) |
Access by name. More... | |
virtual const double & | operator() (std::size_t i, std::size_t j) const |
virtual double & | operator() (std::size_t i, std::size_t j) |
virtual const Matrix< double > & | asMatrix () const |
virtual Matrix< double > & | asMatrix () |
Private Attributes | |
RowMatrix< double > | distances_ |
std::vector< std::string > | names_ |
A Matrix class to store phylogenetic distances.
Definition at line 18 of file DistanceMatrix.h.
|
inline |
Build a new distance matrix with specified names. The dimension of the matrix will be equal to the number of names.
names | The names to use. |
Definition at line 30 of file DistanceMatrix.h.
References reset().
Referenced by clone().
|
inline |
Build a new distance matrix with specified size. Row names will be named 'Taxon 0', 'Taxon 1', and so on.
n | The size of the matrix. |
Definition at line 42 of file DistanceMatrix.h.
References resize().
|
inline |
Definition at line 49 of file DistanceMatrix.h.
|
inlinevirtual |
Definition at line 207 of file DistanceMatrix.h.
References distances_.
|
inlinevirtual |
Definition at line 205 of file DistanceMatrix.h.
References distances_.
|
inlinevirtual |
Implements bpp::Clonable.
Definition at line 69 of file DistanceMatrix.h.
References DistanceMatrix().
|
inline |
i | Name index. |
IndexOutOfBoundsException | If i is not a valid index. |
Definition at line 102 of file DistanceMatrix.h.
References names_, and size().
Referenced by bpp::PhylipDistanceMatrixFormat::writeDistanceMatrix().
size_t DistanceMatrix::getNameIndex | ( | const std::string & | name | ) | const |
Get the index of a given name.
name | The name to look for. |
Exception | If no names are attached to this matrix, or if the name was not found. |
Definition at line 11 of file DistanceMatrix.cpp.
Referenced by operator()().
|
inline |
Definition at line 95 of file DistanceMatrix.h.
References names_.
|
inlinevirtual |
Access by name.
iName | Name 1 (row) |
jName | Name 2 (column) |
Exception | if the matrix has no name of if one of the name do not match existing names. |
Definition at line 186 of file DistanceMatrix.h.
References distances_, and getNameIndex().
|
inlinevirtual |
Access by name.
iName | Name 1 (row) |
jName | Name 2 (column) |
Exception | if the matrix has no name of if one of the name do not match existing names. |
Definition at line 170 of file DistanceMatrix.h.
References distances_, and getNameIndex().
|
inlinevirtual |
Definition at line 199 of file DistanceMatrix.h.
References distances_.
|
inlinevirtual |
Definition at line 194 of file DistanceMatrix.h.
References distances_.
|
inline |
Definition at line 54 of file DistanceMatrix.h.
References distances_, names_, resize(), and size().
|
inline |
Reset the distance matrix: all distances are set to 0.
Definition at line 75 of file DistanceMatrix.h.
References distances_, and size().
Referenced by DistanceMatrix(), and resize().
|
inline |
Change the dimension of the matrix.
n | the new dimension of the matrix. |
Definition at line 150 of file DistanceMatrix.h.
References distances_, names_, reset(), and RowMatrix< double >::resize().
Referenced by DistanceMatrix(), and operator=().
|
inline |
Set the ith name.
i | Name index. |
name | The new name. |
IndexOutOfBoundsException | If i is not a valid index. |
Definition at line 116 of file DistanceMatrix.h.
|
inline |
Set the names associated to the matrix.
names | Matrix names. |
DimensionException | If 'names' have not the same size as the matrix. |
Definition at line 129 of file DistanceMatrix.h.
References names_.
|
inline |
Definition at line 90 of file DistanceMatrix.h.
References names_.
Referenced by getName(), operator=(), reset(), setName(), and bpp::PhylipDistanceMatrixFormat::writeDistanceMatrix().
|
private |
Definition at line 21 of file DistanceMatrix.h.
Referenced by asMatrix(), operator()(), operator=(), reset(), and resize().
|
private |
Definition at line 22 of file DistanceMatrix.h.
Referenced by getName(), getNames(), operator=(), resize(), setName(), setNames(), and size().