Function summator

Source
pub fn summator(
    cov_samples: ArrayView2<'_, f64>,
    z1: ArrayView1<'_, f64>,
    z2: ArrayView1<'_, f64>,
    pos: ArrayView2<'_, f64>,
    num_threads: Option<usize>,
) -> Array1<f64>
Expand description

The randomization method for scalar fields.

Computes the isotropic spatial random field $u(x)$ by the randomization method according to $$ u(x) = \sum_{i=1}^N (z_{1,i} \cdot \cos(\langle k_i, x \rangle) + z_{2,i} \cdot \sin(\langle k_i, x \rangle)) $$ with

  • $N$ being the number of Fourier modes
  • $z_1, z_2$ being independent samples from a standard normal distribution
  • $k$ being the samples from the spectral density distribution of the covariance model and are given by the argument cov_samples.

§Arguments

  • cov_samples - the samples from the spectral density distribution of the covariance model
         dim = (spatial dim. of field $d$, Fourier modes $N$)
  • z1 - independent samples from a standard normal distribution
        dim = Fourier modes $N$
  • z2 - independent samples from a standard normal distribution
        dim = Fourier modes $N$
  • pos - the position $x$ where the spatial random field is calculated
        dim = (spatial dim. of field $d$, no. of spatial points where field is calculated $j$)
  • num_threads - the number of parallel threads used, if None, use rayon’s default

§Returns

  • summed_modes - the isotropic spatial field
        dim = no. of spatial points where field is calculated $j$