STORMM Source Documentation
|
Make an array of integral settings and tick it forward (or backward). The analogy is a series of wheels A - N, each with n_A, n_B, ... , n_N settings. With each tick, the lowest wheel (position 0 of the array) advances one tick. When each wheel completes one revolution, it triggers an advance of the next wheel. This collapses to a simple base-K counting system for a series of wheels with equal numbers of K settings apiece. More...
#include <tickcounter.h>
Public Member Functions | |
int | getVariableCount () const |
Get the number of independent settings, the number of variables. | |
double | getLogPermutations () const |
Get the logarithm of the number of overall permutations. | |
const std::vector< int > & | getSettings () const |
Get a const reference to the vector of current settings. | |
llint | getExactPermutationCount () const |
Get the exact number of permutations for this object. | |
double | getApproximatePermutationCount () const |
Get the number of permutations count for this object as a floating-point number. | |
double | getLogPermutationCount () const |
Get the natural logarithm of the number of permutations of this object. | |
void | advance (int steps=1) |
Advance the counter by a specified number of steps. | |
void | reverse (int steps=1) |
Reverse the counter by a specified number of steps. | |
void | reset () |
Reset all states of the counter to zero. | |
TickCounter (const std::vector< int > &state_limits_in, const std::vector< int > &settings_in=std::vector< int >()) | |
The constructor takes a series of state counts for each "wheel" in the counter. The initial state can also be provided. | |
TickCounter (const std::vector< std::vector< T > > &state_values_in, const std::vector< int > &settings_in=std::vector< int >()) | |
TickCounter (const TickCounter &original)=default | |
The copy and move constructors as well as assignment operators are all valid. | |
TickCounter (TickCounter &&original)=default | |
TickCounter & | operator= (const TickCounter &original)=default |
TickCounter & | operator= (TickCounter &&original)=default |
int | getStateLimits (int var_index) const |
Get the number of available states. | |
const std::vector< int > & | getStateLimits () const |
T | getState (int var_index) const |
Get the state represented by a particular combination of settings, drawing on the internal representations of each state. | |
std::vector< T > | getState () const |
std::vector< T > | getPossibleStates (int var_index) const |
Get a vector of all possible states for one of the variables. | |
template<typename Trng> | |
void | randomize (Trng *xrs) |
Randomize some or all variables of the object. | |
template<typename Trng> | |
void | randomize (Trng *xrs, const std::vector< bool > &apply_rng) |
template<typename Trng> | |
void | randomize (Trng *xrs, const std::vector< int > &apply_rng) |
void | set (const std::vector< int > &new_state) |
Set the object's state to an arbitrary series of values. | |
void | set (int new_state, int var_index) |
void | loadStateValues (const std::vector< T > &state_values_in, int var_index) |
Load the available states for one or more independent variables. | |
void | loadStateValues (const std::vector< std::vector< T > > &state_values_in) |
Make an array of integral settings and tick it forward (or backward). The analogy is a series of wheels A - N, each with n_A, n_B, ... , n_N settings. With each tick, the lowest wheel (position 0 of the array) advances one tick. When each wheel completes one revolution, it triggers an advance of the next wheel. This collapses to a simple base-K counting system for a series of wheels with equal numbers of K settings apiece.
std::vector< T > stormm::stmath::TickCounter< T >::getPossibleStates | ( | int | var_index | ) | const |
Get a vector of all possible states for one of the variables.
var_index | Index of the variable of interest |
T stormm::stmath::TickCounter< T >::getState | ( | int | var_index | ) | const |
Get the state represented by a particular combination of settings, drawing on the internal representations of each state.
Overloaded:
var_index | Index of the variable of interest |
int stormm::stmath::TickCounter< T >::getStateLimits | ( | int | var_index | ) | const |
Get the number of available states.
Overloaded:
var_index | The variable of interest |
void stormm::stmath::TickCounter< T >::loadStateValues | ( | const std::vector< T > & | state_values_in, |
int | var_index ) |
Load the available states for one or more independent variables.
Overloaded:
state_values_in | The enumerated states that one or all independent variables can take |
var_index | The specific variable of interest |
void stormm::stmath::TickCounter< T >::randomize | ( | Trng * | xrs | ) |
Randomize some or all variables of the object.
Overloaded:
xrs | The random number generator (the type of this argument is the basis of the templating) |
apply_rng | A vector containing entries for all counter variables and marked TRUE to cause the variable to be randomly reassigned, or a vector containing a limited number of counter indices |
void stormm::stmath::TickCounter< T >::set | ( | const std::vector< int > & | new_state | ) |
Set the object's state to an arbitrary series of values.
Overloaded:
new_state | The value or values to set |
var_index | Index of a particular counter variable to set |