Skip to content

Commit

Permalink
lapack/netlib: add Dpbtrs
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimir-ch committed Mar 10, 2020
1 parent 09e0f2c commit 90de761
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
40 changes: 40 additions & 0 deletions lapack/netlib/lapack.go
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,46 @@ func (impl Implementation) Dpbtrf(uplo blas.Uplo, n, kd int, ab []float64, ldab
return lapacke.Dpbtrf(byte(uplo), n, kd, ab, ldab)
}

// Dpbtrs solves a system of linear equations A*X = B with an n×n symmetric
// positive definite band matrix A using the Cholesky factorization
// A = U^T * U if uplo == blas.Upper
// A = L * L^T if uplo == blas.Lower
// computed by Dpbtrf. kd is the number of super- or sub-diagonals of A. See the
// documentation for Dpbtrf for a description of the band storage format of A.
//
// On entry, b contains the n×nrhs right hand side matrix B. On return, it is
// overwritten with the solution matrix X.
func (Implementation) Dpbtrs(uplo blas.Uplo, n, kd, nrhs int, ab []float64, ldab int, b []float64, ldb int) {
switch {
case uplo != blas.Upper && uplo != blas.Lower:
panic(badUplo)
case n < 0:
panic(nLT0)
case kd < 0:
panic(kdLT0)
case nrhs < 0:
panic(nrhsLT0)
case ldab < kd+1:
panic(badLdA)
case ldb < max(1, nrhs):
panic(badLdB)
}

// Quick return if possible.
if n == 0 || nrhs == 0 {
return
}

if len(ab) < (n-1)*ldab+kd {
panic(shortAB)
}
if len(b) < (n-1)*ldb+nrhs {
panic(shortB)
}

lapacke.Dpbtrs(byte(uplo), n, kd, nrhs, ab, ldab, b, ldb)
}

// Dpotrf computes the Cholesky decomposition of the symmetric positive definite
// matrix a. If ul == blas.Upper, then a is stored as an upper-triangular matrix,
// and a = U U^T is stored in place into a. If ul == blas.Lower, then a = L L^T
Expand Down
4 changes: 4 additions & 0 deletions lapack/netlib/lapack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ func TestDpbtrf(t *testing.T) {
testlapack.DpbtrfTest(t, impl)
}

func TestDpbtrs(t *testing.T) {
testlapack.DpbtrsTest(t, impl)
}

func TestDpotrf(t *testing.T) {
testlapack.DpotrfTest(t, impl)
}
Expand Down

0 comments on commit 90de761

Please sign in to comment.