Feature #10058 » reorder_Matrix#real_and_Matrix_imaginary.patch
| lib/matrix.rb | ||
|---|---|---|
|
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
|
||