From 99d0cfb38403c751bfd73df0a4e5f32d2efd9452 Mon Sep 17 00:00:00 2001 From: Margarita Date: Tue, 22 Mar 2022 21:51:45 +0300 Subject: [PATCH] added tests for std, variance --- .../tensors/core/TestDoubleAnalyticTensorAlgebra.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kmath-tensors/src/commonTest/kotlin/space/kscience/kmath/tensors/core/TestDoubleAnalyticTensorAlgebra.kt b/kmath-tensors/src/commonTest/kotlin/space/kscience/kmath/tensors/core/TestDoubleAnalyticTensorAlgebra.kt index b9f4ebd96..d51702403 100644 --- a/kmath-tensors/src/commonTest/kotlin/space/kscience/kmath/tensors/core/TestDoubleAnalyticTensorAlgebra.kt +++ b/kmath-tensors/src/commonTest/kotlin/space/kscience/kmath/tensors/core/TestDoubleAnalyticTensorAlgebra.kt @@ -299,4 +299,14 @@ internal class TestDoubleAnalyticTensorAlgebra { doubleArrayOf(1.5, 0.5) )} } + + @Test + fun testStd() = DoubleTensorAlgebra { + assertTrue { floor(tensor5.std() * 10000 ) / 10000 == 2.9439 } + } + + @Test + fun testVariance() = DoubleTensorAlgebra { + assertTrue { floor(tensor5.variance() * 10000 ) / 10000 == 8.6666 } + } }