abels_complex/complex/rectangular.rs
1pub type Complex32 = Complex<f32>;
2pub type Complex64 = Complex<f64>;
3
4/// Creates a complex number in rectangular form.
5#[inline(always)]
6#[must_use]
7pub const fn complex<FT>(re: FT, im: FT) -> Complex<FT> {
8 Complex::new(re, im)
9}
10
11/// A complex number in rectangular form.
12#[derive(Clone, Copy, PartialEq, Debug)]
13#[repr(C)]
14pub struct Complex<FT> {
15 pub re: FT,
16 pub im: FT,
17}
18
19impl<FT> Complex<FT> {
20 /// Creates a complex number.
21 pub const fn new(re: FT, im: FT) -> Self {
22 Self { re, im }
23 }
24}