Skip to main content

dreamwell_intelligence/
complex.rs

1// Complex number type — re-exported from dreamwell-math.
2// Eliminates duplicate type. Enables linalg/eigen/matrix_exp interop.
3pub use dreamwell_math::Complex;
4
5#[cfg(test)]
6mod tests {
7    use super::*;
8
9    #[test]
10    fn complex_mul() {
11        let a = Complex::new(1.0, 2.0);
12        let b = Complex::new(3.0, 4.0);
13        let c = a.mul(b);
14        assert!((c.re - (-5.0)).abs() < 1e-6);
15        assert!((c.im - 10.0).abs() < 1e-6);
16    }
17
18    #[test]
19    fn complex_conj_norm() {
20        let a = Complex::new(3.0, 4.0);
21        assert!((a.norm() - 5.0).abs() < 1e-6);
22        let c = a.conj();
23        assert_eq!(c.re, 3.0);
24        assert_eq!(c.im, -4.0);
25    }
26}