Copyright | (c) Dominik Schrempf 2020 |
---|---|
License | GPL-3.0-or-later |
Maintainer | dominik.schrempf@gmail.com |
Stability | unstable |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Creation date: Thu Jan 17 14:16:34 2019.
Non-negativity of lengths is not completely ensured. See the documentation of
Length
.
Synopsis
- data Length
- toLength :: Double -> Either String Length
- toLengthUnsafe :: Double -> Length
- class HasLength e where
- height :: HasLength e => Tree e a -> Length
- rootHeight :: HasLength e => Tree e a -> Length
- distancesOriginLeaves :: HasLength e => Tree e a -> [Length]
- totalBranchLength :: HasLength e => Tree e a -> Length
- normalizeBranchLengths :: HasLength e => Tree e a -> Tree e a
- normalizeHeight :: HasLength e => Tree e a -> Tree e a
- ultrametric :: HasLength e => Tree e a -> Bool
- makeUltrametric :: HasLength e => Tree e a -> Tree e a
Non-negative length
Non-negative length.
However, non-negativity is only checked with toLength
, and negative values
can be obtained using the Num
and related instances.
Safe conversion is roughly 50 percent slower.
benchmarking length/length sum foldl' with safe conversion time 110.4 ms (109.8 ms .. 111.0 ms) 1.000 R² (1.000 R² .. 1.000 R²) mean 110.2 ms (110.0 ms .. 110.6 ms) std dev 501.8 μs (359.1 μs .. 730.0 μs) benchmarking length/length sum foldl' num instance time 89.37 ms (85.13 ms .. 94.27 ms) 0.996 R² (0.992 R² .. 1.000 R²) mean 86.53 ms (85.63 ms .. 88.52 ms) std dev 2.239 ms (1.069 ms .. 3.421 ms) benchmarking length/double sum foldl' time 85.47 ms (84.88 ms .. 86.42 ms) 1.000 R² (0.999 R² .. 1.000 R²) mean 85.56 ms (85.26 ms .. 86.02 ms) std dev 611.9 μs (101.5 μs .. 851.7 μs)
Instances
toLengthUnsafe :: Double -> Length Source #
Do not check if value is negative.
class HasLength e where Source #
A data type with measurable and modifiable values.
getLen :: e -> Length Source #
Get length.
setLen :: Length -> e -> e Source #
Set length.
modLen :: (Length -> Length) -> e -> e Source #
Modify length.
Instances
HasLength Length Source # | |
HasLength PhyloExplicit Source # | |
Defined in ELynx.Tree.Phylogeny getLen :: PhyloExplicit -> Length Source # setLen :: Length -> PhyloExplicit -> PhyloExplicit Source # modLen :: (Length -> Length) -> PhyloExplicit -> PhyloExplicit Source # |
height :: HasLength e => Tree e a -> Length Source #
The maximum distance between origin and leaves.
The height includes the branch length of the stem.
rootHeight :: HasLength e => Tree e a -> Length Source #
The maximum distance between root node and leaves.
Functions on trees
distancesOriginLeaves :: HasLength e => Tree e a -> [Length] Source #
Distances from the origin of a tree to the leaves.
The distances include the branch length of the stem.