1 // Copyright ©2015 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/blas"
11 "gonum.org/v1/gonum/blas/blas64"
14 // Dpocon estimates the reciprocal of the condition number of a positive-definite
15 // matrix A given the Cholesky decomposition of A. The condition number computed
16 // is based on the 1-norm and the ∞-norm.
18 // anorm is the 1-norm and the ∞-norm of the original matrix A.
20 // work is a temporary data slice of length at least 3*n and Dpocon will panic otherwise.
22 // iwork is a temporary data slice of length at least n and Dpocon will panic otherwise.
23 func (impl Implementation) Dpocon(uplo blas.Uplo, n int, a []float64, lda int, anorm float64, work []float64, iwork []int) float64 {
24 checkMatrix(n, n, a, lda)
25 if uplo != blas.Upper && uplo != blas.Lower {
42 bi := blas64.Implementation()
45 upper := uplo == blas.Upper
51 ainvnm, kase = impl.Dlacn2(n, work[n:], work, iwork, ainvnm, kase, isave)
54 rcond = (1 / ainvnm) / anorm
59 sl = impl.Dlatrs(blas.Upper, blas.Trans, blas.NonUnit, normin, n, a, lda, work, work[2*n:])
61 su = impl.Dlatrs(blas.Upper, blas.NoTrans, blas.NonUnit, normin, n, a, lda, work, work[2*n:])
63 sl = impl.Dlatrs(blas.Lower, blas.NoTrans, blas.NonUnit, normin, n, a, lda, work, work[2*n:])
65 su = impl.Dlatrs(blas.Lower, blas.Trans, blas.NonUnit, normin, n, a, lda, work, work[2*n:])
69 ix := bi.Idamax(n, work, 1)
70 if scale == 0 || scale < math.Abs(work[ix])*smlnum {
73 impl.Drscl(n, scale, work, 1)