github.com/gonum/lapack@v0.0.0-20181123203213-e4cdc5a0bff9/native/dtrtrs.go (about) 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. 4 5 package native 6 7 import ( 8 "github.com/gonum/blas" 9 "github.com/gonum/blas/blas64" 10 ) 11 12 // Dtrtrs solves a triangular system of the form A * X = B or A^T * X = B. Dtrtrs 13 // returns whether the solve completed successfully. If A is singular, no solve is performed. 14 func (impl Implementation) Dtrtrs(uplo blas.Uplo, trans blas.Transpose, diag blas.Diag, n, nrhs int, a []float64, lda int, b []float64, ldb int) (ok bool) { 15 nounit := diag == blas.NonUnit 16 if n == 0 { 17 return false 18 } 19 // Check for singularity. 20 if nounit { 21 for i := 0; i < n; i++ { 22 if a[i*lda+i] == 0 { 23 return false 24 } 25 } 26 } 27 bi := blas64.Implementation() 28 bi.Dtrsm(blas.Left, uplo, trans, diag, n, nrhs, 1, a, lda, b, ldb) 29 return true 30 }