KMP library for tensors #300

Merged
grinisrit merged 215 commits from feature/tensor-algebra into dev 2021-05-08 09:48:04 +03:00
2 changed files with 4 additions and 3 deletions
Showing only changes of commit 4f8ab4dd78 - Show all commits

View File

@ -1,6 +1,5 @@
package space.kscience.kmath.tensors.core package space.kscience.kmath.tensors.core
import space.kscience.kmath.misc.UnstableKMathAPI
import space.kscience.kmath.nd.as1D import space.kscience.kmath.nd.as1D
import space.kscience.kmath.samplers.GaussianSampler import space.kscience.kmath.samplers.GaussianSampler
import space.kscience.kmath.stat.RandomGenerator import space.kscience.kmath.stat.RandomGenerator
@ -72,7 +71,7 @@ internal inline fun format(value: Double, digits: Int = 4): String {
val lead = value / ten.pow(order) val lead = value / ten.pow(order)
val leadDisplay = round(lead*ten.pow(digits)) / ten.pow(digits) val leadDisplay = round(lead*ten.pow(digits)) / ten.pow(digits)
val orderDisplay = if(order == 0) "" else if(order > 0) "E+$order" else "E$order" val orderDisplay = if(order == 0) "" else if(order > 0) "E+$order" else "E$order"
val valueDisplay = "${leadDisplay}$orderDisplay" val valueDisplay = "$leadDisplay$orderDisplay"
val res = if(value < 0.0) valueDisplay else " $valueDisplay" val res = if(value < 0.0) valueDisplay else " $valueDisplay"
val fLength = digits + 6 val fLength = digits + 6
val endSpace = " ".repeat(fLength - res.length) val endSpace = " ".repeat(fLength - res.length)

View File

@ -1,8 +1,10 @@
package space.kscience.kmath.tensors.core package space.kscience.kmath.tensors.core
import kotlinx.coroutines.InternalCoroutinesApi
import space.kscience.kmath.nd.as1D import space.kscience.kmath.nd.as1D
import space.kscience.kmath.nd.as2D import space.kscience.kmath.nd.as2D
import space.kscience.kmath.structures.toDoubleArray import space.kscience.kmath.structures.toDoubleArray
import kotlin.test.Ignore
import kotlin.test.Test import kotlin.test.Test
import kotlin.test.assertEquals import kotlin.test.assertEquals
import kotlin.test.assertTrue import kotlin.test.assertTrue
@ -47,7 +49,7 @@ class TestDoubleTensor {
} }
} }
@Test @Test @Ignore
fun toStringTest() = DoubleTensorAlgebra { fun toStringTest() = DoubleTensorAlgebra {
val tensor = randNormal(intArrayOf(2,3)) val tensor = randNormal(intArrayOf(2,3))
println(tensor) println(tensor)