cgo,native: implement dgerq2, dgerqf and tests
MODIFY
cgo/lapack_test.go
cgo/lapack_test.go
@@ -152,6 +152,10 @@ func TestDgeqrf(t *testing.T) {
testlapack.DgeqrfTest(t, impl)
}
+func TestDgerqf(t *testing.T) {
+ testlapack.DgerqfTest(t, impl)
+}
+
func TestDgesvd(t *testing.T) {
testlapack.DgesvdTest(t, impl)
}

MODIFY
native/lapack_test.go
native/lapack_test.go
@@ -68,6 +68,10 @@ func TestDgels(t *testing.T) {
testlapack.DgelsTest(t, impl)
}
+func TestDgerq2(t *testing.T) {
+ testlapack.Dgerq2Test(t, impl)
+}
+
func TestDgeqp3(t *testing.T) {
testlapack.Dgeqp3Test(t, impl)
}
@@ -80,6 +84,10 @@ func TestDgeqrf(t *testing.T) {
testlapack.DgeqrfTest(t, impl)
}
+func TestDgerqf(t *testing.T) {
+ testlapack.DgerqfTest(t, impl)
+}
+
func TestDgesvd(t *testing.T) {
testlapack.DgesvdTest(t, impl)
}

MODIFY
testlapack/general.go
testlapack/general.go
@@ -545,7 +545,7 @@ func constructQK(kind string, m, n, k int, a []float64, lda int, tau []float64)
switch kind {
case "QR":
sz = m
- case "LQ":
+ case "LQ", "RQ":
sz = n
}
@@ -578,25 +578,28 @@ func constructQK(kind string, m, n, k int, a []float64, lda int, tau []float64)
Inc: 1,
Data: make([]float64, sz),
}
- for j := 0; j < i; j++ {
- vVec.Data[j] = 0
- }
- vVec.Data[i] = 1
switch kind {
case "QR":
+ vVec.Data[i] = 1
for j := i + 1; j < sz; j++ {
vVec.Data[j] = a[lda*j+i]
}
case "LQ":
+ vVec.Data[i] = 1
for j := i + 1; j < sz; j++ {
vVec.Data[j] = a[i*lda+j]
}
+ case "RQ":
+ for j := 0; j < n-k+i; j++ {
+ vVec.Data[j] = a[(m-k+i)*lda+j]
+ }
+ vVec.Data[n-k+i] = 1
}
blas64.Ger(-tau[i], vVec, vVec, h)
copy(qCopy.Data, q.Data)
// Mulitply q by the new h
switch kind {
- case "QR":
+ case "QR", "RQ":
blas64.Gemm(blas.NoTrans, blas.NoTrans, 1, qCopy, h, 0, q)
case "LQ":
blas64.Gemm(blas.NoTrans, blas.NoTrans, 1, h, qCopy, 0, q)

cgo,native: implement dgerq2, dgerqf and tests