Skip to content

Commit bed3ead

Browse files
committed
lapack/netlib: add Dpbtrs
1 parent 16db339 commit bed3ead

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
@@ -838,6 +838,46 @@ func (impl Implementation) Dpbtrf(uplo blas.Uplo, n, kd int, ab []float64, ldab
838838
return lapacke.Dpbtrf(byte(uplo), n, kd, ab, ldab)
839839
}
840840

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