mirror of
https://github.com/gonum/gonum.git
synced 2025-10-06 15:47:01 +08:00
added dqr
This commit is contained in:
21
dqr.go
Normal file
21
dqr.go
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package lapack
|
||||||
|
|
||||||
|
import "github.com/gonum/blas"
|
||||||
|
|
||||||
|
type QRFact struct {
|
||||||
|
A blas.General
|
||||||
|
tau []float64
|
||||||
|
}
|
||||||
|
|
||||||
|
func QR(A blas.General, tau []float64) QRFact {
|
||||||
|
impl.Dgeqrf(A, tau)
|
||||||
|
return QRFact{A, tau}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f QRFact) Solve(B blas.General) blas.General {
|
||||||
|
impl.Dormqr(blas.Left, blas.Trans, f.A, f.tau, B)
|
||||||
|
blas.Dtrsm(blas.Left, blas.NoTrans, 1,
|
||||||
|
blas.Ge2Tr(f.A, blas.NonUnit, blas.Upper), B)
|
||||||
|
B.Rows = f.A.Cols
|
||||||
|
return B
|
||||||
|
}
|
@@ -1,4 +0,0 @@
|
|||||||
package golapack
|
|
||||||
|
|
||||||
func Dgeqrf() {
|
|
||||||
}
|
|
7
impl.go
Normal file
7
impl.go
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package lapack
|
||||||
|
|
||||||
|
var impl Lapack
|
||||||
|
|
||||||
|
func Register(i Lapack) {
|
||||||
|
impl = i
|
||||||
|
}
|
10
lapack.go
Normal file
10
lapack.go
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package lapack
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gonum/blas"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Lapack interface {
|
||||||
|
Dgeqrf(A blas.General, tau []float64)
|
||||||
|
Dormqr(s blas.Side, t blas.Transpose, A blas.General, tau []float64, B blas.General)
|
||||||
|
}
|
@@ -1,10 +0,0 @@
|
|||||||
package latypes
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/dane-unltd/goblas"
|
|
||||||
"github.com/gonum/blas"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Lapack interface {
|
|
||||||
Dgeqrf(order blas.Order, A goblas.General, tau []float64)
|
|
||||||
}
|
|
Reference in New Issue
Block a user