71 bool const with_pendant_length
96 if( with_pendant_length ) {
97 work += pendant_work_l + pendant_work_r;
110 bool const with_pendant_length
119 if( with_pendant_length ) {
120 assert( mass_trees.second.size() == sample_set.
size() );
121 for(
size_t i = 0; i < sample_set.
size(); ++i ) {
122 for(
size_t j = 0; j < sample_set.
size(); ++j ) {
123 result( i, j ) += mass_trees.second[ i ] + mass_trees.second[ j ];
double add_sample_to_mass_tree(Sample const &smp, double const sign, double const scaler, tree::MassTree &target)
Helper function to copy masses from a Sample to a MassTree.
size_t size() const
Return the size of the SampleSet, i.e., the number of Samples.
void add(Tree const &tree, std::string const &name="")
Add a Tree with a name to the TreeSet.
PlacementTree & tree()
Get the PlacementTree of this Sample.
double earth_movers_distance(MassTree const &lhs, MassTree const &rhs, double const p)
Calculate the earth mover's distance of two distributions of masses on a given Tree.
Provides functions for working with Placements and Pqueries.
Tree average_branch_length_tree(std::vector< Tree > const &tset)
Return a Tree where the branch lengths are the average of the Trees in the given vector of Trees or T...
Container namespace for all symbols of genesis in order to keep them separate when used as a library...
Store a set of Samples with associated names.
double total_placement_mass_with_multiplicities(Sample const &smp)
Get the mass of all PqueryPlacements of the Sample, using the multiplicities as factors.
double earth_movers_distance(Sample const &lhs, Sample const &rhs, double const p, bool const with_pendant_length)
Calculate the earth mover's distance between two Samples.
Manage a set of Pqueries along with the PlacementTree where the PqueryPlacements are placed on...
MassTree convert_common_tree_to_mass_tree(CommonTree const &source)
Helper function that takes a CommonTree (or any Tree with Node and Edge data derived from it) and tur...
std::pair< tree::TreeSet, std::vector< double > > convert_sample_set_to_mass_trees(SampleSet const &sample_set, bool normalize)
Convert all Samples in a SampleSet to tree::MassTrees.