Golub-Kahan SVD algorithm for KMP tensors #499

Closed
grinisrit wants to merge 64 commits from dev into dev
Showing only changes of commit 168912161f - Show all commits

View File

@ -549,12 +549,13 @@ internal fun MutableStructure2D<Double>.svdHelper(u: MutableStructure2D<Double>,
if (flag != 0) {
c = 0.0
s = 1.0
for (i in l until k) {
for (i in l until k + 1) {
f = s * rv1[i]
rv1[i] = c * rv1[i]
if (abs(f) + anorm == anorm) {
break
}
g = w.mutableBuffer.array()[w.bufferStart + i]
h = pythag(f, g)
w.mutableBuffer.array()[w.bufferStart + i] = h
h = 1.0 / h
@ -579,11 +580,6 @@ internal fun MutableStructure2D<Double>.svdHelper(u: MutableStructure2D<Double>,
break
}
// надо придумать, что сделать - выкинуть ошибку?
// if (its == 30) {
// return
// }
x = w.mutableBuffer.array()[w.bufferStart + l]
nm = k - 1
y = w.mutableBuffer.array()[w.bufferStart + nm]