added epsilon for calculating the accuracy of calculations Golub Kahan

This commit is contained in:
margarita0303 2022-08-02 20:39:31 +03:00
parent 9cc9d959c4
commit 8bfa07cc27

View File

@ -282,7 +282,7 @@ private fun DoubleTensorAlgebra.testSVDFor(tensor: DoubleTensor) {
assertTrue(tensor.eq(tensorSVD)) 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 svd = tensor.svdGolubKahan()
val tensorSVD = svd.first val tensorSVD = svd.first
@ -291,7 +291,7 @@ private fun DoubleTensorAlgebra.testSVDGolubKahanFor(tensor: DoubleTensor) {
.dot(svd.third.transpose()) .dot(svd.third.transpose())
) )
assertTrue(tensor.eq(tensorSVD)) assertTrue(tensor.eq(tensorSVD, epsilon))
} }
private fun DoubleTensorAlgebra.testSVDPowerMethodFor(tensor: DoubleTensor, epsilon: Double = 1e-10) { private fun DoubleTensorAlgebra.testSVDPowerMethodFor(tensor: DoubleTensor, epsilon: Double = 1e-10) {