Explicit mutability for StructureND builders

This commit is contained in:
Alexander Nozik 2023-04-22 09:13:06 +03:00
parent cdfddb7551
commit f09371a3f9
6 changed files with 12 additions and 6 deletions

View File

@ -46,7 +46,7 @@ kotlin {
sourceSets {
filter { it.name.contains("test", true) }
.map(org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet::languageSettings)
.forEach { it.optIn("space.kscience.kmath.misc.UnstableKMathAPI") }
.forEach { it.optIn("space.kscience.kmath.UnstableKMathAPI") }
}
}

View File

@ -5,6 +5,7 @@
package space.kscience.kmath.ast
import space.kscience.kmath.UnstableKMathAPI
import space.kscience.kmath.expressions.Expression
import space.kscience.kmath.expressions.MST
import space.kscience.kmath.expressions.Symbol
@ -17,6 +18,7 @@ import space.kscience.kmath.estree.compileToExpression as estreeCompileToExpress
import space.kscience.kmath.wasm.compile as wasmCompile
import space.kscience.kmath.wasm.compileToExpression as wasmCompileToExpression
@OptIn(UnstableKMathAPI::class)
private object WasmCompilerTestContext : CompilerTestContext {
override fun MST.compileToExpression(algebra: IntRing): Expression<Int> = wasmCompileToExpression(algebra)
override fun MST.compile(algebra: IntRing, arguments: Map<Symbol, Int>): Int = wasmCompile(algebra, arguments)

View File

@ -5,6 +5,7 @@
package space.kscience.kmath.wasm
import space.kscience.kmath.UnstableKMathAPI
import space.kscience.kmath.expressions.MstExtendedField
import space.kscience.kmath.expressions.MstRing
import space.kscience.kmath.expressions.invoke
@ -15,6 +16,7 @@ import space.kscience.kmath.operations.invoke
import kotlin.test.Test
import kotlin.test.assertEquals
@OptIn(UnstableKMathAPI::class)
internal class TestWasmSpecific {
@Test
fun int() {

View File

@ -8,7 +8,7 @@ package space.kscience.kmath.geometry
import kotlinx.serialization.Serializable
import kotlin.math.PI
interface Circle<T>
public interface Circle<T>
/**

View File

@ -36,7 +36,7 @@ fun assertVectorEquals(expected: DoubleVector3D, actual: DoubleVector3D, absolut
assertEquals(expected.z, actual.z, absoluteTolerance)
}
fun <V : Any, D: Comparable<D>> GeometrySpace<V, D>.isCollinear(a: V, b: V, absoluteTolerance: D = defaultPrecision): Boolean {
fun <V : Any> GeometrySpace<V, Double>.isCollinear(a: V, b: V, absoluteTolerance: Double = defaultPrecision): Boolean {
val aDist = a.distanceTo(zero)
val bDist = b.distanceTo(zero)
return aDist < absoluteTolerance || bDist < absoluteTolerance || abs(abs((a dot b) / (aDist * bDist)) - 1) < absoluteTolerance

View File

@ -12,10 +12,12 @@ import space.kscience.kmath.operations.Group
* Get a line, containing this [LineSegment]
*/
context(Group<V>)
public val <V : Any> LineSegment<V>.line: Line<V> get() = Line(begin, end - begin)
public val <V : Any> LineSegment<V>.line: Line<V>
get() = Line(begin, end - begin)
/**
* Get a length of a line segment
*/
context(GeometrySpace<V>)
public val <V : Any> LineSegment<V>.length: Double get() = norm(end - begin)
context(GeometrySpace<V, D>)
public val <V : Any, D : Comparable<D>> LineSegment<V>.length: D
get() = norm(end - begin)