1 // Copyright ©2016 The Gonum Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
10 "gonum.org/v1/gonum/lapack"
13 // Dlanst computes the specified norm of a symmetric tridiagonal matrix A.
14 // The diagonal elements of A are stored in d and the off-diagonal elements
16 func (impl Implementation) Dlanst(norm lapack.MatrixNorm, n int, d, e []float64) float64 {
30 anorm := math.Abs(d[n-1])
31 for i := 0; i < n-1; i++ {
33 if anorm < sum || math.IsNaN(sum) {
37 if anorm < sum || math.IsNaN(sum) {
42 case lapack.MaxColumnSum, lapack.MaxRowSum:
46 anorm := math.Abs(d[0]) + math.Abs(e[0])
47 sum := math.Abs(e[n-2]) + math.Abs(d[n-1])
48 if anorm < sum || math.IsNaN(sum) {
51 for i := 1; i < n-1; i++ {
52 sum := math.Abs(d[i]) + math.Abs(e[i]) + math.Abs(e[i-1])
53 if anorm < sum || math.IsNaN(sum) {
62 scale, sum = impl.Dlassq(n-1, e, 1, scale, sum)
65 scale, sum = impl.Dlassq(n, d, 1, scale, sum)
66 return scale * math.Sqrt(sum)