A library for working with phylogenetic and population genetic data.
v0.27.0
tree/mass_tree/functions.cpp File Reference
#include "genesis/tree/mass_tree/functions.hpp"
#include "genesis/tree/function/operators.hpp"
#include "genesis/tree/iterator/postorder.hpp"
#include "genesis/tree/mass_tree/tree.hpp"
#include "genesis/tree/tree.hpp"
#include "genesis/utils/core/logging.hpp"
#include "genesis/utils/containers/matrix.hpp"
#include "genesis/utils/containers/matrix/operators.hpp"
#include <algorithm>
#include <cassert>
#include <cmath>
#include <stdexcept>
#include <utility>
#include <vector>

Go to the source code of this file.

Namespaces

 genesis
 Container namespace for all symbols of genesis in order to keep them separate when used as a library.
 
 genesis::tree
 

Functions

double mass_tree_binify_masses (MassTree &tree, size_t number_of_bins)
 Accumulate all masses of a MassTree into bins on each branch. More...
 
double mass_tree_center_masses_on_branches (MassTree &tree)
 Accumulate all masses of a MassTree on the centers of their edges. More...
 
double mass_tree_center_masses_on_branches_averaged (MassTree &tree)
 Accumulate all masses of a MassTree at the average mass position per edge. More...
 
void mass_tree_clear_masses (MassTree &tree)
 Clear all masses of a MassTree, while keeping its topology. More...
 
std::vector< double > mass_tree_mass_per_edge (MassTree const &tree)
 Return a std::vector that contains the total mass for each edge of the given MassTree. More...
 
utils::Matrix< double > mass_tree_mass_per_edge (std::vector< MassTree > const &mass_trees)
 Return the total mass for each edge of the given MassTrees. More...
 
std::vector< std::pair< double, double > > mass_tree_mass_per_edge_averaged (MassTree const &tree)
 Return a std::vector that contains the total Mass for each edge of the given MassTree (second value), as well as the average position of that mass on the branch (in branch lengths units, first value). More...
 
MassTree mass_tree_merge_trees (MassTree const &lhs, MassTree const &rhs, double const scaler_lhs=1.0, double const scaler_rhs=1.0)
 Merge all masses of two MassTrees into one and return it. More...
 
void mass_tree_merge_trees_inplace (MassTree &lhs, MassTree const &rhs, double const scaler_lhs=1.0, double const scaler_rhs=1.0)
 Merge all masses of two MassTrees by adding them to the first MassTree. More...
 
void mass_tree_normalize_masses (MassTree &tree)
 Scale all masses of a MassTree so that they sum up to 1.0. More...
 
void mass_tree_reverse_signs (MassTree &tree)
 Reverse the sign of each mass point on a MassTree. More...
 
void mass_tree_scale_masses (MassTree &tree, double factor)
 Scale all masses of a MassTree with the multiplicative factor factor. More...
 
double mass_tree_sum_of_masses (MassTree const &tree)
 Return the total sum of all masses on the MassTree. More...
 
void mass_tree_transform_to_unit_branch_lengths (MassTree &tree)
 Set all branch lengths of a MassTree to 1.0, while keeping the relative position of all masses on the branches. More...
 
bool mass_tree_validate (MassTree const &tree, double valid_total_mass_difference=-1.0)
 Validate the data on a MassTree. More...
 
void mass_trees_make_average_branch_lengths (std::vector< MassTree > &mass_trees)
 Change the branch lengths of all trees to their average, and move the masses accordingly in a proportional way. More...