inv_vec

Function inv_vec 

Source
pub fn inv_vec(x: &[f64]) -> Vec<f64>
Expand description

§inv_vec(x)

Native Function

The inv_vec function takes a slice of floating-point numbers x and returns a new vector containing the inverses of each element in x

§Examples

use mathlab::math::{inv, inv_vec, INF_F64, INF_F32, fround_vec};
assert_eq!(inv(0.0), INF_F64);
assert_eq!(inv(0.1), 10.0);
assert_eq!(inv_vec(&[0.0, 0.1, 0.2, 0.3]), [INF_F64, 10.0, 5.0, 3.3333333333333335]);
assert_eq!(fround_vec(&inv_vec(&[0.0, 0.1, 0.2, 0.3])), [INF_F32, 10.0, 5.0, 3.3333333]);
assert_eq!(fround_vec(&inv_vec(&[0.0, 0.1, 0.2, 0.3])), [INF_F32, 10.0, 5.0, 3.3333333333333335]);

End Fun Doc