mod adaptive_newton_cotes;
mod miser;
mod monte_carlo;
mod newton_cotes;
pub use adaptive_newton_cotes::AdaptiveNewtonCotes;
pub use miser::MISER;
pub use monte_carlo::MonteCarlo;
pub use newton_cotes::{Formula, NewtonCotes, DEFAULT_SUBDIVISIONS};
use crate::{MeanVariance, SolverResult};
use rand::{rng, Rng};
pub const DEFAULT_MAXIMUM_CUT_COUNT: usize = 1000;
pub const DEFAULT_SAMPLE_COUNT: usize = 1000;
pub trait OrthotopeRandomIntegrator<V, T> {
fn integrate_with_rng(
&self,
from: V,
to: V,
rng: &mut impl Rng,
) -> SolverResult<MeanVariance<T>>;
fn integrate_to_mean_variance(&self, from: V, to: V) -> SolverResult<MeanVariance<T>> {
self.integrate_with_rng(from, to, &mut rng())
}
fn integrate(&self, from: V, to: V) -> SolverResult<T> {
self.integrate_to_mean_variance(from, to)
.map(|result| result.mean)
}
}