lapack/testlapack: change isIdentity to distFromIdentity

This commit is contained in:
Vladimir Chalupecky
2019-01-17 14:56:40 +01:00
committed by Vladimír Chalupecký
parent 54df3f38fd
commit 08d9e7ed28
7 changed files with 33 additions and 28 deletions

View File

@@ -147,9 +147,10 @@ func Dtrti2Test(t *testing.T, impl Dtrti2er) {
// Compute A^{-1} * A and store the result in ans.
ans := make([]float64, len(a))
bi.Dgemm(blas.NoTrans, blas.NoTrans, n, n, n, 1, a, lda, aCopy, lda, 0, ans, lda)
// Check that ans is the identity matrix.
if !isIdentity(n, ans, lda, tol) {
t.Errorf("inv(A) * A != I. Upper = %v, unit = %v, ans = %v", uplo == blas.Upper, diag == blas.Unit, ans)
// Check that ans is close to the identity matrix.
dist := distFromIdentity(n, ans, lda)
if dist > tol {
t.Errorf("|inv(A) * A - I| = %v. Upper = %v, unit = %v, ans = %v", dist, uplo == blas.Upper, diag == blas.Unit, ans)
}
}
}