|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file.
49 size_t const i = n - 2 -
static_cast<size_t>(
50 std::floor( std::sqrt( 4 * n * ( n - 1 ) - 7 - ( 8 * k )) / 2.0 - 0.5 )
52 size_t const j = k + i + 1 - n * ( n - 1 ) / 2 + ( n - i ) * (( n - i ) - 1 ) / 2;
58 size_t const k = ( n * ( n - 1 ) / 2 ) - ( n - i ) * (( n - i ) - 1 ) / 2 + j - i - 1;
64 return ( n * n - n ) / 2;
77 for (
size_t i = 0; i < matrix.
rows(); ++i) {
78 for (
size_t j = 0; j < matrix.
cols(); ++j) {
79 os << std::setw(width) << std::setfill(' ') << static_cast<int>( matrix(i, j) );
80 if (j < matrix.
cols() - 1) {
size_t triangular_index(size_t i, size_t j, size_t n)
Given indices i and j in a quadratic Matrix, find the corresponding linear index.
std::ostream & operator<<(std::ostream &os, Color const &color)
Write a textual representation of the Color the a stream, in the format "(r, g, b,...
std::pair< size_t, size_t > triangular_indices(size_t k, size_t n)
Given a linear index in a upper triangular Matrix, find the corresponding Matrix indices.
void print_byte_matrix_(std::ostream &os, const Matrix< T > &matrix, size_t width)
Local helper function to avoid code duplication.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
size_t triangular_size(size_t n)
Calculate the number of linear indices needed for a triangular Matrix of size n.