NAG Library Routine Document
g05ztf
(field_fracbm_generate)
1
Purpose
g05ztf produces realizations of a fractional Brownian motion, using the circulant embedding method. The square roots of the eigenvalues of the extended covariance matrix (or embedding matrix) need to be input, and can be calculated using
g05znf.
2
Specification
Fortran Interface
Subroutine g05ztf ( |
ns,
s,
m,
xmax,
h,
lam,
rho,
state,
z,
xx,
ifail) |
Integer, Intent (In) | :: |
ns,
s,
m | Integer, Intent (Inout) | :: |
state(*),
ifail | Real (Kind=nag_wp), Intent (In) | :: |
xmax,
h,
lam(m),
rho | Real (Kind=nag_wp), Intent (Out) | :: |
z(ns+1,s),
xx(ns+1) |
|
C Header Interface
#include nagmk26.h
void |
g05ztf_ (
const Integer *ns,
const Integer *s,
const Integer *m,
const double *xmax,
const double *h,
const double lam[],
const double *rho,
Integer state[],
double z[],
double xx[],
Integer *ifail) |
|
3
Description
The routines
g05znf and
g05ztf are used to simulate a fractional Brownian motion process with Hurst argument
over an interval
, using a set of equally spaced points. Fractional Brownian motion itself cannot be simulated directly using this method, since it is not a stationary Gaussian random field; however its increments can be simulated like a stationary Gaussian random field. The circulant embedding method is described in the documentation for
g05znf.
g05ztf takes the square roots of the eigenvalues of the embedding matrix as returned by
g05znf when
, and its size
, as input and outputs
realizations of the fractional Brownian motion in
.
One of the initialization routines
g05kff (for a repeatable sequence if computed sequentially) or
g05kgf (for a non-repeatable sequence) must be called prior to the first call to
g05ztf.
4
References
Dietrich C R and Newsam G N (1997) Fast and exact simulation of stationary Gaussian processes through circulant embedding of the covariance matrix SIAM J. Sci. Comput. 18 1088–1107
Schlather M (1999) Introduction to positive definite functions and to unconditional simulation of random fields Technical Report ST 99–10 Lancaster University
Wood A T A and Chan G (1994) Simulation of stationary Gaussian processes in Journal of Computational and Graphical Statistics 3(4) 409–432
5
Arguments
- 1: – IntegerInput
-
On entry: the number of steps (points) to be generated in realizations of the increments of the fractional Brownian motion. This must be the same value as supplied to
g05znf when calculating the eigenvalues of the embedding matrix.
Note: in the context of fractional Brownian motion,
ns represents the number of
steps from a zero starting state. Realizations returned in
z include this starting state and so
values are returned for each realization.
Constraint:
.
- 2: – IntegerInput
-
On entry: , the number of realizations of the fractional Brownian motion to simulate.
Constraint:
.
- 3: – IntegerInput
-
On entry: the size,
, of the embedding matrix, as returned by
g05zmf or
g05znf.
Constraint:
.
- 4: – Real (Kind=nag_wp)Input
-
On entry: the upper bound for the interval over which the fractional Brownian motion is to be simulated, as input to
g05zmf or
g05znf.
Constraint:
.
- 5: – Real (Kind=nag_wp)Input
-
On entry: the Hurst parameter,
, for the fractional Brownian motion. This must be the same value as supplied to
g05znf in
, when the eigenvalues of the embedding matrix were calculated.
Constraint:
.
- 6: – Real (Kind=nag_wp) arrayInput
-
On entry: contains the square roots of the eigenvalues of the embedding matrix, as returned by
g05zmf or
g05znf.
Constraint:
, for .
- 7: – Real (Kind=nag_wp)Input
-
On entry: indicates the scaling of the covariance matrix, as returned by
g05zmf or
g05znf.
Constraint:
.
- 8: – Integer arrayCommunication Array
-
Note: the actual argument supplied
must be the array
state supplied to the initialization routines
g05kff or
g05kgf.
On entry: contains information on the selected base generator and its current state.
On exit: contains updated information on the state of the generator.
- 9: – Real (Kind=nag_wp) arrayOutput
-
On exit: contains the realizations of the fractional Brownian motion, .
The th realization, for the th point , is stored in , for and .
- 10: – Real (Kind=nag_wp) arrayOutput
-
On exit: the points at which values of the fractional Brownian motion are output. The first point is always zero, and the subsequent
ns points represent the equispaced steps towards the last point,
xmax. Note that in
g05zmf and
g05znf, the returned
ns sample points are the mid-points of the grid returned in
xx here.
- 11: – IntegerInput/Output
-
On entry:
ifail must be set to
,
. If you are unfamiliar with this argument you should refer to
Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this argument, the recommended value is
.
When the value is used it is essential to test the value of ifail on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6
Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
Errors or warnings detected by the routine:
-
On entry, .
Constraint: .
-
On entry, .
Constraint: .
-
On entry, , and .
Constraint: .
-
On entry, .
Constraint: .
-
On entry, .
Constraint: .
-
On entry, at least one element of
lam was negative.
Constraint: all elements of
lam must be non-negative.
-
On entry, .
Constraint: .
-
On entry,
state vector has been corrupted or not initialized.
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 3.9 in How to Use the NAG Library and its Documentation for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 3.8 in How to Use the NAG Library and its Documentation for further information.
Dynamic memory allocation failed.
See
Section 3.7 in How to Use the NAG Library and its Documentation for further information.
7
Accuracy
Not applicable.
8
Parallelism and Performance
g05ztf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
g05ztf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the
X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the
Users' Note for your implementation for any additional implementation-specific information.
None.
10
Example
This example calls
g05ztf to generate
realizations of a fractional Brownian motion over
steps from
to
using eigenvalues generated by
g05znf with
.
10.1
Program Text
Program Text (g05ztfe.f90)
10.2
Program Data
Program Data (g05ztfe.d)
10.3
Program Results
Program Results (g05ztfe.r)