Rugfield
Rugfield is a Rust library for generating Gaussian Random Fields (GRFs) using the circulant embedding method. It provides an efficient and easy-to-use implementation for simulating GRFs with various kernel functions.
Features
- Generate GRFs using the circulant embedding method
- Support for various kernels.
SquaredExponentialMaternLocalPeriodicRationalQuadratic
- Efficient computation using the
rustfftlibrary - Optional serialization support with the
serdefeature
Installation
Add the following to your Cargo.toml file:
[]
= "0.2.2"
Usage
Here's a simple example of how to use Rugfield to generate a GRF with a squared exponential kernel:
use ;
This code generates a GRF with a squared exponential kernel and a length scale of 0.1. The resulting GRF data is stored in the grf_data vector.
For a complete example, see the examples/squared_exponential.rs file:
use *;
use ;
With a specific random number generator:
use *;
use ;
The above code generates multiple GRFs with a squared exponential kernel and plots the resulting data. Here's an example output:

Documentation
For detailed documentation and API reference, please refer to the Rustdoc documentation.
License
Rugfield is licensed under the MIT License.
Contributing
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.
Acknowledgments
Rugfield was inspired by the paper "An Effective Method for Simulating Gaussian Random Fields" by Grace Chan (1999).
We would like to express our gratitude to the authors of the rustfft library for their excellent work, which has been instrumental in the development of Rugfield.