series/
ops.rs

1/// Traits for common functions
2
3/// Trait for the natural logarithm
4pub trait Ln {
5    type Output;
6
7    fn ln(self) -> Self::Output;
8}
9
10impl Ln for f64 {
11    type Output = f64;
12
13    fn ln(self) -> Self::Output {
14        <f64>::ln(self)
15    }
16}
17
18impl<'a> Ln for &'a f64 {
19    type Output = f64;
20
21    fn ln(self) -> Self::Output {
22        (*self).ln()
23    }
24}
25
26impl Ln for f32 {
27    type Output = f32;
28
29    fn ln(self) -> Self::Output {
30        <f32>::ln(self)
31    }
32}
33
34impl<'a> Ln for &'a f32 {
35    type Output = f32;
36
37    fn ln(self) -> Self::Output {
38        (*self).ln()
39    }
40}
41
42/// Trait for the exponential function
43pub trait Exp {
44    type Output;
45
46    fn exp(self) -> Self::Output;
47}
48
49impl Exp for f64 {
50    type Output = Self;
51
52    fn exp(self) -> Self::Output {
53        <f64>::exp(self)
54    }
55}
56
57impl<'a> Exp for &'a f64 {
58    type Output = f64;
59
60    fn exp(self) -> Self::Output {
61        (*self).exp()
62    }
63}
64
65impl Exp for f32 {
66    type Output = Self;
67
68    fn exp(self) -> Self::Output {
69        <f32>::exp(self)
70    }
71}
72
73impl<'a> Exp for &'a f32 {
74    type Output = f32;
75
76    fn exp(self) -> Self::Output {
77        (*self).exp()
78    }
79}
80
81pub use num_traits::Pow;