Quetzal-CoaTL
The Coalescence Template Library
Loading...
Searching...
No Matches
quetzal::coalescence::occupancy_spectrum::OccupancySpectrum Class Reference

#include <quetzal/coalescence/occupancy_spectrum/OccupancySpectrum.hpp>

Detailed Description

An occupancy spectrum as defined in Becheler & Knowles, 2020.

To understand the implementation of occupancy spectrum concept as applied to the coalescent, it is useful to consider the coalescence process as an urn and balls experiment where \(n\) balls (lineages) are randomly assigned to \(m\) urns (parents), each urn having an assignment probability of \(m−1\)⁠. If an urn contains \(r\) balls at the end of a random experiment, \(r\) is said to be the occupancy number of the urn (see Johnson and Kotz, 1977).

The number of urns having the same occupancy number \(r\) is denoted \(M_r\) and the term occupancy spectrum refers to the vector \(M_0, M_1,\dots , M_n\)⁠.

This is an useful abstraction to separate modules that are responsible for randomely producing spectrums (coalescence::occupancy_spectrum::generation_policy) from modules that consume them (coalescence::algorithm::simultaneous_multiple_merge).

Public Types

using value_type = typename occupancy_spectrum_type::value_type
 
using iterator = typename occupancy_spectrum_type::iterator
 
using const_iterator = typename occupancy_spectrum_type::const_iterator
 

Public Member Functions

 OccupancySpectrum (std::vector< int > const &v, int k, int N)
 Constructor by copy.
 
 OccupancySpectrum (std::vector< int > &&v, int k, int N)
 Move constructor.
 
 OccupancySpectrum ()=delete
 Deleted default constructor.
 
 OccupancySpectrum (const OccupancySpectrum &other)=default
 Default copy constructor.
 
 OccupancySpectrum (OccupancySpectrum &&other) noexcept
 Move constructor.
 
OccupancySpectrumoperator= (const OccupancySpectrum &other)
 Copy assignment operator.
 
OccupancySpectrumoperator= (OccupancySpectrum &&other)
 Move assignment operator.
 
iterator begin ()
 returns iterator to the beginning of the spectrum
 
iterator end ()
 returns iterator to the end of the spectrum
 
const_iterator begin () const
 returns iterator to the beginning of the spectrum
 
const_iterator end () const
 returns iterator to the end of the spectrum
 
const_iterator cbegin () const
 returns iterator to the beginning of the spectrum
 
const_iterator cend () const
 returns iterator to the end of the spectrum
 
void erase (iterator first, iterator last)
 erase a range of elements of the spectrum.
 
bool empty () const
 Returns whether the spectrum is empty (i.e. whether its size is 0).
 

Constructor & Destructor Documentation

◆ OccupancySpectrum() [1/5]

quetzal::coalescence::occupancy_spectrum::OccupancySpectrum::OccupancySpectrum ( std::vector< int > const &  v,
int  k,
int  N 
)
inline

Constructor by copy.

Parameters
vA vector of occupancy numbers
Nthe number of urns (parents) of the random experience
kthe number of balls (coalescing lineages) of the random experience

◆ OccupancySpectrum() [2/5]

quetzal::coalescence::occupancy_spectrum::OccupancySpectrum::OccupancySpectrum ( std::vector< int > &&  v,
int  k,
int  N 
)
inline

Move constructor.

Parameters
vA vector of occupancy numbers
Nthe number of urns (parents) of the random experience
kthe number of balls (coalescing lineages) of the random experience

◆ OccupancySpectrum() [3/5]

quetzal::coalescence::occupancy_spectrum::OccupancySpectrum::OccupancySpectrum ( )
delete

Deleted default constructor.

Remarks
this would break class invariants as there is no good way to initialize by default

◆ OccupancySpectrum() [4/5]

quetzal::coalescence::occupancy_spectrum::OccupancySpectrum::OccupancySpectrum ( const OccupancySpectrum other)
default

Default copy constructor.

Parameters
otherAn occupancy spectrum to copy content from

◆ OccupancySpectrum() [5/5]

quetzal::coalescence::occupancy_spectrum::OccupancySpectrum::OccupancySpectrum ( OccupancySpectrum &&  other)
inlinenoexcept

Move constructor.

Parameters
otherAn occupancy spectrum to move content from

Member Function Documentation

◆ operator=()

OccupancySpectrum & quetzal::coalescence::occupancy_spectrum::OccupancySpectrum::operator= ( OccupancySpectrum &&  other)
inline

Move assignment operator.

Parameters
otherthe spectrum to move data from
Remarks
other will be emptied and can not be reused.

The documentation for this class was generated from the following file: