ʻOhana
Population structure, admixture history, and selection using learning methods.
Public Types | Static Public Member Functions
jade::basic_nwk2cov< TValue > Class Template Reference

A template for a class that converts Newick-formatted trees to covariance matrices. More...

#include <jade.nwk2cov.hpp>

+ Collaboration diagram for jade::basic_nwk2cov< TValue >:

Public Types

typedef TValue value_type
 The value type. More...
 
typedef basic_newick_node< value_typenewick_node_type
 The Newick node type. More...
 
typedef basic_matrix< value_typematrix_type
 The matrix type. More...
 
typedef basic_rerooted_tree< value_typererooted_tree_type
 The rerooted tree type. More...
 

Static Public Member Functions

static void execute (std::istream &in, std::ostream &out)
 Executes the program through the specified streams. More...
 

Detailed Description

template<typename TValue>
class jade::basic_nwk2cov< TValue >

A template for a class that converts Newick-formatted trees to covariance matrices.

Definition at line 20 of file jade.nwk2cov.hpp.

Member Typedef Documentation

◆ matrix_type

template<typename TValue >
typedef basic_matrix<value_type> jade::basic_nwk2cov< TValue >::matrix_type

The matrix type.

Definition at line 30 of file jade.nwk2cov.hpp.

◆ newick_node_type

template<typename TValue >
typedef basic_newick_node<value_type> jade::basic_nwk2cov< TValue >::newick_node_type

The Newick node type.

Definition at line 27 of file jade.nwk2cov.hpp.

◆ rerooted_tree_type

template<typename TValue >
typedef basic_rerooted_tree<value_type> jade::basic_nwk2cov< TValue >::rerooted_tree_type

The rerooted tree type.

Definition at line 33 of file jade.nwk2cov.hpp.

◆ value_type

template<typename TValue >
typedef TValue jade::basic_nwk2cov< TValue >::value_type

The value type.

Definition at line 24 of file jade.nwk2cov.hpp.

Member Function Documentation

◆ execute()

template<typename TValue >
static void jade::basic_nwk2cov< TValue >::execute ( std::istream &  in,
std::ostream &  out 
)
inlinestatic

Executes the program through the specified streams.

Parameters
inThe input stream.
outThe output stream.

Definition at line 38 of file jade.nwk2cov.hpp.

41  {
42  const newick_node_type node (in);
43  const rerooted_tree_type tree (node);
44 
45  const auto rk = tree.get_rk();
46  matrix_type c (rk, rk);
47 
48  for (size_t i = 0; i < rk; i++)
49  for (size_t j = 0; j <= i; j++)
50  c(i, j) = tree.get_overlap(i, j).get_length();
51 
52  c.copy_lower_to_upper();
53 
55  out << c;
56  }
+ Here is the call graph for this function:

The documentation for this class was generated from the following file:
jade::basic_nwk2cov::newick_node_type
basic_newick_node< value_type > newick_node_type
The Newick node type.
Definition: jade.nwk2cov.hpp:27
jade::basic_matrix< value_type >::set_high_precision
static void set_high_precision(std::ostream &out)
Sets the specified stream to scientific notation with a high precision.
Definition: jade.matrix.hpp:1154
jade::basic_nwk2cov::rerooted_tree_type
basic_rerooted_tree< value_type > rerooted_tree_type
The rerooted tree type.
Definition: jade.nwk2cov.hpp:33
jade::basic_nwk2cov::matrix_type
basic_matrix< value_type > matrix_type
The matrix type.
Definition: jade.nwk2cov.hpp:30