Expand description
Data types and file formats for distance matrix data.
Distance matrix data types:
DistMatrixstores only the lower diagonal so works for symmetric distance measures. It is more memory efficient and is compatible with R’sdistobjects.SquareMatrixstores the full matrix and is more efficient to access.
Both matrix types have their data stored in a single Vec<D>, and are generic
over D. They provide various iterators and accessors to retrieve elements.
They can optionally store labels (e.g. taxon labels from bioinformatic distance matrix formats).
There are different ways to load your data into matrix types:
- using a pairwise distance measure:
from_pw_distancesorfrom_pw_distances_with, - from an iterator over pairs of labels and distances with
from_labelled_distances, - from a vector stored in the correct order with
collect, - from a file (see
formats): tabular (e.g.snp-dists) or PHYLIP, let square: SquareMatrix<D> = dist.into();wheredist: DistMatrix<D>,let dist: DistMatrix<D> = square.lower_triangle();wheresquare: SquareMatrix<D>.
Re-exports§
pub use square::SquareMatrix;pub use symmetric::DistMatrix;
Modules§
- formats
- Read distance matrix data to different file formats.
- square
- An arbitrary square matrix.
- symmetric
- A symmetric matrix stored as the lower triangle.
Enums§
- Data
Error - Error encountered when attempting to build a matrix from labelled distances.
Traits§
- AbsDiff
- Implemented for types with an obvious default meaning of absolute distance between points.