mirror of
https://github.com/gonum/gonum.git
synced 2025-11-02 11:24:13 +08:00
lapack/testlapack: use isOrthogonal in Dsytd2
This commit is contained in:
committed by
Vladimír Chalupecký
parent
ac556fa015
commit
22345aeeda
@@ -117,27 +117,9 @@ func Dsytd2Test(t *testing.T, impl Dsytd2er) {
|
|||||||
blas64.Gemm(blas.NoTrans, blas.NoTrans, 1, qCopy, hMat, 0, qMat)
|
blas64.Gemm(blas.NoTrans, blas.NoTrans, 1, qCopy, hMat, 0, qMat)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check that Q is orthonormal
|
|
||||||
othonormal := true
|
if !isOrthogonal(qMat) {
|
||||||
for i := 0; i < n; i++ {
|
t.Errorf("Q not orthogonal")
|
||||||
for j := i; j < n; j++ {
|
|
||||||
dot := blas64.Dot(n,
|
|
||||||
blas64.Vector{Inc: 1, Data: qMat.Data[i*qMat.Stride:]},
|
|
||||||
blas64.Vector{Inc: 1, Data: qMat.Data[j*qMat.Stride:]},
|
|
||||||
)
|
|
||||||
if i == j {
|
|
||||||
if math.Abs(dot-1) > 1e-10 {
|
|
||||||
othonormal = false
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if math.Abs(dot) > 1e-10 {
|
|
||||||
othonormal = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !othonormal {
|
|
||||||
t.Errorf("Q not orthonormal")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute Q^T * A * Q.
|
// Compute Q^T * A * Q.
|
||||||
|
|||||||
Reference in New Issue
Block a user