A Matrix class to store phylogenetic distances.
More...
#include <Bpp/Seq/DistanceMatrix.h>
A Matrix class to store phylogenetic distances.
Definition at line 55 of file DistanceMatrix.h.
◆ DistanceMatrix() [1/3]
bpp::DistanceMatrix::DistanceMatrix |
( |
const std::vector< std::string > & |
names | ) |
|
|
inline |
Build a new distance matrix with specified names.
The dimension of the matrix will be equal to the number of names
- Parameters
-
Definition at line 72 of file DistanceMatrix.h.
References reset().
Referenced by clone().
◆ DistanceMatrix() [2/3]
bpp::DistanceMatrix::DistanceMatrix |
( |
size_t |
n | ) |
|
|
inline |
Build a new distance matrix with specified size.
Row names will be named 'Taxon 0', 'Taxon 1', and so on.
- Parameters
-
Definition at line 86 of file DistanceMatrix.h.
References resize().
◆ ~DistanceMatrix()
virtual bpp::DistanceMatrix::~DistanceMatrix |
( |
| ) |
|
|
inlinevirtual |
◆ DistanceMatrix() [3/3]
◆ asMatrix() [1/2]
virtual const Matrix<double>& bpp::DistanceMatrix::asMatrix |
( |
| ) |
const |
|
inlinevirtual |
◆ asMatrix() [2/2]
virtual Matrix<double>& bpp::DistanceMatrix::asMatrix |
( |
| ) |
|
|
inlinevirtual |
◆ clone()
◆ getName()
const std::string& bpp::DistanceMatrix::getName |
( |
size_t |
i | ) |
const |
throw | ( | IndexOutOfBoundsException |
| ) | | |
|
inline |
- Returns
- The ith name.
- Parameters
-
- Exceptions
-
IndexOutOfBoundsException | If i is not a valid index. |
Definition at line 147 of file DistanceMatrix.h.
References names_, and size().
◆ getNameIndex()
size_t DistanceMatrix::getNameIndex |
( |
const std::string & |
name | ) |
const |
throw | ( | Exception |
| ) | | |
Get the index of a given name.
- Parameters
-
name | The name to look for. |
- Returns
- The position of the name.
- Exceptions
-
Exception | If no names are attached to this matrix, or if the name was not found. |
Definition at line 45 of file DistanceMatrix.cpp.
Referenced by operator()().
◆ getNames()
const std::vector<std::string>& bpp::DistanceMatrix::getNames |
( |
| ) |
const |
|
inline |
◆ operator()() [1/4]
virtual const double& bpp::DistanceMatrix::operator() |
( |
const std::string & |
iName, |
|
|
const std::string & |
jName |
|
) |
| const |
throw | ( | Exception |
| ) | | |
|
inlinevirtual |
Access by name.
- Parameters
-
iName | Name 1 (row) |
jName | Name 2 (column) |
- Returns
- A reference toward the specified distance.
- Exceptions
-
Exception | if the matrix has no name of if one of the name do not match existing names. |
Definition at line 209 of file DistanceMatrix.h.
References distances_, and getNameIndex().
◆ operator()() [2/4]
virtual double& bpp::DistanceMatrix::operator() |
( |
const std::string & |
iName, |
|
|
const std::string & |
jName |
|
) |
| |
throw | ( | Exception |
| ) | | |
|
inlinevirtual |
Access by name.
- Parameters
-
iName | Name 1 (row) |
jName | Name 2 (column) |
- Returns
- A reference toward the specified distance.
- Exceptions
-
Exception | if the matrix has no name of if one of the name do not match existing names. |
Definition at line 225 of file DistanceMatrix.h.
References distances_, and getNameIndex().
◆ operator()() [3/4]
virtual const double& bpp::DistanceMatrix::operator() |
( |
size_t |
i, |
|
|
size_t |
j |
|
) |
| const |
|
inlinevirtual |
◆ operator()() [4/4]
virtual double& bpp::DistanceMatrix::operator() |
( |
size_t |
i, |
|
|
size_t |
j |
|
) |
| |
|
inlinevirtual |
◆ operator=()
◆ reset()
void bpp::DistanceMatrix::reset |
( |
| ) |
|
|
inline |
◆ resize()
void bpp::DistanceMatrix::resize |
( |
size_t |
n | ) |
|
|
inline |
◆ setName()
void bpp::DistanceMatrix::setName |
( |
size_t |
i, |
|
|
const std::string & |
name |
|
) |
| |
throw | ( | IndexOutOfBoundsException |
| ) | | |
|
inline |
Set the ith name.
- Parameters
-
i | Name index. |
name | The new name. |
- Exceptions
-
IndexOutOfBoundsException | If i is not a valid index. |
Definition at line 160 of file DistanceMatrix.h.
References names_, and size().
◆ setNames()
void bpp::DistanceMatrix::setNames |
( |
const std::vector< std::string > & |
names | ) |
|
throw | ( | DimensionException |
| ) | | |
|
inline |
Set the names associated to the matrix.
- Parameters
-
- Exceptions
-
DimensionException | If 'names' have not the same size as the matrix. |
Definition at line 172 of file DistanceMatrix.h.
References names_.
◆ size()
size_t bpp::DistanceMatrix::size |
( |
| ) |
const |
|
inline |
◆ distances_
RowMatrix<double> bpp::DistanceMatrix::distances_ |
|
private |
◆ names_
std::vector<std::string> bpp::DistanceMatrix::names_ |
|
private |
The documentation for this class was generated from the following files: