Skip to content
This repository was archived by the owner on Nov 24, 2018. It is now read-only.

Commit 9fc24f1

Browse files
committed
native: implement dgerq2
1 parent b6ea340 commit 9fc24f1

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

native/dgerq2.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright ©2017 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 "github.com/gonum/blas"
8+
9+
func (impl Implementation) Dgerq2(m, n int, a []float64, lda int, tau, work []float64) {
10+
checkMatrix(m, n, a, lda)
11+
k := min(m, n)
12+
if len(tau) < k {
13+
panic(badTau)
14+
}
15+
if len(work) < m {
16+
panic(badWork)
17+
}
18+
19+
for i := k - 1; i >= 0; i-- {
20+
// Generate elementary reflector H[i] to annihilate
21+
// A[m-k+i, 0:n-k+i-1].
22+
mki := m - k + i
23+
nki := n - k + i
24+
var aii float64
25+
aii, tau[i] = impl.Dlarfg(nki, a[mki*lda+mki], a[mki*lda:], lda)
26+
27+
// Apply H[i] to A[0:m-k+i-1, 0:n-k+i] from the right.
28+
a[mki*lda+nki] = 1
29+
impl.Dlarf(blas.Right, mki, nki, a[mki*lda:], 1, tau[i], a, lda, work)
30+
a[mki*lda+nki] = aii
31+
}
32+
}

0 commit comments

Comments
 (0)