Skip to content

Commit

Permalink
lapack/netlib: add Dpotri
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimir-ch committed Jan 19, 2019
1 parent 560ce24 commit 9be13e0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
27 changes: 27 additions & 0 deletions lapack/netlib/lapack.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,33 @@ func (impl Implementation) Dpotrf(ul blas.Uplo, n int, a []float64, lda int) (ok
return lapacke.Dpotrf(byte(ul), n, a, lda)
}

// Dpotri computes the inverse of a real symmetric positive definite matrix A
// using its Cholesky factorization.
//
// On entry, a contains the triangular factor U or L from the Cholesky
// factorization A = U^T*U or A = L*L^T, as computed by Dpotrf.
// On return, a contains the upper or lower triangle of the (symmetric)
// inverse of A, overwriting the input factor U or L.
func (impl Implementation) Dpotri(uplo blas.Uplo, n int, a []float64, lda int) (ok bool) {
switch {
case uplo != blas.Upper && uplo != blas.Lower:
panic(badUplo)
case n < 0:
panic(nLT0)
case lda < max(1, n):
panic(badLdA)
case len(a) < (n-1)*lda+n:
panic("lapack: a has insufficient length")
}

// Quick return if possible.
if n == 0 {
return true
}

return lapacke.Dpotri(byte(uplo), n, a, lda)
}

// Dpotrs solves a system of n linear equations A*X = B where A is an n×n
// symmetric positive definite matrix and B is an n×nrhs matrix. The matrix A is
// represented by its Cholesky factorization
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 TestDpotrf(t *testing.T) {
testlapack.DpotrfTest(t, impl)
}

func TestDpotri(t *testing.T) {
testlapack.DpotriTest(t, impl)
}

func TestDpotrs(t *testing.T) {
testlapack.DpotrsTest(t, impl)
}
Expand Down

0 comments on commit 9be13e0

Please sign in to comment.