gauss_markov
Variables
-
static double DEFAULT_BOUND = -1.0
Default bound for the Gauss-Markov model.
-
static double MIN_STATE_FACTOR = 1E-10
Minimum state factor for the Gauss-Markov model.
-
class GaussMarkov
- #include <gauss_markov.h>
This module is used to apply a second-order bounded Gauss-Markov random walk on top of an upper level process. The intent is that the caller will perform the set methods (setUpperBounds, setNoiseMatrix, setPropMatrix) as often as they need to, call computeNextState, and then call getCurrentState cyclically.
Public Functions
-
GaussMarkov()
The constructor initializes the random number generator used for the walks.
-
GaussMarkov(uint64_t size, uint64_t newSeed = 0x1badcad1)
class constructor
-
~GaussMarkov()
The destructor is a placeholder for one that might do something
-
void computeNextState()
This method performs almost all of the work for the Gauss Markov random walk. It uses the current random walk configuration, propagates the current state, and then applies appropriate errors to the states to set the current error level.
-
inline void setRNGSeed(uint64_t newSeed)
Restart the noise process with the supplied random seed.
The generator, cached distribution state, and propagated noise state are reset so the same seed reproduces the complete output sequence.
- Parameters:
newSeed – The seed to use in the random number generator.
-
inline const Eigen::VectorXd &getCurrentState() const
Method returns the current random walk state from the model.
- Returns:
Reference to the vector of random walk values.
-
inline void setUpperBounds(const Eigen::Ref<const Eigen::VectorXd> &newBounds)
Set the upper bounds on the random walk.
- Parameters:
newBounds – Bounds to put on the random walk states.
Public Members
-
Eigen::MatrixXd noiseMatrix
— Cholesky-decomposition or matrix square root of the covariance matrix to apply errors with
-
BSKLogger bskLogger
— BSK Logging
Public Static Functions
-
static uint64_t deriveSecondarySeed(uint64_t baseSeed)
Derive a seed for a secondary
std::minstd_randstream.A fixed stream discriminator separates the seed values. The candidate engine state is compared with the primary states obtained from both the low 32 bits and the full 64 bits of
baseSeed. If either state aliases, the secondary engine advances until it differs from both primary states. This includes the special case wherestd::minstd_randnormalizes seeds zero and one to the same initial state.The returned seed is normalized to 32 bits.
std::minstd_rand::result_typeisstd::uint_fast32_t, whose width is implementation defined, so an unmasked seed would select a different secondary stream depending on the standard library the simulation was built against.Note
Primary seeding is unchanged. A base seed above 32 bits may still select different primary streams on platforms with different engine result widths; the derived secondary stream remains distinct from both.
- Parameters:
baseSeed – Seed used by the primary random stream.
- Returns:
Seed for a distinct, repeatable secondary random stream.
Private Functions
-
void initializeRNG()
-
GaussMarkov()