Пример #1
0
func rowDiffs(A, B *matrix.FloatMatrix) *matrix.FloatMatrix {
	var r matrix.FloatMatrix
	nrm := matrix.FloatZeros(A.Rows(), 1)
	A0 := A.Copy()
	A0.Minus(B)
	for k := 0; k < A.Rows(); k++ {
		A0.SubMatrix(&r, k, 0, 1, A.Cols())
		nrm.SetAt(k, 0, matops.Norm2(&r))
	}
	return nrm
}
Пример #2
0
func columnDiffs(A, B *matrix.FloatMatrix) *matrix.FloatMatrix {
	var c matrix.FloatMatrix
	nrm := matrix.FloatZeros(A.Cols(), 1)
	A0 := A.Copy()
	A0.Minus(B)
	for k := 0; k < A.Cols(); k++ {
		A0.SubMatrix(&c, 0, k, A.Rows(), 1)
		nrm.SetAt(k, 0, matops.Norm2(&c))
	}
	return nrm
}