From f0e445587dfb9d3c6f8fbd01dff7be22cbd795a8 Mon Sep 17 00:00:00 2001 From: margarita0303 Date: Tue, 26 Jul 2022 21:56:50 +0300 Subject: [PATCH] fixed error --- .../kscience/kmath/tensors/core/internal/linUtils.kt | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/kmath-tensors/src/commonMain/kotlin/space/kscience/kmath/tensors/core/internal/linUtils.kt b/kmath-tensors/src/commonMain/kotlin/space/kscience/kmath/tensors/core/internal/linUtils.kt index 26852dc0b..8c1110f33 100644 --- a/kmath-tensors/src/commonMain/kotlin/space/kscience/kmath/tensors/core/internal/linUtils.kt +++ b/kmath-tensors/src/commonMain/kotlin/space/kscience/kmath/tensors/core/internal/linUtils.kt @@ -549,12 +549,13 @@ internal fun MutableStructure2D.svdHelper(u: MutableStructure2D, 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.svdHelper(u: MutableStructure2D, break } -// надо придумать, что сделать - выкинуть ошибку? -// if (its == 30) { -// return -// } - x = w.mutableBuffer.array()[w.bufferStart + l] nm = k - 1 y = w.mutableBuffer.array()[w.bufferStart + nm]