# CORRELATION Examples of Correlation Functions

CORRELATION is a C++ library which contains examples of statistical correlation functions.

The (nonstationary) correlation function c(s,t) must satisfy the following properties:

1. -1 ≤ c(s,t) ≤ +1;
2. c(s,t) = c(t,s);
3. c(s,s) = 1;

Most of the correlation functions considered here determine the correlation of two random values y(x1) and y(x2), depending only on distance, that is, on the norm ||x1-x2||, which we will denote by "r". Such correlation functions are called "stationary".

The stationary correlation function c(r) must satisfy the following properties:

1. -1 ≤ c(r) ≤ +1;
2. c(0) = 1;

It is often the case that a typical scale length "r0" is specified, called the "correlation length". In that case, the correlation function may be expressed in terms of the normalized distance r/r0.

Because correlation functions model physical situations, it is usually the case that the correlation function will smoothly and steadily decrease to 0 with r, or that it will oscillate between positive and negative values, with an amplitude that is steadily decreasing. One of the most popular correlation functions is the gaussian correlation, which has many desirable statistical and mathematical properties.

Correlation functions available include:

### Languages:

CORRELATION is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version.

### Related Data and Programs:

BROWNIAN_MOTION_SIMULATION, a C++ program which simulates Brownian motion in an M-dimensional region.

COLORED_NOISE, a C++ library which generates samples of noise obeying a 1/f^alpha power law.

GNUPLOT, examples which illustrate the use of the gnuplot graphics program.

PINK_NOISE, a C++ library which computes a pink noise signal obeying a 1/f power law.

SDE, a C++ library which illustrates the properties of stochastic differential equations (SDE's), and common algorithms for their analysis, by Desmond Higham;

### Reference:

1. Petter Abrahamsen,
A Review of Gaussian Random Fields and Correlation Functions,
Norwegian Computing Center, 1997.

### List of Routines:

• CORRELATION_BROWNIAN computes the Brownian correlation function.
• CORRELATION_BESSELJ evaluates the Bessel J correlation function.
• CORRELATION_BESSELK evaluates the Bessel K correlation function.
• CORRELATION_BROWNIAN_DISPLAY displays 4 slices of the Brownian Correlation.
• CORRELATION_CIRCULAR evaluates the circular correlation function.
• CORRELATION_CONSTANT evaluates the constant correlation function.
• CORRELATION_COSINE_DAMPED evaluates the damped cosine correlation function.
• CORRELATION_CUBIC evaluates the cubic correlation function.
• CORRELATION_DAMPED_COSINE evaluates the damped cosine correlation function.
• CORRELATION_DAMPED_SINE evaluates the damped sine correlation function.
• CORRELATION_EXPONENTIAL evaluates the exponential correlation function.
• CORRELATION_GAUSSIAN evaluates the Gaussian correlation function.
• CORRELATION_HOLE evaluates the hole correlation function.
• CORRELATION_LINEAR evaluates the linear correlation function.
• CORRELATION_MATERN evaluates the Matern correlation function.
• CORRELATION_PENTASPHERICAL evaluates the pentaspherical correlation function.
• CORRELATION_POWER evaluates the power correlation function.
• CORRELATION_SINE_DAMPED evaluates the damped sine correlation function.
• CORRELATION_SPHERICAL evaluates the spherical correlation function.
• CORRELATION_TO_COVARIANCE: covariance matrix from a correlation matrix.
• CORRELATION_WHITE_NOISE evaluates the white noise correlation function.
• COVARIANCE_TO_CORRELATION: correlation matrix from a covariance matrix.
• I4_WRAP forces an I4 to lie between given limits by wrapping.
• MINIJ returns the MINIJ matrix.
• R8_B0MP evaluates the modulus and phase for the Bessel J0 and Y0 functions.
• R8_BESI1 evaluates the Bessel function I of order 1 of an R8 argument.
• R8_BESI1E evaluates the exponentially scaled Bessel function I1(X).
• R8_BESJ0 evaluates the Bessel function J of order 0 of an R8 argument.
• R8_BESK evaluates the Bessel function K of order NU of an R8 argument.
• R8_BESK1 evaluates the Bessel function K of order 1 of an R8 argument.
• R8_BESK1E evaluates the exponentially scaled Bessel function K1(X).
• R8_BESKES: a sequence of exponentially scaled K Bessel functions at X.
• R8_BESKS evaluates a sequence of K Bessel functions at X.
• R8_CSEVL evaluates a Chebyshev series.
• R8_GAML evaluates bounds for an R8 argument of the gamma function.
• R8_GAMMA evaluates the gamma function of an R8 argument.
• R8_INITS initializes a Chebyshev series.
• R8_KNUS computes a sequence of K Bessel functions.
• R8_LGMC evaluates the log gamma correction factor for an R8 argument.
• R8_MACH returns real ( kind = 8 ) real machine-dependent constants.
• R8_UNIFORM_01 returns a unit pseudorandom R8.
• R8MAT_CHOLESKY_FACTOR computes the Cholesky factor of a symmetric matrix.
• R8MAT_IS_SYMMETRIC checks an R8MAT for symmetry.
• R8MAT_PRINT prints an R8MAT.
• R8MAT_PRINT_SOME prints some of an R8MAT.
• R8VEC_LINSPACE creates a vector of linearly spaced values.
• R8VEC_NORMAL_01 returns a unit pseudonormal R8VEC.
• R8VEC_PRINT prints an R8VEC.
• R8VEC_UNIFORM_01 returns a unit pseudorandom R8VEC.
• SAMPLE_PATH_CHOLESKY computes a sample path for a correlation function.
• SAMPLE_PATH_EIGEN computes a sample path for a correlation function.
• TIMESTAMP prints the current YMDHMS date as a time stamp.
• TQL2 computes all eigenvalues/vectors, real symmetric tridiagonal matrix.
• TRED2 transforms a real symmetric matrix to symmetric tridiagonal form.

You can go up one level to the C++ source codes.