Browse Source

Fix docs and function position

Łukasz Jan Niemier 9 years ago
parent
commit
8e267ee4cb
1 changed files with 6 additions and 8 deletions
  1. 6 8
      src/complex.rs

+ 6 - 8
src/complex.rs

@@ -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]