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