Compare commits
11 Commits
5129f29084
...
a84f1e1500
Author | SHA1 | Date | |
---|---|---|---|
a84f1e1500 | |||
328d45444c | |||
1765f8cf8c | |||
bfb556b013 | |||
56933ecff3 | |||
12a02320ec | |||
23c0758ba6 | |||
a001c74025 | |||
1f6b7abf46 | |||
c940645e2e | |||
65c6962544 |
@ -15,6 +15,7 @@
|
|||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
- `asPolynomial` function due to scope pollution
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Median statistics
|
- Median statistics
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import space.kscience.gradle.isInDevelopment
|
|
||||||
import space.kscience.gradle.useApache2Licence
|
import space.kscience.gradle.useApache2Licence
|
||||||
import space.kscience.gradle.useSPCTeam
|
import space.kscience.gradle.useSPCTeam
|
||||||
|
|
||||||
@ -64,14 +63,7 @@ ksciencePublish {
|
|||||||
useApache2Licence()
|
useApache2Licence()
|
||||||
useSPCTeam()
|
useSPCTeam()
|
||||||
}
|
}
|
||||||
github("kmath", "SciProgCentre")
|
repository("spc","https://maven.sciprog.center/kscience")
|
||||||
space(
|
|
||||||
if (isInDevelopment) {
|
|
||||||
"https://maven.pkg.jetbrains.space/spc/p/sci/dev"
|
|
||||||
} else {
|
|
||||||
"https://maven.pkg.jetbrains.space/spc/p/sci/maven"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
sonatype("https://oss.sonatype.org")
|
sonatype("https://oss.sonatype.org")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ val benchmarksVersion = spclibs.versions.kotlinx.benchmark.get()
|
|||||||
dependencies {
|
dependencies {
|
||||||
api("space.kscience:gradle-tools:$toolsVersion")
|
api("space.kscience:gradle-tools:$toolsVersion")
|
||||||
//plugins form benchmarks
|
//plugins form benchmarks
|
||||||
api("org.jetbrains.kotlinx:kotlinx-benchmark-plugin:0.4.7")
|
api("org.jetbrains.kotlinx:kotlinx-benchmark-plugin:0.4.9")
|
||||||
//api("org.jetbrains.kotlin:kotlin-allopen:$kotlinVersion")
|
//api("org.jetbrains.kotlin:kotlin-allopen:$kotlinVersion")
|
||||||
//to be used inside build-script only
|
//to be used inside build-script only
|
||||||
//implementation(spclibs.kotlinx.serialization.json)
|
//implementation(spclibs.kotlinx.serialization.json)
|
||||||
|
@ -2,10 +2,13 @@
|
|||||||
* Copyright 2018-2021 KMath contributors.
|
* Copyright 2018-2021 KMath contributors.
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
rootProject.name = "kmath"
|
|
||||||
|
|
||||||
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
|
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0"
|
||||||
|
}
|
||||||
|
|
||||||
dependencyResolutionManagement {
|
dependencyResolutionManagement {
|
||||||
val projectProperties = java.util.Properties()
|
val projectProperties = java.util.Properties()
|
||||||
file("../gradle.properties").inputStream().use {
|
file("../gradle.properties").inputStream().use {
|
||||||
|
@ -54,9 +54,9 @@ fun Project.addBenchmarkProperties() {
|
|||||||
p.extensions.findByType(KScienceReadmeExtension::class.java)?.run {
|
p.extensions.findByType(KScienceReadmeExtension::class.java)?.run {
|
||||||
benchmarksProject.extensions.findByType(BenchmarksExtension::class.java)?.configurations?.forEach { cfg ->
|
benchmarksProject.extensions.findByType(BenchmarksExtension::class.java)?.configurations?.forEach { cfg ->
|
||||||
property("benchmark${cfg.name.replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString() }}") {
|
property("benchmark${cfg.name.replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString() }}") {
|
||||||
val launches = benchmarksProject.buildDir.resolve("reports/benchmarks/${cfg.name}")
|
val launches = benchmarksProject.layout.buildDirectory.dir("reports/benchmarks/${cfg.name}").get()
|
||||||
|
|
||||||
val resDirectory = launches.listFiles()?.maxByOrNull {
|
val resDirectory = launches.files().maxByOrNull {
|
||||||
LocalDateTime.parse(it.name, ISO_DATE_TIME).atZone(ZoneId.systemDefault()).toInstant()
|
LocalDateTime.parse(it.name, ISO_DATE_TIME).atZone(ZoneId.systemDefault()).toInstant()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,8 +9,9 @@ kotlin.native.ignoreDisabledTargets=true
|
|||||||
org.gradle.configureondemand=true
|
org.gradle.configureondemand=true
|
||||||
org.gradle.jvmargs=-Xmx4096m
|
org.gradle.jvmargs=-Xmx4096m
|
||||||
|
|
||||||
toolsVersion=0.14.8-kotlin-1.8.20
|
|
||||||
|
|
||||||
|
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
org.gradle.workers.max=4
|
org.gradle.workers.max=4
|
||||||
|
|
||||||
|
toolsVersion=0.15.0-kotlin-1.9.20
|
||||||
|
#kotlin.experimental.tryK2=true
|
||||||
|
#kscience.wasm.disabled=true
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
@ -17,7 +17,7 @@ internal class TestFeatures {
|
|||||||
fun printNumeric() {
|
fun printNumeric() {
|
||||||
val num = object : Number() {
|
val num = object : Number() {
|
||||||
override fun toByte(): Byte = throw UnsupportedOperationException()
|
override fun toByte(): Byte = throw UnsupportedOperationException()
|
||||||
override fun toChar(): Char = throw UnsupportedOperationException()
|
// override fun toChar(): Char = throw UnsupportedOperationException()
|
||||||
override fun toDouble(): Double = throw UnsupportedOperationException()
|
override fun toDouble(): Double = throw UnsupportedOperationException()
|
||||||
override fun toFloat(): Float = throw UnsupportedOperationException()
|
override fun toFloat(): Float = throw UnsupportedOperationException()
|
||||||
override fun toInt(): Int = throw UnsupportedOperationException()
|
override fun toInt(): Int = throw UnsupportedOperationException()
|
||||||
|
@ -8,9 +8,8 @@
|
|||||||
"OVERRIDING_FINAL_MEMBER",
|
"OVERRIDING_FINAL_MEMBER",
|
||||||
"RETURN_TYPE_MISMATCH_ON_OVERRIDE",
|
"RETURN_TYPE_MISMATCH_ON_OVERRIDE",
|
||||||
"CONFLICTING_OVERLOADS",
|
"CONFLICTING_OVERLOADS",
|
||||||
"NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING",
|
|
||||||
"PropertyName",
|
"PropertyName",
|
||||||
"ClassName",
|
"ClassName", "ENUM_CLASS_IN_EXTERNAL_DECLARATION_WARNING",
|
||||||
)
|
)
|
||||||
|
|
||||||
@file:JsModule("binaryen")
|
@file:JsModule("binaryen")
|
||||||
@ -53,7 +52,7 @@ internal external fun createType(types: Array<Type>): Type
|
|||||||
|
|
||||||
internal external fun expandType(type: Type): Array<Type>
|
internal external fun expandType(type: Type): Array<Type>
|
||||||
|
|
||||||
internal external enum class ExpressionIds {
|
internal external enum class ExpressionIds {
|
||||||
Invalid,
|
Invalid,
|
||||||
Block,
|
Block,
|
||||||
If,
|
If,
|
||||||
|
@ -1,17 +1,20 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("space.kscience.gradle.jvm")
|
id("space.kscience.gradle.mpp")
|
||||||
}
|
}
|
||||||
|
|
||||||
description = "Commons math binding for kmath"
|
description = "Commons math binding for kmath"
|
||||||
|
|
||||||
dependencies {
|
kscience {
|
||||||
api(project(":kmath-core"))
|
jvm()
|
||||||
api(project(":kmath-complex"))
|
jvmMain {
|
||||||
api(project(":kmath-coroutines"))
|
api(projects.kmathCore)
|
||||||
api(project(":kmath-optimization"))
|
api(projects.kmathComplex)
|
||||||
api(project(":kmath-stat"))
|
api(projects.kmathCoroutines)
|
||||||
api(project(":kmath-functions"))
|
api(projects.kmathOptimization)
|
||||||
api("org.apache.commons:commons-math3:3.6.1")
|
api(projects.kmathStat)
|
||||||
|
api(projects.kmathFunctions)
|
||||||
|
api("org.apache.commons:commons-math3:3.6.1")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
readme {
|
readme {
|
||||||
|
@ -6,7 +6,6 @@ kscience {
|
|||||||
jvm()
|
jvm()
|
||||||
js()
|
js()
|
||||||
native()
|
native()
|
||||||
|
|
||||||
wasm()
|
wasm()
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
@ -10,6 +10,7 @@ import space.kscience.kmath.UnstableKMathAPI
|
|||||||
import space.kscience.kmath.expressions.Symbol
|
import space.kscience.kmath.expressions.Symbol
|
||||||
import space.kscience.kmath.nd.Structure2D
|
import space.kscience.kmath.nd.Structure2D
|
||||||
import space.kscience.kmath.structures.Buffer
|
import space.kscience.kmath.structures.Buffer
|
||||||
|
import space.kscience.kmath.structures.VirtualBuffer
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,7 +34,10 @@ public interface XYColumnarData<out T, out X : T, out Y : T> : ColumnarData<T> {
|
|||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
|
||||||
public companion object{
|
public companion object {
|
||||||
|
/**
|
||||||
|
* Create data form two buffers (zero-copy)
|
||||||
|
*/
|
||||||
@UnstableKMathAPI
|
@UnstableKMathAPI
|
||||||
public fun <T, X : T, Y : T> of(x: Buffer<X>, y: Buffer<Y>): XYColumnarData<T, X, Y> {
|
public fun <T, X : T, Y : T> of(x: Buffer<X>, y: Buffer<Y>): XYColumnarData<T, X, Y> {
|
||||||
require(x.size == y.size) { "Buffer size mismatch. x buffer size is ${x.size}, y buffer size is ${y.size}" }
|
require(x.size == y.size) { "Buffer size mismatch. x buffer size is ${x.size}, y buffer size is ${y.size}" }
|
||||||
@ -43,6 +47,26 @@ public interface XYColumnarData<out T, out X : T, out Y : T> : ColumnarData<T> {
|
|||||||
override val y: Buffer<Y> = y
|
override val y: Buffer<Y> = y
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create two-column data from a list of row-objects (zero-copy)
|
||||||
|
*/
|
||||||
|
@UnstableKMathAPI
|
||||||
|
public fun <I, T, X : T, Y : T> ofList(
|
||||||
|
list: List<I>,
|
||||||
|
xConverter: (I) -> X,
|
||||||
|
yConverter: (I) -> Y,
|
||||||
|
): XYColumnarData<T, X, Y> = object : XYColumnarData<T, X, Y> {
|
||||||
|
override val size: Int get() = list.size
|
||||||
|
|
||||||
|
override val x: Buffer<X> = VirtualBuffer(list.size) {
|
||||||
|
xConverter(list[it])
|
||||||
|
}
|
||||||
|
|
||||||
|
override val y: Buffer<Y> = VirtualBuffer(list.size) {
|
||||||
|
yConverter(list[it])
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,9 +80,10 @@ public fun <T> ColumnarData<T>.asXYData(
|
|||||||
ySymbol: Symbol,
|
ySymbol: Symbol,
|
||||||
): XYColumnarData<T, T, T> = object : XYColumnarData<T, T, T> {
|
): XYColumnarData<T, T, T> = object : XYColumnarData<T, T, T> {
|
||||||
init {
|
init {
|
||||||
requireNotNull(this@asXYData[xSymbol]){"The column with name $xSymbol is not present in $this"}
|
requireNotNull(this@asXYData[xSymbol]) { "The column with name $xSymbol is not present in $this" }
|
||||||
requireNotNull(this@asXYData[ySymbol]){"The column with name $ySymbol is not present in $this"}
|
requireNotNull(this@asXYData[ySymbol]) { "The column with name $ySymbol is not present in $this" }
|
||||||
}
|
}
|
||||||
|
|
||||||
override val size: Int get() = this@asXYData.size
|
override val size: Int get() = this@asXYData.size
|
||||||
override val x: Buffer<T> get() = this@asXYData[xSymbol]!!
|
override val x: Buffer<T> get() = this@asXYData[xSymbol]!!
|
||||||
override val y: Buffer<T> get() = this@asXYData[ySymbol]!!
|
override val y: Buffer<T> get() = this@asXYData[ySymbol]!!
|
||||||
|
@ -7,7 +7,6 @@ package space.kscience.kmath.operations
|
|||||||
|
|
||||||
import space.kscience.kmath.UnstableKMathAPI
|
import space.kscience.kmath.UnstableKMathAPI
|
||||||
import space.kscience.kmath.expressions.Symbol
|
import space.kscience.kmath.expressions.Symbol
|
||||||
import space.kscience.kmath.expressions.symbol
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An algebra for generic boolean logic
|
* An algebra for generic boolean logic
|
||||||
@ -61,8 +60,8 @@ public interface LogicAlgebra<T : Any> : Algebra<T> {
|
|||||||
|
|
||||||
|
|
||||||
public companion object {
|
public companion object {
|
||||||
public val TRUE: Symbol by symbol
|
public val TRUE: Symbol = Symbol("TRUE")//by symbol
|
||||||
public val FALSE: Symbol by symbol
|
public val FALSE: Symbol = Symbol("FALSE")// by symbol
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,9 +65,7 @@ public class RingBuffer<T>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun Int.forward(n: Int): Int = (this + n) % (buffer.size)
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
|
||||||
private inline fun Int.forward(n: Int): Int = (this + n) % (buffer.size)
|
|
||||||
|
|
||||||
override fun toString(): String = Buffer.toString(this)
|
override fun toString(): String = Buffer.toString(this)
|
||||||
|
|
||||||
|
@ -20,9 +20,4 @@ public fun <C> Polynomial(coefficients: List<C>, reverse: Boolean = false): Poly
|
|||||||
*/
|
*/
|
||||||
@Suppress("FunctionName")
|
@Suppress("FunctionName")
|
||||||
public fun <C> Polynomial(vararg coefficients: C, reverse: Boolean = false): Polynomial<C> =
|
public fun <C> Polynomial(vararg coefficients: C, reverse: Boolean = false): Polynomial<C> =
|
||||||
Polynomial(with(coefficients) { if (reverse) reversed() else toList() })
|
Polynomial(with(coefficients) { if (reverse) reversed() else toList() })
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents [this] constant as a [Polynomial].
|
|
||||||
*/
|
|
||||||
public fun <C> C.asPolynomial() : Polynomial<C> = Polynomial(listOf(this))
|
|
@ -15,3 +15,6 @@ readme {
|
|||||||
An API and basic implementation for arranging objects in a continuous memory block.
|
An API and basic implementation for arranging objects in a continuous memory block.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//rootProject.the<NodeJsRootExtension>().versions.webpack.version = "5.76.2"
|
||||||
|
//rootProject.the<NodeJsRootExtension>().nodeVersion = "20.8.0"
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
package space.kscience.kmath.memory
|
package space.kscience.kmath.memory
|
||||||
|
|
||||||
|
import kotlin.experimental.ExperimentalNativeApi
|
||||||
|
|
||||||
@PublishedApi
|
@PublishedApi
|
||||||
internal class NativeMemory(
|
internal class NativeMemory(
|
||||||
val array: ByteArray,
|
val array: ByteArray,
|
||||||
@ -26,6 +28,7 @@ internal class NativeMemory(
|
|||||||
return NativeMemory(copy)
|
return NativeMemory(copy)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalNativeApi::class)
|
||||||
private val reader: MemoryReader = object : MemoryReader {
|
private val reader: MemoryReader = object : MemoryReader {
|
||||||
override val memory: Memory get() = this@NativeMemory
|
override val memory: Memory get() = this@NativeMemory
|
||||||
|
|
||||||
@ -48,6 +51,7 @@ internal class NativeMemory(
|
|||||||
|
|
||||||
override fun reader(): MemoryReader = reader
|
override fun reader(): MemoryReader = reader
|
||||||
|
|
||||||
|
@OptIn(ExperimentalNativeApi::class)
|
||||||
private val writer: MemoryWriter = object : MemoryWriter {
|
private val writer: MemoryWriter = object : MemoryWriter {
|
||||||
override val memory: Memory get() = this@NativeMemory
|
override val memory: Memory get() = this@NativeMemory
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user