v0.3.0-dev-9 #324

Merged
altavir merged 265 commits from dev into master 2021-05-08 17:16:29 +03:00
Showing only changes of commit f4454a6cf6 - Show all commits

View File

@ -1,6 +1,7 @@
package space.kscience.kmath.tensors
import space.kscience.kmath.nd.as2D
import space.kscience.kmath.structures.toDoubleArray
import kotlin.test.Test
import kotlin.test.assertEquals
@ -24,7 +25,8 @@ class TestDoubleTensor {
@Test
fun getTest() = DoubleTensorAlgebra {
val tensor = DoubleTensor(intArrayOf(2,2), doubleArrayOf(3.5,5.8,58.4,2.4))
assertTrue(tensor[0].elements().map{ it.second }.toList().toDoubleArray() contentEquals doubleArrayOf(3.5,5.8))
val tensor = DoubleTensor(intArrayOf(1,2,2), doubleArrayOf(3.5,5.8,58.4,2.4))
val matrix = tensor[0].as2D()
assertEquals(matrix[0,1], 5.8)
}
}