Skip to content

Axect/GRF_test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gaussian Random Fields (GRF) Generator

This Rust program generates Gaussian Random Fields (GRF) using the circulant embedding method. It allows you to specify the number of samples, nodes, and the kernel window size. The generated GRF is then plotted and saved as an image file.

Requirements

  • Rust programming language
  • rustfft library
  • peroxide library

Usage

To run the program, use the following command:

cargo run -- <num_samples> <num_nodes> <sigma>
  • <num_samples>: The number of samples to generate.
  • <num_nodes>: The number of nodes in each sample.
  • <sigma>: The kernel window size.

Example

Here's an example command to generate 4 samples with 100 nodes each and a kernel window size of 0.1:

cargo run --release -- 4 100 0.1

Output

The program generates a plot of the Gaussian Random Fields and saves it as plot.png in the current directory.

Gaussian Random Fields Plot

Implementation Details

The program uses the circulant embedding method to generate Gaussian Random Fields efficiently. It leverages the Fast Fourier Transform (FFT) from the rustfft library to speed up the computations.

The main steps of the algorithm are:

  1. Generate the x-coordinates using the linspace function.
  2. For each sample, call the grf function to calculate the GRF values.
  3. Generate line styles and colors for each sample.
  4. Create a Plot2D object and insert the GRF values as images.
  5. Set the plot properties such as line styles, colors, labels, and style.
  6. Save the plot as plot.png.

The grf function implements the circulant embedding method to generate the GRF values. It uses the Stationary Gaussian Kernel defined by the k function.

References

  • Chan, Grace., An Effective Method for Simulating Gaussian Random Fields, Proceedings of the statistical Computing section. 1999.

About

Generate Gaussian Random Fields

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages