[][src]Crate cauchy

Scalar trait, which generalizes complex and real number.

Examples

fn add_int<A: Scalar>(a: A) -> A {
    a + A::from(1).unwrap()  // A::from is inhereted from num_traits::NumCast
}
fn add_float<A: Scalar>(a: A) -> A {
    a + A::from(1.0).unwrap()
}
fn add_real<A: Scalar>(a: A) -> A::Real {
    a.re() + A::real(1.0)
}
fn add_complex<A: Scalar>(a: A) -> A::Complex {
    a.as_c() + A::complex(1.0, 1.0)
}

Traits

Scalar

Type Definitions

c32
c64