// 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 }
// 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 }
// See function Asum. func AsumComplex(X *matrix.ComplexMatrix, opts ...linalg.Option) (v float64, err error) { v = 0.0 ind := linalg.GetIndexOpts(opts...) err = check_level1_func(ind, fasum, X, nil) if err != nil { return } if ind.Nx == 0 { return } Xa := X.ComplexArray() v = dzasum(ind.Nx, Xa[ind.OffsetX:], ind.IncX) return }
// See function Dotc. func DotcComplex(X, Y *matrix.ComplexMatrix, opts ...linalg.Option) (v complex128, err error) { v = 0.0 ind := linalg.GetIndexOpts(opts...) err = check_level1_func(ind, fdot, X, Y) if err != nil { return } if ind.Nx == 0 { return } Xa := X.ComplexArray() Ya := Y.ComplexArray() v = zdotc(ind.Nx, Xa[ind.OffsetX:], ind.IncX, Ya[ind.OffsetY:], ind.IncY) return }