mirror of
https://github.com/gonum/gonum.git
synced 2025-10-10 09:30:13 +08:00
lapack/testlapack: add dlanst
This commit is contained in:

committed by
Vladimír Chalupecký

parent
3462e90a5a
commit
55edfc1d26
@@ -10,6 +10,8 @@ import (
|
||||
"testing"
|
||||
|
||||
"golang.org/x/exp/rand"
|
||||
|
||||
"gonum.org/v1/gonum/lapack"
|
||||
)
|
||||
|
||||
type Dpttrfer interface {
|
||||
@@ -75,19 +77,18 @@ func dpttrfResidual(n int, d, e, dFac, eFac []float64) float64 {
|
||||
}
|
||||
|
||||
// Compute the 1-norm of the difference L*D*Lᵀ - A.
|
||||
var anorm, resid float64
|
||||
var resid float64
|
||||
if n == 1 {
|
||||
anorm = d[0]
|
||||
resid = math.Abs(dDiff[0])
|
||||
} else {
|
||||
anorm = math.Max(d[0]+math.Abs(e[0]), d[n-1]+math.Abs(e[n-2]))
|
||||
resid = math.Max(math.Abs(dDiff[0])+math.Abs(eDiff[0]), math.Abs(dDiff[n-1])+math.Abs(eDiff[n-2]))
|
||||
for i := 1; i < n-1; i++ {
|
||||
anorm = math.Max(anorm, d[i]+math.Abs(e[i])+math.Abs(e[i-1]))
|
||||
resid = math.Max(resid, math.Abs(dDiff[i])+math.Abs(eDiff[i-1])+math.Abs(eDiff[i]))
|
||||
}
|
||||
}
|
||||
|
||||
anorm := dlanst(lapack.MaxColumnSum, n, d, e)
|
||||
|
||||
// Compute norm(L*D*Lᵀ - A)/(n * norm(A)).
|
||||
if anorm == 0 {
|
||||
if resid != 0 {
|
||||
|
Reference in New Issue
Block a user