How to generate a one-dimensional random noise with any correlation function g(z)?

The basic usage of Correlated random noise generator to generate a one-dimensional random isotropic correlated noise in a domain of N points and total length N delta is employed in corr.cpp and overviewed in what follows:
* Header disorder.h should be included at the preamble, #include <disorder.h>.
* The parameters to be defined are N (of type int, number of discretization points of the region in which noise will be defined), delta (of type double, discretization length) and seed (of type int, seed for the random number generator).
* The variables are g(z) (array of N doubles that stores the values of the correlation function at the discretization points) and V(z) (array of N doubles that stores the noise values at the discretization points).
* The correlation function g(z) should be defined and evaluated at the N/2+1 points of the space, g(z)=g(i·delta), i=0,N/2.
* The function disorder_1d() should be called. Its arguments are N, delta, seed, g(i·delta) and V(i·delta). The former is where the random noise is saved.
* The code must be linked with the Correlated random noise generator library as well as with the fftw3 and CBLAS. On Unix systems, link with -lgsl -lgslcblas -lfftw3 -lm.

How to generate a two-dimensional random noise with any correlation function g(z)?

Generation of a two-dimensional random isotropic correlated noise in a domain of N·N points and (N·delta)^2 surface is analogous to the unidimensional case. Again, corr.cpp includes an example of how to generate such noise applying the library Correlated random noise generator.
* Header disorder.h should be included at the preamble, #include <disorder.h>.
* The parameters to be defined are N (of type int, number of discretization points along each of the two perpendicular directions of the space in which noise will be defined), delta (of type double, discretization length along both directions) and seed (of type int, seed for the random number generator).
* The variables are g(z) (array of N·(N+2) doubles that stores the values of the correlation function at the discretization points) and V(z) (array of N·(N+2) doubles that stores the noise values at the discretization points).
* The correlation function g(z) should be defined and evaluated at the (N/2+1)^2 points of the space, g(z)=g(i·delta,j·delta), i=0,N/2, j=0,N/2.
* The function disorder_2d() should be called. Its arguments are N, delta, seed, g(i·delta, j·delta) and V(i·delta, j·delta). The former is where the random noise is saved.
* The code must be linked with the Correlated random noise generator library as well as with the fftw3 and CBLAS. On Unix systems, link with -lgsl -lgslcblas -lfftw3 -lm.

 

Last edit: Marc Suñé Simon 2013-10-29