[−][src]Crate cuba
Rust binding for the Cuba integrator.
Cuba (http://www.feynarts.de/cuba/) is written by Thomas Hahn.
Usage
Create a CubaIntegrator
and supply it with a function of the form
fn test_integrand(x: &[f64], f: &mut [f64], user_data: &mut T) -> i32 { }
where T
can be any type. If you don't want to provide user data,
simply make T
a usize
and provide any number.
Example
extern crate cuba; use cuba::{CubaIntegrator, CubaVerbosity}; #[derive(Debug)] struct TestUserData { f1: f64, f2: f64, } #[inline(always)] fn test_integrand(x: &[f64], f: &mut [f64], user_data: &mut TestUserData) -> i32 { f[0] = (x[0] * x[1]).sin() * user_data.f1; f[1] = (x[1] * x[1]).cos() * user_data.f2; 0 } fn main() { let mut ci = CubaIntegrator::new(test_integrand); ci.set_mineval(10).set_maxeval(10000); let r = ci.vegas( 2, 2, CubaVerbosity::Progress, TestUserData { f1: 5., f2: 7. }, ); println!("{:#?}", r); }
Structs
CubaIntegrator | A Cuba integrator. It should be created with an integrand function. |
CubaResult | The result of an integration with Cuba. |
Enums
CubaVerbosity | Logging level. |
Type Definitions
Integrand | Integrand evaluation function. |