Dev #194
@ -92,7 +92,7 @@ public interface Algebra<T> {
|
|||||||
* Call a block with an [Algebra] as receiver.
|
* Call a block with an [Algebra] as receiver.
|
||||||
*/
|
*/
|
||||||
// TODO add contract when KT-32313 is fixed
|
// TODO add contract when KT-32313 is fixed
|
||||||
public inline operator fun <A : Algebra<*>, R> A.invoke(block: A.() -> R): R = block()
|
public inline operator fun <A : Algebra<*>, R> A.invoke(block: A.() -> R): R = run(block)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents "semispace", i.e. algebraic structure with associative binary operation called "addition" as well as
|
* Represents "semispace", i.e. algebraic structure with associative binary operation called "addition" as well as
|
||||||
|
@ -4,6 +4,7 @@ import kscience.kmath.linear.DeterminantFeature
|
|||||||
import kscience.kmath.linear.LupDecompositionFeature
|
import kscience.kmath.linear.LupDecompositionFeature
|
||||||
import kscience.kmath.linear.MatrixFeature
|
import kscience.kmath.linear.MatrixFeature
|
||||||
import kscience.kmath.linear.plus
|
import kscience.kmath.linear.plus
|
||||||
|
import kscience.kmath.misc.UnstableKMathAPI
|
||||||
import kscience.kmath.structures.getFeature
|
import kscience.kmath.structures.getFeature
|
||||||
import org.ejml.dense.row.factory.DecompositionFactory_DDRM
|
import org.ejml.dense.row.factory.DecompositionFactory_DDRM
|
||||||
import org.ejml.simple.SimpleMatrix
|
import org.ejml.simple.SimpleMatrix
|
||||||
@ -39,6 +40,7 @@ internal class EjmlMatrixTest {
|
|||||||
assertEquals(listOf(m.numRows(), m.numCols()), w.shape.toList())
|
assertEquals(listOf(m.numRows(), m.numCols()), w.shape.toList())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(UnstableKMathAPI::class)
|
||||||
@Test
|
@Test
|
||||||
fun features() {
|
fun features() {
|
||||||
val m = randomMatrix
|
val m = randomMatrix
|
||||||
@ -57,6 +59,7 @@ internal class EjmlMatrixTest {
|
|||||||
|
|
||||||
private object SomeFeature : MatrixFeature {}
|
private object SomeFeature : MatrixFeature {}
|
||||||
|
|
||||||
|
@OptIn(UnstableKMathAPI::class)
|
||||||
@Test
|
@Test
|
||||||
fun suggestFeature() {
|
fun suggestFeature() {
|
||||||
assertNotNull((EjmlMatrix(randomMatrix) + SomeFeature).getFeature<SomeFeature>())
|
assertNotNull((EjmlMatrix(randomMatrix) + SomeFeature).getFeature<SomeFeature>())
|
||||||
|
@ -62,6 +62,7 @@ class MCScopeTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@OptIn(ObsoleteCoroutinesApi::class)
|
||||||
fun compareResult(test: ATest) {
|
fun compareResult(test: ATest) {
|
||||||
val res1 = runBlocking(Dispatchers.Default) { test() }
|
val res1 = runBlocking(Dispatchers.Default) { test() }
|
||||||
val res2 = runBlocking(newSingleThreadContext("test")) { test() }
|
val res2 = runBlocking(newSingleThreadContext("test")) { test() }
|
||||||
|
Loading…
Reference in New Issue
Block a user