diff --git a/benchmarks/build.gradle.kts b/benchmarks/build.gradle.kts index 5d2e4dac8..ea2349d91 100644 --- a/benchmarks/build.gradle.kts +++ b/benchmarks/build.gradle.kts @@ -5,7 +5,7 @@ import space.kscience.kmath.benchmarks.addBenchmarkProperties plugins { kotlin("multiplatform") - kotlin("plugin.allopen") + alias(spclibs.plugins.kotlin.plugin.allopen) id("org.jetbrains.kotlinx.benchmark") } @@ -44,7 +44,7 @@ kotlin { implementation(project(":kmath-tensors")) implementation(project(":kmath-multik")) implementation("org.jetbrains.kotlinx:multik-default:$multikVersion") - implementation(npmlibs.kotlinx.benchmark.runtime) + implementation(spclibs.kotlinx.benchmark.runtime) } } diff --git a/build.gradle.kts b/build.gradle.kts index e03bec9af..4efb6c802 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,7 +15,7 @@ allprojects { } group = "space.kscience" - version = "0.3.1-dev-7" + version = "0.3.1-dev-8" } subprojects { diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 0f95a7b3f..67df0aab4 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,7 +1,6 @@ plugins { `kotlin-dsl` `version-catalog` - kotlin("plugin.serialization") version "1.6.21" } java.targetCompatibility = JavaVersion.VERSION_11 @@ -13,18 +12,18 @@ repositories { gradlePluginPortal() } -val toolsVersion = npmlibs.versions.tools.get() -val kotlinVersion = npmlibs.versions.kotlin.asProvider().get() -val benchmarksVersion = npmlibs.versions.kotlinx.benchmark.get() +val toolsVersion = spclibs.versions.tools.get() +val kotlinVersion = spclibs.versions.kotlin.asProvider().get() +val benchmarksVersion = spclibs.versions.kotlinx.benchmark.get() dependencies { api("space.kscience:gradle-tools:$toolsVersion") - api(npmlibs.atomicfu.gradle) //plugins form benchmarks api("org.jetbrains.kotlinx:kotlinx-benchmark-plugin:$benchmarksVersion") - api("org.jetbrains.kotlin:kotlin-allopen:$kotlinVersion") + //api("org.jetbrains.kotlin:kotlin-allopen:$kotlinVersion") //to be used inside build-script only - implementation(npmlibs.kotlinx.serialization.json) + //implementation(spclibs.kotlinx.serialization.json) + implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.14.+") } kotlin.sourceSets.all { diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts index 403e0f52c..02111ba37 100644 --- a/buildSrc/settings.gradle.kts +++ b/buildSrc/settings.gradle.kts @@ -26,7 +26,7 @@ dependencyResolutionManagement { } versionCatalogs { - create("npmlibs") { + create("spclibs") { from("space.kscience:version-catalog:$toolsVersion") } } diff --git a/buildSrc/src/main/kotlin/space/kscience/kmath/benchmarks/JmhReport.kt b/buildSrc/src/main/kotlin/space/kscience/kmath/benchmarks/JmhReport.kt index 62cf44915..3a4fcdc79 100644 --- a/buildSrc/src/main/kotlin/space/kscience/kmath/benchmarks/JmhReport.kt +++ b/buildSrc/src/main/kotlin/space/kscience/kmath/benchmarks/JmhReport.kt @@ -5,9 +5,6 @@ package space.kscience.kmath.benchmarks -import kotlinx.serialization.Serializable - -@Serializable data class JmhReport( val jmhVersion: String, val benchmark: String, @@ -37,7 +34,6 @@ data class JmhReport( val scoreUnit: String } - @Serializable data class PrimaryMetric( override val score: Double, override val scoreError: Double, @@ -48,7 +44,6 @@ data class JmhReport( val rawData: List>? = null, ) : Metric - @Serializable data class SecondaryMetric( override val score: Double, override val scoreError: Double, diff --git a/buildSrc/src/main/kotlin/space/kscience/kmath/benchmarks/addBenchmarkProperties.kt b/buildSrc/src/main/kotlin/space/kscience/kmath/benchmarks/addBenchmarkProperties.kt index 5c6a2ac83..61193790b 100644 --- a/buildSrc/src/main/kotlin/space/kscience/kmath/benchmarks/addBenchmarkProperties.kt +++ b/buildSrc/src/main/kotlin/space/kscience/kmath/benchmarks/addBenchmarkProperties.kt @@ -6,8 +6,8 @@ package space.kscience.kmath.benchmarks import kotlinx.benchmark.gradle.BenchmarksExtension -import kotlinx.serialization.decodeFromString -import kotlinx.serialization.json.Json +import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper +import com.fasterxml.jackson.module.kotlin.readValue import org.gradle.api.Project import space.kscience.gradle.KScienceReadmeExtension import java.time.LocalDateTime @@ -45,6 +45,8 @@ private val ISO_DATE_TIME: DateTimeFormatter = DateTimeFormatterBuilder().run { private fun noun(number: Number, singular: String, plural: String) = if (number.toLong() == 1L) singular else plural +private val jsonMapper = jacksonObjectMapper() + fun Project.addBenchmarkProperties() { val benchmarksProject = this rootProject.subprojects.forEach { p -> @@ -60,8 +62,7 @@ fun Project.addBenchmarkProperties() { if (resDirectory == null || !(resDirectory.resolve("jvm.json")).exists()) { "> **Can't find appropriate benchmark data. Try generating readme files after running benchmarks**." } else { - val reports = - Json.decodeFromString>(resDirectory.resolve("jvm.json").readText()) + val reports: List = jsonMapper.readValue>(resDirectory.resolve("jvm.json")) buildString { appendLine("
") diff --git a/examples/src/main/kotlin/space/kscience/kmath/fit/chiSquared.kt b/examples/src/main/kotlin/space/kscience/kmath/fit/chiSquared.kt index febf55283..c5f694ce0 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/fit/chiSquared.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/fit/chiSquared.kt @@ -7,9 +7,9 @@ package space.kscience.kmath.fit import kotlinx.html.br import kotlinx.html.h3 -import space.kscience.kmath.commons.expressions.DSProcessor import space.kscience.kmath.commons.optimization.CMOptimizer import space.kscience.kmath.distributions.NormalDistribution +import space.kscience.kmath.expressions.autodiff import space.kscience.kmath.expressions.chiSquaredExpression import space.kscience.kmath.expressions.symbol import space.kscience.kmath.operations.asIterable @@ -67,7 +67,7 @@ suspend fun main() { val yErr = y.map { sqrt(it) }//RealVector.same(x.size, sigma) // compute differentiable chi^2 sum for given model ax^2 + bx + c - val chi2 = DSProcessor.chiSquaredExpression(x, y, yErr) { arg -> + val chi2 = Double.autodiff.chiSquaredExpression(x, y, yErr) { arg -> //bind variables to autodiff context val a = bindSymbol(a) val b = bindSymbol(b) diff --git a/examples/src/main/kotlin/space/kscience/kmath/fit/qowFit.kt b/examples/src/main/kotlin/space/kscience/kmath/fit/qowFit.kt index c7eefa6b9..9650fa630 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/fit/qowFit.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/fit/qowFit.kt @@ -7,10 +7,10 @@ package space.kscience.kmath.fit import kotlinx.html.br import kotlinx.html.h3 -import space.kscience.kmath.commons.expressions.DSProcessor import space.kscience.kmath.data.XYErrorColumnarData import space.kscience.kmath.distributions.NormalDistribution import space.kscience.kmath.expressions.Symbol +import space.kscience.kmath.expressions.autodiff import space.kscience.kmath.expressions.binding import space.kscience.kmath.expressions.symbol import space.kscience.kmath.operations.asIterable @@ -63,7 +63,7 @@ suspend fun main() { val result = XYErrorColumnarData.of(x, y, yErr).fitWith( QowOptimizer, - DSProcessor, + Double.autodiff, mapOf(a to 0.9, b to 1.2, c to 2.0) ) { arg -> //bind variables to autodiff context diff --git a/examples/src/main/kotlin/space/kscience/kmath/stat/DistributionBenchmark.kt b/examples/src/main/kotlin/space/kscience/kmath/stat/DistributionBenchmark.kt index 2576e9222..031955e15 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/stat/DistributionBenchmark.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/stat/DistributionBenchmark.kt @@ -36,7 +36,7 @@ private suspend fun runKMathChained(): Duration { return Duration.between(startTime, Instant.now()) } -private fun runApacheDirect(): Duration { +private fun runCMDirect(): Duration { val rng = RandomSource.create(RandomSource.MT, 123L) val sampler = CMGaussianSampler.of( @@ -65,7 +65,7 @@ private fun runApacheDirect(): Duration { * Comparing chain sampling performance with direct sampling performance */ fun main(): Unit = runBlocking(Dispatchers.Default) { - val directJob = async { runApacheDirect() } + val directJob = async { runCMDirect() } val chainJob = async { runKMathChained() } println("KMath Chained: ${chainJob.await()}") println("Apache Direct: ${directJob.await()}") diff --git a/gradle.properties b/gradle.properties index da5867ea4..3016246b2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,12 +5,11 @@ kotlin.code.style=official kotlin.mpp.stability.nowarn=true kotlin.native.ignoreDisabledTargets=true -kotlin.incremental.js.ir=true org.gradle.configureondemand=true org.gradle.jvmargs=-Xmx4096m -toolsVersion=0.13.1-kotlin-1.7.20 +toolsVersion=0.13.4-kotlin-1.8.0 org.gradle.parallel=true diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8049c684f..070cb702f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpression.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/expressions/CmDsExpression.kt similarity index 91% rename from kmath-commons/src/main/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpression.kt rename to kmath-commons/src/main/kotlin/space/kscience/kmath/commons/expressions/CmDsExpression.kt index 6d756b15f..f2af49087 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpression.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/expressions/CmDsExpression.kt @@ -18,7 +18,8 @@ import space.kscience.kmath.operations.NumbersAddOps * @param bindings The map of bindings values. All bindings are considered free parameters */ @OptIn(UnstableKMathAPI::class) -public class DerivativeStructureField( +@Deprecated("Use generic DSAlgebra from the core") +public class CmDsField( public val order: Int, bindings: Map, ) : ExtendedField, ExpressionAlgebra, @@ -108,25 +109,27 @@ public class DerivativeStructureField( /** * Auto-diff processor based on Commons-math [DerivativeStructure] */ -public object DSProcessor : AutoDiffProcessor { +@Deprecated("Use generic DSAlgebra from the core") +public object CmDsProcessor : AutoDiffProcessor { override fun differentiate( - function: DerivativeStructureField.() -> DerivativeStructure, - ): DerivativeStructureExpression = DerivativeStructureExpression(function) + function: CmDsField.() -> DerivativeStructure, + ): CmDsExpression = CmDsExpression(function) } /** * A constructs that creates a derivative structure with required order on-demand */ -public class DerivativeStructureExpression( - public val function: DerivativeStructureField.() -> DerivativeStructure, +@Deprecated("Use generic DSAlgebra from the core") +public class CmDsExpression( + public val function: CmDsField.() -> DerivativeStructure, ) : DifferentiableExpression { override operator fun invoke(arguments: Map): Double = - DerivativeStructureField(0, arguments).function().value + CmDsField(0, arguments).function().value /** * Get the derivative expression with given orders */ override fun derivativeOrNull(symbols: List): Expression = Expression { arguments -> - with(DerivativeStructureField(symbols.size, arguments)) { function().derivative(symbols) } + with(CmDsField(symbols.size, arguments)) { function().derivative(symbols) } } } diff --git a/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpressionTest.kt b/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpressionTest.kt index 40ba9fc7d..7c3c086ed 100644 --- a/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpressionTest.kt +++ b/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpressionTest.kt @@ -3,6 +3,8 @@ * 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("DEPRECATION") + package space.kscience.kmath.commons.expressions import space.kscience.kmath.expressions.* @@ -15,10 +17,10 @@ import kotlin.test.assertFails internal inline fun diff( order: Int, vararg parameters: Pair, - block: DerivativeStructureField.() -> Unit, + block: CmDsField.() -> Unit, ) { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } - DerivativeStructureField(order, mapOf(*parameters)).run(block) + CmDsField(order, mapOf(*parameters)).run(block) } internal class AutoDiffTest { @@ -41,7 +43,7 @@ internal class AutoDiffTest { @Test fun autoDifTest() { - val f = DerivativeStructureExpression { + val f = CmDsExpression { val x by binding val y by binding x.pow(2) + 2 * x * y + y.pow(2) + 1 diff --git a/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/optimization/OptimizeTest.kt b/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/optimization/OptimizeTest.kt index 7c8ba7d27..8b4631fca 100644 --- a/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/optimization/OptimizeTest.kt +++ b/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/optimization/OptimizeTest.kt @@ -6,22 +6,25 @@ package space.kscience.kmath.commons.optimization import kotlinx.coroutines.runBlocking -import space.kscience.kmath.commons.expressions.DSProcessor -import space.kscience.kmath.commons.expressions.DerivativeStructureExpression import space.kscience.kmath.distributions.NormalDistribution +import space.kscience.kmath.expressions.DSFieldExpression import space.kscience.kmath.expressions.Symbol.Companion.x import space.kscience.kmath.expressions.Symbol.Companion.y +import space.kscience.kmath.expressions.autodiff import space.kscience.kmath.expressions.chiSquaredExpression import space.kscience.kmath.expressions.symbol +import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.operations.DoubleBufferOps.Companion.map +import space.kscience.kmath.operations.DoubleField import space.kscience.kmath.optimization.* import space.kscience.kmath.random.RandomGenerator import space.kscience.kmath.structures.DoubleBuffer import space.kscience.kmath.structures.asBuffer import kotlin.test.Test +@OptIn(UnstableKMathAPI::class) internal class OptimizeTest { - val normal = DerivativeStructureExpression { + val normal = DSFieldExpression(DoubleField) { exp(-bindSymbol(x).pow(2) / 2) + exp(-bindSymbol(y).pow(2) / 2) } @@ -60,7 +63,7 @@ internal class OptimizeTest { val yErr = DoubleBuffer(x.size) { sigma } - val chi2 = DSProcessor.chiSquaredExpression( + val chi2 = Double.autodiff.chiSquaredExpression( x, y, yErr ) { arg -> val cWithDefault = bindSymbolOrNull(c) ?: one diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/DSAlgebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/DSAlgebra.kt index e7ade4f66..9e91ff26b 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/DSAlgebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/DSAlgebra.kt @@ -80,7 +80,6 @@ public abstract class DSAlgebra>( public val algebra: A, public val order: Int, bindings: Map, - public val valueBufferFactory: MutableBufferFactory = algebra.bufferFactory, ) : ExpressionAlgebra>, SymbolIndexer { /** @@ -116,7 +115,6 @@ public abstract class DSAlgebra>( newCache[p][o] = DSCompiler( algebra, - valueBufferFactory, p, o, valueCompiler, @@ -141,7 +139,7 @@ public abstract class DSAlgebra>( override val symbols: List = bindings.map { it.key } private fun bufferForVariable(index: Int, value: T): Buffer { - val buffer = valueBufferFactory(compiler.size) { algebra.zero } + val buffer = algebra.bufferFactory(compiler.size) { algebra.zero } buffer[0] = value if (compiler.order > 0) { // the derivative of the variable with respect to itself is 1. @@ -207,7 +205,7 @@ public abstract class DSAlgebra>( } public override fun const(value: T): DS { - val buffer = valueBufferFactory(compiler.size) { algebra.zero } + val buffer = algebra.bufferFactory(compiler.size) { algebra.zero } buffer[0] = value return DS(buffer) @@ -245,11 +243,14 @@ public open class DSRing( algebra: A, order: Int, bindings: Map, - valueBufferFactory: MutableBufferFactory, -) : DSAlgebra(algebra, order, bindings, valueBufferFactory), - Ring>, ScaleOperations>, +) : DSAlgebra(algebra, order, bindings), + Ring>, + ScaleOperations>, NumericAlgebra>, - NumbersAddOps> where A : Ring, A : NumericAlgebra, A : ScaleOperations { + NumbersAddOps> + where A : Ring, A : NumericAlgebra, A : ScaleOperations { + + public val elementBufferFactory: MutableBufferFactory = algebra.bufferFactory override fun bindSymbolOrNull(value: String): DSSymbol? = super.bindSymbolOrNull(value) @@ -261,14 +262,14 @@ public open class DSRing( */ protected inline fun DS.transformDataBuffer(block: A.(MutableBuffer) -> Unit): DS { require(derivativeAlgebra == this@DSRing) { "All derivative operations should be done in the same algebra" } - val newData = valueBufferFactory(compiler.size) { data[it] } + val newData = elementBufferFactory(compiler.size) { data[it] } algebra.block(newData) return DS(newData) } protected fun DS.mapData(block: A.(T) -> T): DS { require(derivativeAlgebra == this@DSRing) { "All derivative operations should be done in the same algebra" } - val newData: Buffer = data.mapToBuffer(valueBufferFactory) { + val newData: Buffer = data.mapToBuffer(elementBufferFactory) { algebra.block(it) } return DS(newData) @@ -276,7 +277,7 @@ public open class DSRing( protected fun DS.mapDataIndexed(block: (Int, T) -> T): DS { require(derivativeAlgebra == this@DSRing) { "All derivative operations should be done in the same algebra" } - val newData: Buffer = data.mapIndexedToBuffer(valueBufferFactory, block) + val newData: Buffer = data.mapIndexedToBuffer(elementBufferFactory, block) return DS(newData) } @@ -329,22 +330,21 @@ public class DerivativeStructureRingExpression( public val function: DSRing.() -> DS, ) : DifferentiableExpression where A : Ring, A : ScaleOperations, A : NumericAlgebra { override operator fun invoke(arguments: Map): T = - DSRing(algebra, 0, arguments, elementBufferFactory).function().value + DSRing(algebra, 0, arguments).function().value override fun derivativeOrNull(symbols: List): Expression = Expression { arguments -> with( DSRing( algebra, symbols.size, - arguments, - elementBufferFactory + arguments ) ) { function().derivative(symbols) } } } /** - * A field over commons-math [DerivativeStructure]. + * A field over [DS]. * * @property order The derivation order. * @param bindings The map of bindings values. All bindings are considered free parameters. @@ -354,8 +354,7 @@ public class DSField>( algebra: A, order: Int, bindings: Map, - valueBufferFactory: MutableBufferFactory, -) : DSRing(algebra, order, bindings, valueBufferFactory), ExtendedField> { +) : DSRing(algebra, order, bindings), ExtendedField> { override fun number(value: Number): DS = const(algebra.number(value)) override fun divide(left: DS, right: DS): DS = left.transformDataBuffer { result -> @@ -414,6 +413,7 @@ public class DSField>( is Int -> arg.transformDataBuffer { result -> compiler.pow(arg.data, 0, pow, result, 0) } + else -> arg.transformDataBuffer { result -> compiler.pow(arg.data, 0, pow.toDouble(), result, 0) } @@ -439,18 +439,29 @@ public class DSField>( @UnstableKMathAPI public class DSFieldExpression>( public val algebra: A, - private val valueBufferFactory: MutableBufferFactory = algebra.bufferFactory, public val function: DSField.() -> DS, ) : DifferentiableExpression { override operator fun invoke(arguments: Map): T = - DSField(algebra, 0, arguments, valueBufferFactory).function().value + DSField(algebra, 0, arguments).function().value override fun derivativeOrNull(symbols: List): Expression = Expression { arguments -> DSField( algebra, symbols.size, arguments, - valueBufferFactory, ).run { function().derivative(symbols) } } } + + +@UnstableKMathAPI +public class DSFieldProcessor>( + public val algebra: A, +) : AutoDiffProcessor, DSField> { + override fun differentiate( + function: DSField.() -> DS, + ): DifferentiableExpression = DSFieldExpression(algebra, function) +} + +@UnstableKMathAPI +public val Double.Companion.autodiff: DSFieldProcessor get() = DSFieldProcessor(DoubleField) \ No newline at end of file diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/DSCompiler.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/DSCompiler.kt index 6ab9b3d44..1da151d46 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/DSCompiler.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/DSCompiler.kt @@ -9,7 +9,6 @@ package space.kscience.kmath.expressions import space.kscience.kmath.operations.* import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.MutableBuffer -import space.kscience.kmath.structures.MutableBufferFactory import kotlin.math.min internal fun MutableBuffer.fill(element: T, fromIndex: Int = 0, toIndex: Int = size) { @@ -56,7 +55,6 @@ internal fun MutableBuffer.fill(element: T, fromIndex: Int = 0, toIndex: */ public class DSCompiler> internal constructor( public val algebra: A, - public val bufferFactory: MutableBufferFactory, public val freeParameters: Int, public val order: Int, valueCompiler: DSCompiler?, diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/DSTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/DSTest.kt index f46f3023d..0bfcb04a7 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/DSTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/DSTest.kt @@ -9,7 +9,6 @@ package space.kscience.kmath.expressions import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.operations.DoubleField -import space.kscience.kmath.structures.DoubleBuffer import kotlin.contracts.InvocationKind import kotlin.contracts.contract import kotlin.test.Test @@ -22,7 +21,7 @@ internal inline fun diff( block: DSField.() -> Unit, ) { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } - DSField(DoubleField, order, mapOf(*parameters), ::DoubleBuffer).block() + DSField(DoubleField, order, mapOf(*parameters)).block() } internal class DSTest { @@ -45,7 +44,7 @@ internal class DSTest { @Test fun dsExpressionTest() { - val f = DSFieldExpression(DoubleField, ::DoubleBuffer) { + val f = DSFieldExpression(DoubleField) { val x by binding val y by binding x.pow(2) + 2 * x * y + y.pow(2) + 1 diff --git a/kmath-functions/build.gradle.kts b/kmath-functions/build.gradle.kts index 2e7b023c1..9c2cd8352 100644 --- a/kmath-functions/build.gradle.kts +++ b/kmath-functions/build.gradle.kts @@ -17,7 +17,7 @@ kotlin.sourceSets { } dependencies { - dokkaPlugin("org.jetbrains.dokka:mathjax-plugin:${npmlibs.versions.dokka.get()}") + dokkaPlugin("org.jetbrains.dokka:mathjax-plugin:${spclibs.versions.dokka.get()}") } readme { diff --git a/kmath-histograms/build.gradle.kts b/kmath-histograms/build.gradle.kts index d31526a74..9d7ac33e4 100644 --- a/kmath-histograms/build.gradle.kts +++ b/kmath-histograms/build.gradle.kts @@ -12,7 +12,7 @@ kotlin.sourceSets { commonMain { dependencies { api(project(":kmath-core")) - api(npmlibs.atomicfu) + api(spclibs.atomicfu) } } commonTest { diff --git a/kmath-optimization/build.gradle.kts b/kmath-optimization/build.gradle.kts index f4256b9aa..ba49d49bf 100644 --- a/kmath-optimization/build.gradle.kts +++ b/kmath-optimization/build.gradle.kts @@ -14,7 +14,7 @@ kotlin.sourceSets { commonMain { dependencies { api(project(":kmath-coroutines")) - api(npmlibs.atomicfu) + api(spclibs.atomicfu) } } } diff --git a/kmath-stat/build.gradle.kts b/kmath-stat/build.gradle.kts index f6ca54e17..bc98129a9 100644 --- a/kmath-stat/build.gradle.kts +++ b/kmath-stat/build.gradle.kts @@ -10,7 +10,7 @@ kotlin.sourceSets { commonMain { dependencies { api(project(":kmath-coroutines")) - implementation(npmlibs.atomicfu) + implementation(spclibs.atomicfu) } } diff --git a/settings.gradle.kts b/settings.gradle.kts index 23af18d31..7d92dc36e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -13,7 +13,7 @@ dependencyResolutionManagement { } versionCatalogs { - create("npmlibs") { + create("spclibs") { from("space.kscience:version-catalog:$toolsVersion") } }