|
@@ -39,6 +39,12 @@ impl<T: Clone + Num> Complex<T> {
|
|
|
Complex { re: re, im: im }
|
|
|
}
|
|
|
|
|
|
+ /// Returns imaginary unit
|
|
|
+ #[inline]
|
|
|
+ pub fn i() -> Complex<T> {
|
|
|
+ Self::new(T::zero(), T::one())
|
|
|
+ }
|
|
|
+
|
|
|
/// Returns the square of the norm (since `T` doesn't necessarily
|
|
|
/// have a sqrt function), i.e. `re^2 + im^2`.
|
|
|
#[inline]
|
|
@@ -59,14 +65,6 @@ impl<T: Clone + Num> Complex<T> {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-impl<T: Clone + Num> Complex<T> {
|
|
|
- /// Returns `i`
|
|
|
- #[inline]
|
|
|
- pub fn i() -> Complex<T> {
|
|
|
- Self::new(T::zero(), T::one())
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
impl<T: Clone + Num + Neg<Output = T>> Complex<T> {
|
|
|
/// Returns the complex conjugate. i.e. `re - i im`
|
|
|
#[inline]
|