A library for working with phylogenetic and population genetic data.
v0.27.0
placement/function/distances.cpp File Reference
#include "genesis/placement/function/distances.hpp"
#include "genesis/placement/pquery.hpp"
#include "genesis/placement/pquery/plain.hpp"
#include <algorithm>
#include <cassert>
#include <cmath>

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::placement
 

Functions

double placement_distance (PqueryPlacement const &place_a, PqueryPlacement const &place_b, utils::Matrix< double > const &node_distances)
 Calculate the distance between two PqueryPlacements, using their positin on the tree::TreeEdges, measured in branch length units. More...
 
double placement_distance (PqueryPlacement const &placement, tree::TreeNode const &node, utils::Matrix< double > const &node_distances)
 Calculate the distance in branch length units between a PqueryPlacement and a tree::TreeNode. More...
 
size_t placement_path_length_distance (PqueryPlacement const &placement, tree::TreeEdge const &edge, utils::Matrix< size_t > const &edge_path_lengths)
 Calculate the discrete distance from a PqueryPlacement to an edge, measured as the number of nodes between them. More...
 
size_t placement_path_length_distance (PqueryPlacement const &place_a, PqueryPlacement const &place_b, utils::Matrix< size_t > const &node_path_lengths)
 
double pquery_distance (Pquery const &pquery, tree::TreeNode const &node, utils::Matrix< double > const &node_distances)
 Calculate the weighted distance between the PqueryPlacements of a Pquery and a tree::TreeNode, in branch length units, using the like_weight_ratio of the PqueryPlacements for weighing. More...
 
double pquery_distance (Pquery const &pquery_a, Pquery const &pquery_b, utils::Matrix< double > const &node_distances, bool with_pendant_length=false)
 Calculate the weighted distance between two Pqueries, in branch length units, as the pairwise distance between their PqueryPlacements, and using the like_weight_ratio for weighing. More...
 
template<typename DistanceFunction >
double pquery_distance (Pquery const &pquery, DistanceFunction distance_function)
 Local helper function to avoid code duplication. More...
 
template<typename DistanceFunction >
double pquery_distance (Pquery const &pquery_a, Pquery const &pquery_b, DistanceFunction distance_function)
 Local helper function to avoid code duplication. More...
 
double pquery_distance (PqueryPlain const &pquery_a, PqueryPlain const &pquery_b, utils::Matrix< double > const &node_distances, bool with_pendant_length=false)
 Calculate the weighted distance between two plain pqueries. It is mainly a helper method for distance calculations (e.g., pairwise distance, variance). More...
 
double pquery_path_length_distance (Pquery const &pquery, tree::TreeEdge const &edge, utils::Matrix< size_t > const &edge_path_lengths)
 Calculate the weighted discrete distance between the PqueryPlacements of a Pquery and a tree::TreeEdge, in number of nodes between them, using the like_weight_ratio of the PqueryPlacements for weighing. More...
 
double pquery_path_length_distance (Pquery const &pquery_a, Pquery const &pquery_b, utils::Matrix< size_t > const &node_path_lengths)
 Calculate the weighted discrete distance between two Pqueries, measured as the pairwise distance in number of nodes between between their PqueryPlacements, and using the like_weight_ratio for weighing. More...