1 // Copyright ©2015 The Gonum Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
8 "gonum.org/v1/gonum/blas"
9 "gonum.org/v1/gonum/blas/blas64"
12 // Dtrti2 computes the inverse of a triangular matrix, storing the result in place
13 // into a. This is the BLAS level 2 version of the algorithm.
15 // Dtrti2 is an internal routine. It is exported for testing purposes.
16 func (impl Implementation) Dtrti2(uplo blas.Uplo, diag blas.Diag, n int, a []float64, lda int) {
17 checkMatrix(n, n, a, lda)
18 if uplo != blas.Upper && uplo != blas.Lower {
21 if diag != blas.NonUnit && diag != blas.Unit {
24 bi := blas64.Implementation()
26 nonUnit := diag == blas.NonUnit
27 // TODO(btracey): Replace this with a row-major ordering.
28 if uplo == blas.Upper {
29 for j := 0; j < n; j++ {
38 bi.Dtrmv(blas.Upper, blas.NoTrans, diag, j, a, lda, a[j:], lda)
39 bi.Dscal(j, ajj, a[j:], lda)
43 for j := n - 1; j >= 0; j-- {
53 bi.Dtrmv(blas.Lower, blas.NoTrans, diag, n-j-1, a[(j+1)*lda+j+1:], lda, a[(j+1)*lda+j:], lda)
54 bi.Dscal(n-j-1, ajj, a[(j+1)*lda+j:], lda)