-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add DistanceMatrix type and conversion from/to Phylip matrix
- Loading branch information
1 parent
d78b8ca
commit 7a60d8b
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//! A distance matrix is stored as a list of taxon names, together with a square | ||
//! or triangular matrix representing all pairwise distances. | ||
|
||
/// The type of the matrix. Either square, lower triangular (excluding the | ||
/// diagonal), or upper triangular (excluding the diagonal). | ||
/// Square matrices are assumed to be symmetric, but this is not enforced nor checked. | ||
#[derive(Debug, PartialEq, Eq)] | ||
pub enum MatrixType { | ||
Square, | ||
Lower, | ||
Upper, | ||
} | ||
|
||
/// A distance matrix containing a list of taxon names and a matrix of pairwise distances. | ||
#[derive(Debug)] | ||
pub struct DistanceMatrix { | ||
names: Vec<String>, | ||
distances: Vec<Vec<f32>>, | ||
matrix_type: MatrixType, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters