Compare commits
No commits in common. "3e8f44166c4a4ed6e99e1676a7200ed044645224" and "1881feb5e24e75f2263018960a0b724af6029775" have entirely different histories.
3e8f44166c
...
1881feb5e2
@ -140,18 +140,4 @@ public fun <A : Attribute<Unit>> Attributes(
|
|||||||
attribute: A,
|
attribute: A,
|
||||||
): Attributes = MapAttributes(mapOf(attribute to Unit))
|
): Attributes = MapAttributes(mapOf(attribute to Unit))
|
||||||
|
|
||||||
/**
|
public operator fun Attributes.plus(other: Attributes): Attributes = MapAttributes(content + other.content)
|
||||||
* Create a new [Attributes] that overlays [other] on top of this set of attributes. New attributes are added.
|
|
||||||
* Existing attribute keys are replaced.
|
|
||||||
*/
|
|
||||||
public operator fun Attributes.plus(other: Attributes): Attributes = when {
|
|
||||||
isEmpty() -> other
|
|
||||||
other.isEmpty() -> this
|
|
||||||
else -> MapAttributes(content + other.content)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new [Attributes] with removed [key] (if it is present).
|
|
||||||
*/
|
|
||||||
public operator fun Attributes.minus(key: Attribute<*>): Attributes =
|
|
||||||
if (content.contains(key)) MapAttributes(content.minus(key)) else this
|
|
@ -1,5 +1,6 @@
|
|||||||
@file:Suppress("UNUSED_VARIABLE")
|
@file:Suppress("UNUSED_VARIABLE")
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
|
||||||
import space.kscience.kmath.benchmarks.addBenchmarkProperties
|
import space.kscience.kmath.benchmarks.addBenchmarkProperties
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
@ -151,12 +152,18 @@ benchmark {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin.sourceSets.all {
|
||||||
jvmToolchain(11)
|
with(languageSettings) {
|
||||||
compilerOptions {
|
optIn("kotlin.contracts.ExperimentalContracts")
|
||||||
optIn.addAll(
|
optIn("kotlin.ExperimentalUnsignedTypes")
|
||||||
"space.kscience.kmath.UnstableKMathAPI"
|
optIn("space.kscience.kmath.UnstableKMathAPI")
|
||||||
)
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<KotlinJvmCompile> {
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "11"
|
||||||
|
freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all" + "-Xlambdas=indy"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ allprojects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "space.kscience"
|
group = "space.kscience"
|
||||||
version = "0.4.1-dev"
|
version = "0.4.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm") version "1.9.23"
|
|
||||||
`kotlin-dsl`
|
`kotlin-dsl`
|
||||||
`version-catalog`
|
`version-catalog`
|
||||||
}
|
}
|
||||||
@ -26,8 +25,10 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
jvmToolchain(11)
|
jvmToolchain {
|
||||||
compilerOptions {
|
languageVersion.set(JavaLanguageVersion.of(11))
|
||||||
optIn.add("kotlin.OptIn")
|
}
|
||||||
|
sourceSets.all {
|
||||||
|
languageSettings.optIn("kotlin.OptIn")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ org.gradle.configureondemand=true
|
|||||||
org.gradle.jvmargs=-Xmx4096m
|
org.gradle.jvmargs=-Xmx4096m
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
org.gradle.workers.max=4
|
org.gradle.workers.max=4
|
||||||
|
toolsVersion=0.15.2-kotlin-1.9.22
|
||||||
toolsVersion=0.15.4-kotlin-2.0.0
|
|
||||||
#kotlin.experimental.tryK2=true
|
#kotlin.experimental.tryK2=true
|
||||||
#kscience.wasm.disabled=true
|
#kscience.wasm.disabled=true
|
@ -4,20 +4,7 @@ plugins {
|
|||||||
|
|
||||||
kscience {
|
kscience {
|
||||||
jvm()
|
jvm()
|
||||||
js{
|
js()
|
||||||
nodejs {
|
|
||||||
testTask {
|
|
||||||
useMocha().timeout = "0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
browser {
|
|
||||||
useCommonJs()
|
|
||||||
testTask {
|
|
||||||
useMocha().timeout = "0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
native()
|
native()
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@ -31,7 +18,7 @@ kscience {
|
|||||||
|
|
||||||
dependencies(jsMain) {
|
dependencies(jsMain) {
|
||||||
implementation(npm("astring", "1.7.5"))
|
implementation(npm("astring", "1.7.5"))
|
||||||
implementation(npm("binaryen", "117.0.0"))
|
implementation(npm("binaryen", "101.0.0"))
|
||||||
implementation(npm("js-base64", "3.6.1"))
|
implementation(npm("js-base64", "3.6.1"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,6 +29,19 @@ kscience {
|
|||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
|
js {
|
||||||
|
nodejs {
|
||||||
|
testTask {
|
||||||
|
useMocha().timeout = "0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
browser {
|
||||||
|
testTask {
|
||||||
|
useMocha().timeout = "0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
filter { it.name.contains("test", true) }
|
filter { it.name.contains("test", true) }
|
||||||
|
@ -4,6 +4,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
@file:Suppress(
|
@file:Suppress(
|
||||||
|
"INTERFACE_WITH_SUPERCLASS",
|
||||||
|
"OVERRIDING_FINAL_MEMBER",
|
||||||
|
"RETURN_TYPE_MISMATCH_ON_OVERRIDE",
|
||||||
|
"CONFLICTING_OVERLOADS",
|
||||||
|
"NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING",
|
||||||
"ObjectPropertyName",
|
"ObjectPropertyName",
|
||||||
"ClassName",
|
"ClassName",
|
||||||
)
|
)
|
||||||
|
@ -4,6 +4,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
@file:Suppress(
|
@file:Suppress(
|
||||||
|
"INTERFACE_WITH_SUPERCLASS",
|
||||||
|
"OVERRIDING_FINAL_MEMBER",
|
||||||
|
"RETURN_TYPE_MISMATCH_ON_OVERRIDE",
|
||||||
|
"CONFLICTING_OVERLOADS",
|
||||||
"PropertyName",
|
"PropertyName",
|
||||||
"ClassName", "ENUM_CLASS_IN_EXTERNAL_DECLARATION_WARNING",
|
"ClassName", "ENUM_CLASS_IN_EXTERNAL_DECLARATION_WARNING",
|
||||||
)
|
)
|
||||||
|
@ -6,6 +6,10 @@
|
|||||||
@file:JsQualifier("WebAssembly")
|
@file:JsQualifier("WebAssembly")
|
||||||
|
|
||||||
@file:Suppress(
|
@file:Suppress(
|
||||||
|
"INTERFACE_WITH_SUPERCLASS",
|
||||||
|
"OVERRIDING_FINAL_MEMBER",
|
||||||
|
"RETURN_TYPE_MISMATCH_ON_OVERRIDE",
|
||||||
|
"NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING",
|
||||||
"ClassName",
|
"ClassName",
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -18,34 +22,78 @@ import org.w3c.fetch.Response
|
|||||||
import space.kscience.kmath.internal.tsstdlib.PromiseLike
|
import space.kscience.kmath.internal.tsstdlib.PromiseLike
|
||||||
import kotlin.js.Promise
|
import kotlin.js.Promise
|
||||||
|
|
||||||
internal external interface CompileError
|
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||||
|
internal external interface CompileError {
|
||||||
|
companion object {
|
||||||
|
var prototype: CompileError
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||||
internal external interface Global {
|
internal external interface Global {
|
||||||
var value: Any
|
var value: Any
|
||||||
fun valueOf(): Any
|
fun valueOf(): Any
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
var prototype: Global
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||||
@JsName("Instance")
|
@JsName("Instance")
|
||||||
internal external interface Instance1 {
|
internal external interface Instance1 {
|
||||||
var exports: Exports
|
var exports: Exports
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
var prototype: Instance
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal external interface LinkError
|
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||||
|
internal external interface LinkError {
|
||||||
|
companion object {
|
||||||
|
var prototype: LinkError
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||||
internal external interface Memory {
|
internal external interface Memory {
|
||||||
var buffer: ArrayBuffer
|
var buffer: ArrayBuffer
|
||||||
fun grow(delta: Number): Number
|
fun grow(delta: Number): Number
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
var prototype: Memory
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||||
|
@JsName("Module")
|
||||||
|
internal external interface Module1 {
|
||||||
|
companion object {
|
||||||
|
var prototype: Module
|
||||||
|
fun customSections(moduleObject: Module, sectionName: String): Array<ArrayBuffer>
|
||||||
|
fun exports(moduleObject: Module): Array<ModuleExportDescriptor>
|
||||||
|
fun imports(moduleObject: Module): Array<ModuleImportDescriptor>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal external interface RuntimeError
|
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||||
|
internal external interface RuntimeError {
|
||||||
|
companion object {
|
||||||
|
var prototype: RuntimeError
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||||
internal external interface Table {
|
internal external interface Table {
|
||||||
var length: Number
|
var length: Number
|
||||||
fun get(index: Number): Function<*>?
|
fun get(index: Number): Function<*>?
|
||||||
fun grow(delta: Number): Number
|
fun grow(delta: Number): Number
|
||||||
fun set(index: Number, value: Function<*>?)
|
fun set(index: Number, value: Function<*>?)
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
var prototype: Table
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal external interface GlobalDescriptor {
|
internal external interface GlobalDescriptor {
|
||||||
|
@ -3,6 +3,13 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"INTERFACE_WITH_SUPERCLASS",
|
||||||
|
"OVERRIDING_FINAL_MEMBER",
|
||||||
|
"RETURN_TYPE_MISMATCH_ON_OVERRIDE",
|
||||||
|
"CONFLICTING_OVERLOADS",
|
||||||
|
"NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING",
|
||||||
|
)
|
||||||
|
|
||||||
package space.kscience.kmath.internal.webassembly
|
package space.kscience.kmath.internal.webassembly
|
||||||
|
|
||||||
|
@ -12,6 +12,8 @@ import space.kscience.kmath.expressions.Symbol
|
|||||||
import space.kscience.kmath.operations.Algebra
|
import space.kscience.kmath.operations.Algebra
|
||||||
import space.kscience.kmath.operations.Float64Field
|
import space.kscience.kmath.operations.Float64Field
|
||||||
import space.kscience.kmath.operations.Int32Ring
|
import space.kscience.kmath.operations.Int32Ring
|
||||||
|
import kotlin.contracts.InvocationKind
|
||||||
|
import kotlin.contracts.contract
|
||||||
import space.kscience.kmath.asm.compile as asmCompile
|
import space.kscience.kmath.asm.compile as asmCompile
|
||||||
import space.kscience.kmath.asm.compileToExpression as asmCompileToExpression
|
import space.kscience.kmath.asm.compileToExpression as asmCompileToExpression
|
||||||
|
|
||||||
@ -41,6 +43,7 @@ private object PrimitiveAsmCompilerTestContext : CompilerTestContext {
|
|||||||
|
|
||||||
|
|
||||||
internal actual inline fun runCompilerTest(action: CompilerTestContext.() -> Unit) {
|
internal actual inline fun runCompilerTest(action: CompilerTestContext.() -> Unit) {
|
||||||
|
contract { callsInPlace(action, InvocationKind.EXACTLY_ONCE) }
|
||||||
action(GenericAsmCompilerTestContext)
|
action(GenericAsmCompilerTestContext)
|
||||||
action(PrimitiveAsmCompilerTestContext)
|
action(PrimitiveAsmCompilerTestContext)
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
package space.kscience.kmath.nd
|
package space.kscience.kmath.nd
|
||||||
|
|
||||||
import space.kscience.kmath.UnsafeKMathAPI
|
import space.kscience.kmath.UnsafeKMathAPI
|
||||||
|
import kotlin.jvm.JvmInline
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A read-only ND shape
|
* A read-only ND shape
|
||||||
|
@ -159,7 +159,7 @@ class Rational {
|
|||||||
override fun equals(other: Any?): Boolean =
|
override fun equals(other: Any?): Boolean =
|
||||||
when (other) {
|
when (other) {
|
||||||
is Rational -> numerator == other.numerator && denominator == other.denominator
|
is Rational -> numerator == other.numerator && denominator == other.denominator
|
||||||
is Int -> numerator == other.toLong() && denominator == 1L
|
is Int -> numerator == other && denominator == 1L
|
||||||
is Long -> numerator == other && denominator == 1L
|
is Long -> numerator == other && denominator == 1L
|
||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ public interface Histogram<in T : Any, out V, out B : Bin<T, V>> {
|
|||||||
/**
|
/**
|
||||||
* Find existing bin, corresponding to given coordinates
|
* Find existing bin, corresponding to given coordinates
|
||||||
*/
|
*/
|
||||||
public operator fun get(point: Point<T>): B?
|
public operator fun get(point: Point<out T>): B?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dimension of the histogram
|
* Dimension of the histogram
|
||||||
@ -57,7 +57,7 @@ public interface HistogramBuilder<in T, V> {
|
|||||||
/**
|
/**
|
||||||
* Increment appropriate bin with given value
|
* Increment appropriate bin with given value
|
||||||
*/
|
*/
|
||||||
public fun putValue(point: Point<T>, value: V = defaultValue)
|
public fun putValue(point: Point<out T>, value: V = defaultValue)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ public interface Histogram1DBuilder<in T : Any, V : Any> : HistogramBuilder<T, V
|
|||||||
*/
|
*/
|
||||||
public fun putValue(at: T, value: V = defaultValue)
|
public fun putValue(at: T, value: V = defaultValue)
|
||||||
|
|
||||||
override fun putValue(point: Point<T>, value: V) {
|
override fun putValue(point: Point<out T>, value: V) {
|
||||||
require(point.size == 1) { "Only points with single value could be used in Histogram1D" }
|
require(point.size == 1) { "Only points with single value could be used in Histogram1D" }
|
||||||
putValue(point[0], value)
|
putValue(point[0], value)
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ public class UniformHistogramGroupND<V : Any, A : Field<V>>(
|
|||||||
val hBuilder = object : HistogramBuilder<Double, V> {
|
val hBuilder = object : HistogramBuilder<Double, V> {
|
||||||
override val defaultValue: V get() = valueAlgebraND.elementAlgebra.one
|
override val defaultValue: V get() = valueAlgebraND.elementAlgebra.one
|
||||||
|
|
||||||
override fun putValue(point: Point<Double>, value: V) = with(valueAlgebraND.elementAlgebra) {
|
override fun putValue(point: Point<out Double>, value: V) = with(valueAlgebraND.elementAlgebra) {
|
||||||
val index = getIndexOrNull(point)
|
val index = getIndexOrNull(point)
|
||||||
ndCounter[index].add(value)
|
ndCounter[index].add(value)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user