use crate::sde::ManifoldSDE;
use cartan_core::Manifold;
pub fn brownian_motion_on_with_diffusion<M, G>(
manifold: M,
diffusion_gen: G,
) -> ManifoldSDE<
M,
impl Fn(&M::Point, f64) -> M::Tangent + Send + Sync,
G,
>
where
M: Manifold + Clone + Send + Sync,
M::Point: Clone + Send + Sync,
M::Tangent: Clone + Default + Send + Sync,
G: Fn(&M::Point, f64) -> M::Tangent + Send + Sync,
{
ManifoldSDE::new(
manifold,
|_x: &M::Point, _t: f64| M::Tangent::default(),
diffusion_gen,
)
}
pub fn ou_on_with_diffusion<M, G>(
manifold: M,
kappa: f64,
mu_point: M::Point,
diffusion: G,
) -> ManifoldSDE<
M,
impl Fn(&M::Point, f64) -> M::Tangent + Send + Sync,
G,
>
where
M: Manifold + Clone + Send + Sync,
M::Point: Clone + Send + Sync,
M::Tangent: Clone + Default + std::ops::Mul<f64, Output = M::Tangent> + Send + Sync,
G: Fn(&M::Point, f64) -> M::Tangent + Send + Sync,
{
let mu_clone = mu_point.clone();
let manifold_clone = manifold.clone();
ManifoldSDE::new(
manifold,
move |x: &M::Point, _t: f64| -> M::Tangent {
manifold_clone
.log(x, &mu_clone)
.map(|v| v * kappa)
.unwrap_or_default()
},
diffusion,
)
}
#[deprecated(note = "Use brownian_motion_on_with_diffusion; generic Manifold has no frame field")]
#[allow(clippy::type_complexity)]
pub fn brownian_motion_on<M: Manifold + Clone>(
manifold: M,
) -> ManifoldSDE<
M,
impl Fn(&M::Point, f64) -> M::Tangent + Send + Sync,
impl Fn(&M::Point, f64) -> M::Tangent + Send + Sync,
>
where
M::Tangent: Clone + Default,
{
ManifoldSDE::new(
manifold,
|_x: &M::Point, _t: f64| M::Tangent::default(),
|_x: &M::Point, _t: f64| -> M::Tangent {
panic!("brownian_motion_on: provide explicit diffusion via brownian_motion_on_with_diffusion")
},
)
}