diff --git a/lib/matrix.rb b/lib/matrix.rb index 026492b..81492ef 100644 --- a/lib/matrix.rb +++ b/lib/matrix.rb @@ -1274,31 +1274,31 @@ class Matrix alias conj conjugate # - # Returns the imaginary part of the matrix. + # Returns the real part of the matrix. # Matrix[[Complex(1,2), Complex(0,1), 0], [1, 2, 3]] # => 1+2i i 0 # 1 2 3 - # Matrix[[Complex(1,2), Complex(0,1), 0], [1, 2, 3]].imaginary - # => 2i i 0 - # 0 0 0 + # Matrix[[Complex(1,2), Complex(0,1), 0], [1, 2, 3]].real + # => 1 0 0 + # 1 2 3 # - def imaginary - collect(&:imaginary) + def real + collect(&:real) end - alias imag imaginary # - # Returns the real part of the matrix. + # Returns the imaginary part of the matrix. # Matrix[[Complex(1,2), Complex(0,1), 0], [1, 2, 3]] # => 1+2i i 0 # 1 2 3 - # Matrix[[Complex(1,2), Complex(0,1), 0], [1, 2, 3]].real - # => 1 0 0 - # 1 2 3 + # Matrix[[Complex(1,2), Complex(0,1), 0], [1, 2, 3]].imaginary + # => 2i i 0 + # 0 0 0 # - def real - collect(&:real) + def imaginary + collect(&:imaginary) end + alias imag imaginary # # Returns an array containing matrices corresponding to the real and imaginary