[][src]Trait mathru::algebra::abstr::Abs

pub trait Abs {
    fn abs(&self) -> Self;
}

Abs trait

Required methods

fn abs(&self) -> Self

returns the absolute value of a field

Loading content...

Implementations on Foreign Types

impl Abs for f32[src]

impl Abs for f64[src]

Loading content...

Implementors

impl<T> Abs for Complex<T> where
    T: Field + Power
[src]

fn abs(&self) -> Self[src]

Absolute value of the complex number

Example

extern crate mathru;
use mathru::algebra::abstr::{Ring, Abs};
use mathru::num::Complex;
use mathru::algebra::abstr::cast::ToPrimitive;

let a: Complex<f64> = Complex::new(1.0, 2.0);
let refer: f64 = (5.0_f64).sqrt();
assert_eq!(refer, a.abs().to_f64().unwrap());
Loading content...