From 8bfa07cc2759ad6a23af6f7aa5cd913e23fb455a Mon Sep 17 00:00:00 2001 From: margarita0303 Date: Tue, 2 Aug 2022 20:39:31 +0300 Subject: [PATCH] added epsilon for calculating the accuracy of calculations Golub Kahan --- .../kscience/kmath/tensors/core/TestDoubleLinearOpsAlgebra.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kmath-tensors/src/commonTest/kotlin/space/kscience/kmath/tensors/core/TestDoubleLinearOpsAlgebra.kt b/kmath-tensors/src/commonTest/kotlin/space/kscience/kmath/tensors/core/TestDoubleLinearOpsAlgebra.kt index 87050c405..181b3f4fe 100644 --- a/kmath-tensors/src/commonTest/kotlin/space/kscience/kmath/tensors/core/TestDoubleLinearOpsAlgebra.kt +++ b/kmath-tensors/src/commonTest/kotlin/space/kscience/kmath/tensors/core/TestDoubleLinearOpsAlgebra.kt @@ -282,7 +282,7 @@ private fun DoubleTensorAlgebra.testSVDFor(tensor: DoubleTensor) { assertTrue(tensor.eq(tensorSVD)) } -private fun DoubleTensorAlgebra.testSVDGolubKahanFor(tensor: DoubleTensor) { +private fun DoubleTensorAlgebra.testSVDGolubKahanFor(tensor: DoubleTensor, epsilon: Double = 1e-10) { val svd = tensor.svdGolubKahan() val tensorSVD = svd.first @@ -291,7 +291,7 @@ private fun DoubleTensorAlgebra.testSVDGolubKahanFor(tensor: DoubleTensor) { .dot(svd.third.transpose()) ) - assertTrue(tensor.eq(tensorSVD)) + assertTrue(tensor.eq(tensorSVD, epsilon)) } private fun DoubleTensorAlgebra.testSVDPowerMethodFor(tensor: DoubleTensor, epsilon: Double = 1e-10) {