Example #1
0
// Return Imag(A).
func Imag(A *matrix.ComplexMatrix) *matrix.FloatMatrix {
	C := matrix.FloatZeros(A.Size())
	Ar := A.ComplexArray()
	Cr := C.FloatArray()
	for i, v := range Ar {
		Cr[i] = imag(v)
	}
	return C
}
Example #2
0
// Compute Abs(A), Returns a new float valued matrix.
func Abs(A *matrix.ComplexMatrix) *matrix.FloatMatrix {
	C := matrix.FloatZeros(A.Rows(), A.Cols())
	Cr := C.FloatArray()
	Ar := A.ComplexArray()
	for k, v := range Ar {
		Cr[k] = cmplx.Abs(v)
	}
	return C
}