complex_algebra 0.1.8

A crate supporting complex number algebra
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use super::c;

pub trait Cos<T: Copy + PartialEq> {
    fn cos(z: c<T>) -> c<T>;
}

#[macro_export]
macro_rules! cos_macro {
    ($T:tt) => {
        impl Cos<$T> for c<$T> {
            fn cos(z: c<$T>) -> c<$T> {
                c(0.5, 0.0) * (c::exp(c(0.0, 1.0) * z) + c::exp(c(0.0, -1.0) * z))
            }
        }
    };
}