libfbm  0.1
Simulation of multi-dimensional stationary Gaussian processes and fractional Brownian motion.
 All Classes Namespaces Functions Friends
Public Member Functions | Static Public Member Functions | Protected Member Functions
libfbm::FBMSteinContext Class Reference

Stein's fractional Brownian motion context. More...

#include <libfbm.hpp>

Inheritance diagram for libfbm::FBMSteinContext:
libfbm::SGPContext

List of all members.

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].
- Public Member Functions inherited from libfbm::SGPContext
 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.
RandomGeneratorgetRandomGenerator ()
const zvecgetDim () const
 Get the usable dimension of the generated field.
const zvecgetFieldDim () 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.
- Protected Member Functions inherited from libfbm::SGPContext
void setScaleResult (double f)
 Scale the output values by factor f.

Detailed Description

Stein's fractional Brownian motion context.

Stein [3] defines fBm as a random process Z with a power-law increment variance:

\[ \mbox{Var}\!\left(\left| Z\!\left(\mathbf{x}\right)-Z\!\left(\mathbf{y}\right)\right|^2\right)\propto\left|\mathbf{x}-\mathbf{y}\right|^{2H}, \]

however, the covariance does not match that of a "standard" fBm. Indeed, for Stein it is actually

\[ \mbox{Cov}\!\left(Z\!\left(\mathbf{x}\right),Z\!\left(\mathbf{y}\right)\right)=c0-\left|\mathbf{x}-\mathbf{y}\right|^{2H}+c_2\left(\left|\mathbf{x}\right|^2+\left|\mathbf{y}^2\right|\right). \]

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.


Constructor & Destructor Documentation

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.

Parameters:
dimDimensionality of the field wanted (1D, 2D, 3D, etc.).
sizeRequest field of size^dim.
RhintHint that overrides the self-determined R for H>0.75, ignored for H<=0.75. See [3] for details.
mapDimExpand dimension so that the resulting usable field is the size requested. True by default.

Member Function Documentation

double libfbm::FBMSteinContext::cov ( const zvec p)
virtual

Covariance function.

Implements libfbm::SGPContext.

void libfbm::FBMSteinContext::disablePostProcessing ( )
static size_t libfbm::FBMSteinContext::fieldSize2UserSize ( size_t  size,
double  R 
)
static

Map the field dimension into the resulting usable fBm field dimension.

double libfbm::FBMSteinContext::getR ( ) const
inline

Get the parameter R described in [3].

Definition at line 775 of file libfbm.hpp.

static double libfbm::FBMSteinContext::getRForH ( double  H,
double  Rhint = -1 
)
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.

void libfbm::FBMSteinContext::postProcess ( Field field)
protectedvirtual

Postprocessor called after field generation.

This is called automatically by Field::generate().

Reimplemented from libfbm::SGPContext.

static size_t libfbm::FBMSteinContext::userSize2FieldSize ( size_t  size,
double  R 
)
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.


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