Skip to content

Commit 6a95e19

Browse files
authored
Merge 0930581 into a20ca94
2 parents a20ca94 + 0930581 commit 6a95e19

File tree

4 files changed

+63
-9
lines changed

4 files changed

+63
-9
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.13
55
require (
66
github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237 // indirect
77
golang.org/x/exp v0.0.0-20190312203227-4b39c73a6495
8-
gonum.org/v1/gonum v0.7.0
8+
gonum.org/v1/gonum v0.8.1
99
modernc.org/cc v1.0.0
1010
modernc.org/golex v1.0.0 // indirect
1111
modernc.org/mathutil v1.0.0 // indirect

go.sum

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGm
2222
golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
2323
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
2424
gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo=
25-
gonum.org/v1/gonum v0.6.2 h1:4r+yNT0+8SWcOkXP+63H2zQbN+USnC73cjGUxnDF94Q=
26-
gonum.org/v1/gonum v0.6.2/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU=
27-
gonum.org/v1/gonum v0.7.0 h1:Hdks0L0hgznZLG9nzXb8vZ0rRvqNvAcgAp84y7Mwkgw=
28-
gonum.org/v1/gonum v0.7.0/go.mod h1:L02bwd0sqlsvRv41G7wGWFCsVNZFv/k1xzGIxeANHGM=
25+
gonum.org/v1/gonum v0.8.1 h1:wGtP3yGpc5mCLOLeTeBdjeui9oZSz5De0eOjMLC/QuQ=
26+
gonum.org/v1/gonum v0.8.1/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0=
2927
gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw=
3028
gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc=
3129
modernc.org/cc v1.0.0 h1:nPibNuDEx6tvYrUAtvDTTw98rx5juGsa5zuDnKwEEQQ=

lapack/netlib/lapack.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,54 @@ func (impl Implementation) Dlaswp(n int, a []float64, lda, k1, k2 int, ipiv []in
794794
lapacke.Dlaswp(n, a, lda, k1+1, k2+1, ipiv32, incX)
795795
}
796796

797+
// Dpbcon returns an estimate of the reciprocal of the condition number (in the
798+
// 1-norm) of an n×n symmetric positive definite band matrix using the Cholesky
799+
// factorization
800+
// A = Uᵀ*U if uplo == blas.Upper
801+
// A = L*Lᵀ if uplo == blas.Lower
802+
// computed by Dpbtrf. The estimate is obtained for norm(inv(A)), and the
803+
// reciprocal of the condition number is computed as
804+
// rcond = 1 / (anorm * norm(inv(A))).
805+
//
806+
// The length of work must be at least 3*n and the length of iwork must be at
807+
// least n.
808+
func (impl Implementation) Dpbcon(uplo blas.Uplo, n, kd int, ab []float64, ldab int, anorm float64, work []float64, iwork []int) (rcond float64) {
809+
switch {
810+
case uplo != blas.Upper && uplo != blas.Lower:
811+
panic(badUplo)
812+
case n < 0:
813+
panic(nLT0)
814+
case kd < 0:
815+
panic(kdLT0)
816+
case ldab < kd+1:
817+
panic(badLdA)
818+
case anorm < 0:
819+
panic(badNorm)
820+
}
821+
822+
// Quick return if possible.
823+
if n == 0 {
824+
return 1
825+
}
826+
827+
switch {
828+
case len(ab) < (n-1)*ldab+kd+1:
829+
panic(shortAB)
830+
case len(work) < 3*n:
831+
panic(shortWork)
832+
case len(iwork) < n:
833+
panic(shortIWork)
834+
}
835+
836+
_ldab := n
837+
_ab := make([]float64, (kd+1)*_ldab)
838+
convDpbToLapacke(uplo, n, kd, ab, ldab, _ab, _ldab)
839+
_rcond := []float64{0}
840+
_iwork := make([]int32, n)
841+
lapacke.Dpbcon(byte(uplo), n, kd, _ab, _ldab, anorm, _rcond, work, _iwork)
842+
return _rcond[0]
843+
}
844+
797845
// Dpbtrf computes the Cholesky factorization of an n×n symmetric positive
798846
// definite band matrix
799847
// A = U^T * U if uplo == blas.Upper

lapack/netlib/lapack_test.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ func TestDlange(t *testing.T) {
6464
testlapack.DlangeTest(t, impl)
6565
}
6666

67+
func TestDlansy(t *testing.T) {
68+
testlapack.DlansyTest(t, impl)
69+
}
70+
71+
func TestDlantr(t *testing.T) {
72+
testlapack.DlantrTest(t, impl)
73+
}
74+
6775
func TestDlarfb(t *testing.T) {
6876
testlapack.DlarfbTest(t, impl)
6977
}
@@ -76,10 +84,6 @@ func TestDlarft(t *testing.T) {
7684
testlapack.DlarftTest(t, impl)
7785
}
7886

79-
func TestDlantr(t *testing.T) {
80-
testlapack.DlantrTest(t, impl)
81-
}
82-
8387
func TestDlapmt(t *testing.T) {
8488
testlapack.DlapmtTest(t, impl)
8589
}
@@ -104,6 +108,10 @@ func TestDlaswp(t *testing.T) {
104108
testlapack.DlaswpTest(t, impl)
105109
}
106110

111+
func TestDpbcon(t *testing.T) {
112+
testlapack.DpbconTest(t, impl)
113+
}
114+
107115
func TestDpbtrf(t *testing.T) {
108116
testlapack.DpbtrfTest(t, impl)
109117
}

0 commit comments

Comments
 (0)