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
29
use array::Array;
use std::f64::consts::E;
impl<T> Array<T> where T: Copy + Into<f64> {
#[inline]
pub fn log(&self, base: f64) -> Array<f64> {
return super::apply(&self, |value: &T| f64::log(value.clone().into(), base));
}
#[inline]
pub fn log2(&self) -> Array<f64> {
return super::apply(&self, |value: &T| f64::log2(value.clone().into()));
}
#[inline]
pub fn log10(&self) -> Array<f64> {
return super::apply(&self, |value: &T| f64::log10(value.clone().into()));
}
#[inline]
pub fn loge(&self) -> Array<f64> {
return self.log(E);
}
}