|
Nemo
2.4.0b
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
|
Non-template and faster implementation of std::bitset. More...
#include <bitstring.h>
Collaboration diagram for bitstring:Classes | |
| class | reference |
Public Types | |
| typedef unsigned long | _ul |
Public Member Functions | |
| bitstring () | |
| bitstring (size_t length) | |
| bitstring (const bitstring &b) | |
| ~bitstring () | |
| void | reset (size_t length) |
| void | reset () |
| Set all bits to 0. More... | |
| _ul * | getword_atPos (size_t pos) const |
| _ul * | getword_atIdx (size_t index) const |
| size_t | size () const |
| size_t | nb_words () const |
| bool | at (size_t word, unsigned long bitmask) const |
| reference | operator[] (size_t pos) |
| bool | operator[] (size_t n) const |
| bitstring & | operator= (const bitstring &b) |
| bitstring & | operator&= (const bitstring &x) |
| bitstring & | operator|= (const bitstring &x) |
| bitstring & | operator^= (const bitstring &x) |
| bitstring | operator~ (void) |
| bitstring | operator& (const bitstring &x) |
| bitstring | operator| (const bitstring &x) |
| bitstring | operator^ (const bitstring &x) |
| unsigned int | local_popcountl (_ul wd) const |
| Counts number of one's in a word using hardware POPCNT when available, falling back to a byte-table lookup otherwise. More... | |
| unsigned int | count () |
| Count number of set bits. More... | |
| unsigned int | count (size_t from, size_t to) |
| Count set bits in the range [from, to). More... | |
| unsigned int | count_and (const bitstring &mask) const |
| Masked popcount: count set bits in (this AND mask). More... | |
| unsigned int | count_xor (const bitstring &other) const |
| Fused XOR popcount: count set bits in (this XOR other). More... | |
| unsigned int | count_xor_and (const bitstring &other, const bitstring &mask) const |
| Fused XOR + mask popcount: count set bits in ((this XOR other) AND mask). More... | |
| unsigned int | count_and_and (const bitstring &other, const bitstring &mask) const |
| Fused AND + mask popcount: count set bits in ((this AND other) AND mask). More... | |
| void | set (size_t n) |
| Set a bit to 1. More... | |
| void | set (size_t n, bool x) |
| Set a bit to 0 or 1. More... | |
| void | flip (size_t n) |
| Flip the bit at n. More... | |
| void | set_data (_ul *srce, size_t nbwrd) |
| Copy bits from an array of unsigned long words. More... | |
| void | copy (const bitstring &b) |
| Unchecked copy, assumes we have sames sizes. More... | |
| void | copy (const bitstring &b, size_t word_pos) |
| Copy one word. More... | |
| void | copy (const bitstring &b, size_t from, size_t to) |
| Copy a delimited sequence block. More... | |
| std::string | to_string () const |
| std::string | to_string (size_t from, size_t to) const |
| void | print (size_t from, size_t to) const |
| void | print () const |
Private Attributes | |
| size_t | _size |
| Number of bits in the sequence. More... | |
| size_t | _words |
| Number of _ul-long Words necessary to hold the _size bits. More... | |
| _ul * | _data |
| The sequence. More... | |
Static Private Attributes | |
| static unsigned char | _bit_count [256] |
Friends | |
| class | reference |
Non-template and faster implementation of std::bitset.
| typedef unsigned long bitstring::_ul |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Unchecked copy, assumes we have sames sizes.
Referenced by TTQuanti_diallelic_bitstring_no_pleio::copy_sequence_block(), TTQuanti_diallelic_bitstring_full_pleio::copy_sequence_block(), TTQuanti_diallelic_bitstring_var_pleio::copy_sequence_block(), TTQuanti_diallelic_bitstring_no_pleio_epistasis::copy_sequence_block(), TTQuanti_diallelic_bitstring_full_pleio_epistasis::copy_sequence_block(), TProtoBDMI::inherit_low(), TProtoDeletMutations_bitstring::inherit_low(), TTNeutralGenes_bitstring::inherit_low(), TT_BDMI::operator=(), TTDeletMutations_bitstring::operator=(), TTQuanti_diallelic_bitstring::operator=(), TTQuanti_diallelic_bitstring::set_bit_sequence(), TT_BDMI::set_sequence(), and TTDeletMutations_bitstring::set_sequence().
|
inline |
|
inline |
|
inline |
Count number of set bits.
References _data, _words, and local_popcountl().
Referenced by TTQuanti_diallelic_bitstring_no_pleio::get_additive_genotype_equal_effects(), TTDeletMutations_bitstring::set_nb_hmz_mutations(), TTDeletMutations_bitstring::set_nb_htz_mutations(), and TTDeletMutations_bitstring::set_nb_mutations().
|
inline |
Count set bits in the range [from, to).
References _data, _size, BITS_PER_WORD, local_popcountl(), and MASK.
|
inline |
Masked popcount: count set bits in (this AND mask).
References _data, _words, and local_popcountl().
Referenced by TTQuanti_diallelic_bitstring_no_pleio::get_additive_genotype(), TTQuanti_diallelic_bitstring_full_pleio::get_additive_genotype(), TTQuanti_diallelic_bitstring_var_pleio::get_additive_genotype(), and TTDeletMutations_bitstring::set_value().
|
inline |
Fused AND + mask popcount: count set bits in ((this AND other) AND mask).
References _data, _words, and local_popcountl().
Referenced by TTQuanti_diallelic_bitstring_no_pleio::get_dominant_genotype(), TTQuanti_diallelic_bitstring_full_pleio::get_dominant_genotype(), and TTQuanti_diallelic_bitstring_var_pleio::get_dominant_genotype().
|
inline |
Fused XOR popcount: count set bits in (this XOR other).
References _data, _words, and local_popcountl().
Referenced by TTDeletMutations_bitstring::set_value(), and TTNeutralGenesSH::setHo().
|
inline |
Fused XOR + mask popcount: count set bits in ((this XOR other) AND mask).
References _data, _words, and local_popcountl().
Referenced by TTQuanti_diallelic_bitstring_no_pleio::get_dominant_genotype(), TTQuanti_diallelic_bitstring_full_pleio::get_dominant_genotype(), and TTQuanti_diallelic_bitstring_var_pleio::get_dominant_genotype().
|
inline |
Flip the bit at n.
References _data, and BITS_PER_WORD.
Referenced by TTQuanti_diallelic_bitstring_no_pleio::init_sequence(), TTQuanti_diallelic_bitstring_full_pleio::init_sequence(), TTQuanti_diallelic_bitstring_var_pleio::init_sequence(), TTQuanti_diallelic_bitstring_no_pleio_epistasis::init_sequence(), TTQuanti_diallelic_bitstring_full_pleio_epistasis::init_sequence(), TT_BDMI::mutate_diplo(), TT_BDMI::mutate_haplo(), TTQuanti_diallelic_bitstring::mutate_inplace(), TTDeletMutations_bitstring::mutate_noredraw(), and TTQuanti_diallelic_bitstring::set_allele_value().
|
inline |
References _data.
Referenced by TTQuanti_diallelic_bitstring_no_pleio::get_dominant_genotype(), TTNeutralGenes_bitstring::inherit(), TTDeletMutations_bitstring::set_counts_and_bitstrings(), TTNeutralGenesSH::setAlleleTables(), TTDeletMutBitstrSH::setDeletStats(), TTNeutralGenesSH::setHo2(), TT_BDMI::store_data(), TTDeletMutations_bitstring::store_data(), TTQuanti_diallelic_bitstring::store_data(), TTDeletMutations_bitstring::viability_epist_continuous(), and TTDeletMutations_bitstring::viability_multi_continuous().
|
inline |
|
inline |
Counts number of one's in a word using hardware POPCNT when available, falling back to a byte-table lookup otherwise.
References _bit_count.
Referenced by count(), count_and(), count_and_and(), count_xor(), and count_xor_and().
|
inline |
References _words.
Referenced by TTNeutralGenes_bitstring::inherit(), TT_BDMI::retrieve_data(), TTDeletMutations_bitstring::retrieve_data(), TTQuanti_diallelic_bitstring::retrieve_data(), TTDeletMutations_bitstring::set_counts_and_bitstrings(), TTNeutralGenesSH::setAlleleTables(), TTDeletMutBitstrSH::setDeletStats(), TTNeutralGenesSH::setHo2(), TT_BDMI::store_data(), TTDeletMutations_bitstring::store_data(), TTQuanti_diallelic_bitstring::store_data(), TTDeletMutations_bitstring::viability_epist_continuous(), and TTDeletMutations_bitstring::viability_multi_continuous().
|
inline |
References _data, and BITS_PER_WORD.
|
inline |
|
inline |
References _data, _size, and BITS_PER_WORD.
|
inline |
References _data, _size, and BITS_PER_WORD.
|
inline |
|
inline |
References _data, _size, _words, and BITSET_WORDS.
Referenced by TTDeletMutBitstrFH::FHread(), TT_BDMI::init(), TTNeutralGenes_bitstring::init(), TTQuanti_diallelic_bitstring::init(), TT_BDMI::init_sequence(), TTDeletMutations_bitstring::init_sequence(), TTNeutralGenes_bitstring::init_sequence(), TTQuanti_diallelic_bitstring_no_pleio::init_sequence(), TTQuanti_diallelic_bitstring_full_pleio::init_sequence(), TTQuanti_diallelic_bitstring_var_pleio::init_sequence(), TTQuanti_diallelic_bitstring_no_pleio_epistasis::init_sequence(), TTQuanti_diallelic_bitstring_full_pleio_epistasis::init_sequence(), and TT_BDMI::reset().
|
inline |
Set a bit to 1.
References _data, and BITS_PER_WORD.
Referenced by TTDeletMutBitstrFH::FHread(), TT_BDMI::init_sequence(), TTDeletMutations_bitstring::init_sequence(), TTQuanti_diallelic_bitstring::mutate_add(), TTDeletMutations_bitstring::mutate_noredraw(), TTDeletMutations_bitstring::mutate_noredraw_noBackMutation(), TTDeletMutations_bitstring::mutate_redraw(), TTQuanti_diallelic_bitstring::set_allele_bit(), and TTDeletMutations_bitstring::set_allele_value().
|
inline |
|
inline |
Copy bits from an array of unsigned long words.
Referenced by TT_BDMI::retrieve_data(), TTDeletMutations_bitstring::retrieve_data(), and TTQuanti_diallelic_bitstring::retrieve_data().
|
inline |
References _data, _size, and BITS_PER_WORD.
|
inline |
References _data, _size, and BITS_PER_WORD.
|
friend |
Referenced by operator[]().
|
staticprivate |
Referenced by local_popcountl().
|
private |
The sequence.
Referenced by at(), bitstring(), copy(), count(), count_and(), count_and_and(), count_xor(), count_xor_and(), flip(), getword_atIdx(), getword_atPos(), operator&=(), operator=(), operator[](), operator^=(), operator|=(), operator~(), print(), reset(), set(), set_data(), to_string(), and ~bitstring().
|
private |
Number of bits in the sequence.
Referenced by copy(), count(), operator=(), print(), reset(), size(), and to_string().
|
private |
Number of _ul-long Words necessary to hold the _size bits.
Referenced by bitstring(), copy(), count(), count_and(), count_and_and(), count_xor(), count_xor_and(), nb_words(), operator&=(), operator=(), operator^=(), operator|=(), operator~(), reset(), and set_data().
1.9.1 -- Nemo is hosted on