Example #1
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
}
Example #2
0
// Compute matrix product C = A * B where A is m*p and B is p*n.
// Returns a new m*n matrix.
func Times(A, B *matrix.ComplexMatrix) *matrix.ComplexMatrix {
	if A.Cols() != B.Rows() {
		return nil
	}
	return A.Times(B)
}