Skip to content

Commit 90de761

Browse files
committed
lapack/netlib: add Dpbtrs
1 parent 09e0f2c commit 90de761

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

lapack/netlib/lapack.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,46 @@ func (impl Implementation) Dpbtrf(uplo blas.Uplo, n, kd int, ab []float64, ldab
845845
return lapacke.Dpbtrf(byte(uplo), n, kd, ab, ldab)
846846
}
847847

848+
// Dpbtrs solves a system of linear equations A*X = B with an n×n symmetric
849+
// positive definite band matrix A using the Cholesky factorization
850+
// A = U^T * U if uplo == blas.Upper
851+
// A = L * L^T if uplo == blas.Lower
852+
// computed by Dpbtrf. kd is the number of super- or sub-diagonals of A. See the
853+
// documentation for Dpbtrf for a description of the band storage format of A.
854+
//
855+
// On entry, b contains the n×nrhs right hand side matrix B. On return, it is
856+
// overwritten with the solution matrix X.
857+
func (Implementation) Dpbtrs(uplo blas.Uplo, n, kd, nrhs int, ab []float64, ldab int, b []float64, ldb int) {
858+
switch {
859+
case uplo != blas.Upper && uplo != blas.Lower:
860+
panic(badUplo)
861+
case n < 0:
862+
panic(nLT0)
863+
case kd < 0:
864+
panic(kdLT0)
865+
case nrhs < 0:
866+
panic(nrhsLT0)
867+
case ldab < kd+1:
868+
panic(badLdA)
869+
case ldb < max(1, nrhs):
870+
panic(badLdB)
871+
}
872+
873+
// Quick return if possible.
874+
if n == 0 || nrhs == 0 {
875+
return
876+
}
877+
878+
if len(ab) < (n-1)*ldab+kd {
879+
panic(shortAB)
880+
}
881+
if len(b) < (n-1)*ldb+nrhs {
882+
panic(shortB)
883+
}
884+
885+
lapacke.Dpbtrs(byte(uplo), n, kd, nrhs, ab, ldab, b, ldb)
886+
}
887+
848888
// Dpotrf computes the Cholesky decomposition of the symmetric positive definite
849889
// matrix a. If ul == blas.Upper, then a is stored as an upper-triangular matrix,
850890
// and a = U U^T is stored in place into a. If ul == blas.Lower, then a = L L^T

lapack/netlib/lapack_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ func TestDpbtrf(t *testing.T) {
108108
testlapack.DpbtrfTest(t, impl)
109109
}
110110

111+
func TestDpbtrs(t *testing.T) {
112+
testlapack.DpbtrsTest(t, impl)
113+
}
114+
111115
func TestDpotrf(t *testing.T) {
112116
testlapack.DpotrfTest(t, impl)
113117
}

0 commit comments

Comments
 (0)