1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
use num_complex::Complex; use num_traits::Float; /// exponential function pub trait Exponential: Clone + Copy + Sized { fn exp(self) -> Self; } impl Exponential for f32 { fn exp(self) -> Self { <Self>::exp(self) } } impl Exponential for f64 { fn exp(self) -> Self { <Self>::exp(self) } } impl<T> Exponential for Complex<T> where T: Clone + Float { fn exp(self) -> Self { <Complex<T>>::exp(&self) } }