libfbm
0.1
Simulation of multi-dimensional stationary Gaussian processes and fractional Brownian motion.
|
Stein's fractional Brownian motion context. More...
#include <libfbm.hpp>
Public Member Functions | |
FBMSteinContext (double H, size_t dim, size_t size, double Rhint=-1, bool mapDim=true) | |
Construct the Stein's FBM context object of size size^dim. | |
double | cov (const zvec &zvec) |
Covariance function. | |
void | disablePostProcessing () |
double | getR () const |
Get the parameter R described in [3]. | |
![]() | |
SGPContext (const zvec &fieldDim, const zvec &userDim, const std::string &cacheName) | |
Constructor. | |
virtual | ~SGPContext () |
void | setRandomGenerator (const RandomGenerator &newRng) |
Set the standard normal random value generator. | |
RandomGenerator & | getRandomGenerator () |
const zvec & | getDim () const |
Get the usable dimension of the generated field. | |
const zvec & | getFieldDim () const |
Get the physical dimension of the generated field. | |
double | nextRng () const |
void | setCacheDir (const std::string &cacheDir) |
Set the cache directory. | |
size_t | badEigenCount () const |
Return the number of bad eigenvalues encountered. | |
void | initCache (bool forceRecalc=false) |
Initialize the cache. |
Static Public Member Functions | |
static size_t | userSize2FieldSize (size_t size, double R) |
Get the required field size for the given usable user size and R. | |
static size_t | fieldSize2UserSize (size_t size, double R) |
Map the field dimension into the resulting usable fBm field dimension. | |
static double | getRForH (double H, double Rhint=-1) |
Get the precomputed R value for the given H. |
Protected Member Functions | |
void | postProcess (Field &field) |
Postprocessor called after field generation. | |
![]() | |
void | setScaleResult (double f) |
Scale the output values by factor f. |
Stein's fractional Brownian motion context.
Stein [3] defines fBm as a random process Z with a power-law increment variance:
however, the covariance does not match that of a "standard" fBm. Indeed, for Stein it is actually
The FBMSteinContext changes the actual genereated field dimension. However, only part of it, that is the dimension given at construction is usable, the rest is used for the Stein's embedding method and should be ignored.
Definition at line 755 of file libfbm.hpp.
libfbm::FBMSteinContext::FBMSteinContext | ( | double | H, |
size_t | dim, | ||
size_t | size, | ||
double | Rhint = -1 , |
||
bool | mapDim = true |
||
) |
Construct the Stein's FBM context object of size size^dim.
dim | Dimensionality of the field wanted (1D, 2D, 3D, etc.). |
size | Request field of size^dim. |
Rhint | Hint that overrides the self-determined R for H>0.75, ignored for H<=0.75. See [3] for details. |
mapDim | Expand dimension so that the resulting usable field is the size requested. True by default. |
|
virtual |
Covariance function.
Implements libfbm::SGPContext.
void libfbm::FBMSteinContext::disablePostProcessing | ( | ) |
|
static |
Map the field dimension into the resulting usable fBm field dimension.
|
inline |
Get the parameter R described in [3].
Definition at line 775 of file libfbm.hpp.
|
static |
Get the precomputed R value for the given H.
This function is quantized, so is not optimal. Also R depends a bit on the size of the field. This here is conservative. However, it could be it fails for some cases, then you need to provide your own correct R.
|
protectedvirtual |
Postprocessor called after field generation.
This is called automatically by Field::generate().
Reimplemented from libfbm::SGPContext.
|
static |
Get the required field size for the given usable user size and R.
Stein's method [2] requires a larger field to generate a field for the required initial dimensions. This size depends on the chosen R. For H <= 0.75, R is always 1.0. For H > 0.75, R must be increased. It is proven that the methdod works with R=2.0. However, in practice R=1.3 at H=0.999 works just fine.