v0.3.0-dev-18 #459
@ -48,7 +48,7 @@ kotlin {
|
||||
implementation(project(":kmath-nd4j"))
|
||||
implementation(project(":kmath-kotlingrad"))
|
||||
implementation(project(":kmath-viktor"))
|
||||
implementation(projects.kmathMultik)
|
||||
implementation(project(":kmath-multik"))
|
||||
implementation("org.nd4j:nd4j-native:1.0.0-M1")
|
||||
// uncomment if your system supports AVX2
|
||||
// val os = System.getProperty("os.name")
|
||||
@ -134,9 +134,9 @@ afterEvaluate {
|
||||
|
||||
kotlin.sourceSets.all {
|
||||
with(languageSettings) {
|
||||
useExperimentalAnnotation("kotlin.contracts.ExperimentalContracts")
|
||||
useExperimentalAnnotation("kotlin.ExperimentalUnsignedTypes")
|
||||
useExperimentalAnnotation("space.kscience.kmath.misc.UnstableKMathAPI")
|
||||
optIn("kotlin.contracts.ExperimentalContracts")
|
||||
optIn("kotlin.ExperimentalUnsignedTypes")
|
||||
optIn("space.kscience.kmath.misc.UnstableKMathAPI")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ subprojects {
|
||||
localDirectory.set(kotlinDir)
|
||||
|
||||
remoteUrl.set(
|
||||
URL("https://github.com/mipt-npm/${rootProject.name}/tree/master/${this@subprojects.name}/$kotlinDirPath")
|
||||
URL("https://github.com/mipt-npm/kmath/tree/master/${this@subprojects.name}/$kotlinDirPath")
|
||||
)
|
||||
}
|
||||
|
||||
@ -64,9 +64,9 @@ subprojects {
|
||||
readme.readmeTemplate = file("docs/templates/README-TEMPLATE.md")
|
||||
|
||||
ksciencePublish {
|
||||
vcs("https://github.com/mipt-npm/kmath")
|
||||
space(publish = true)
|
||||
sonatype(publish = true)
|
||||
github("kmath", publish = false)
|
||||
space()
|
||||
sonatype()
|
||||
}
|
||||
|
||||
apiValidation.nonPublicMarkers.add("space.kscience.kmath.misc.UnstableKMathAPI")
|
||||
|
@ -1,6 +1,6 @@
|
||||
plugins {
|
||||
`kotlin-dsl`
|
||||
kotlin("plugin.serialization") version "1.4.31"
|
||||
kotlin("plugin.serialization") version "1.5.21"
|
||||
}
|
||||
|
||||
repositories {
|
||||
@ -10,8 +10,8 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api("org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0")
|
||||
api("ru.mipt.npm:gradle-tools:0.10.2")
|
||||
api("org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.2")
|
||||
api("ru.mipt.npm:gradle-tools:0.10.7")
|
||||
api("org.jetbrains.kotlinx:kotlinx-benchmark-plugin:0.3.1")
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ dependencies {
|
||||
//jafama
|
||||
implementation(project(":kmath-jafama"))
|
||||
//multik
|
||||
implementation(projects.kmathMultik)
|
||||
implementation(project(":kmath-multik"))
|
||||
|
||||
|
||||
implementation("org.nd4j:nd4j-native:1.0.0-beta7")
|
||||
@ -57,9 +57,9 @@ dependencies {
|
||||
|
||||
kotlin.sourceSets.all {
|
||||
with(languageSettings) {
|
||||
useExperimentalAnnotation("kotlin.contracts.ExperimentalContracts")
|
||||
useExperimentalAnnotation("kotlin.ExperimentalUnsignedTypes")
|
||||
useExperimentalAnnotation("space.kscience.kmath.misc.UnstableKMathAPI")
|
||||
optIn("kotlin.contracts.ExperimentalContracts")
|
||||
optIn("kotlin.ExperimentalUnsignedTypes")
|
||||
optIn("space.kscience.kmath.misc.UnstableKMathAPI")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ kotlin.js {
|
||||
kotlin.sourceSets {
|
||||
filter { it.name.contains("test", true) }
|
||||
.map(org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet::languageSettings)
|
||||
.forEach { it.useExperimentalAnnotation("space.kscience.kmath.misc.UnstableKMathAPI") }
|
||||
.forEach { it.optIn("space.kscience.kmath.misc.UnstableKMathAPI") }
|
||||
|
||||
commonMain {
|
||||
dependencies {
|
||||
|
@ -38,10 +38,7 @@ public class CMRandomGeneratorWrapper(
|
||||
|
||||
override fun nextInt(): Int = generator.nextInt()
|
||||
override fun nextInt(n: Int): Int = generator.nextInt(n)
|
||||
|
||||
@PerformancePitfall
|
||||
override fun nextGaussian(): Double = runBlocking { GaussianSampler(0.0, 1.0).next(generator) }
|
||||
|
||||
override fun nextDouble(): Double = generator.nextDouble()
|
||||
override fun nextLong(): Long = generator.nextLong()
|
||||
}
|
||||
|
@ -5,24 +5,17 @@ plugins {
|
||||
// id("com.xcporter.metaview") version "0.0.5"
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvm {
|
||||
compilations.all {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs =
|
||||
freeCompilerArgs + "-Xjvm-default=all" + "-Xopt-in=kotlin.RequiresOptIn" + "-Xlambdas=indy"
|
||||
}
|
||||
}
|
||||
}
|
||||
kotlin.sourceSets {
|
||||
filter { it.name.contains("test", true) }
|
||||
.map(org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet::languageSettings)
|
||||
.forEach { it.optIn("space.kscience.kmath.misc.PerformancePitfall") }
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
api(project(":kmath-memory"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//generateUml {
|
||||
// classTree {
|
||||
|
@ -12,7 +12,7 @@ package space.kscience.kmath.misc
|
||||
* in some way that may break some code.
|
||||
*/
|
||||
@MustBeDocumented
|
||||
@Retention(value = AnnotationRetention.SOURCE)
|
||||
@Retention(value = AnnotationRetention.BINARY)
|
||||
@RequiresOptIn("This API is unstable and could change in future", RequiresOptIn.Level.WARNING)
|
||||
public annotation class UnstableKMathAPI
|
||||
|
||||
@ -21,10 +21,10 @@ public annotation class UnstableKMathAPI
|
||||
* slow-down in some cases. Refer to the documentation and benchmark it to be sure.
|
||||
*/
|
||||
@MustBeDocumented
|
||||
@Retention(value = AnnotationRetention.SOURCE)
|
||||
@Retention(value = AnnotationRetention.BINARY)
|
||||
@RequiresOptIn(
|
||||
"Refer to the documentation to use this API in performance-critical code",
|
||||
RequiresOptIn.Level.WARNING
|
||||
RequiresOptIn.Level.WARNING,
|
||||
)
|
||||
public annotation class PerformancePitfall(
|
||||
val message: String = "Potential performance problem"
|
||||
|
@ -35,13 +35,11 @@ public interface BufferAlgebra<T, out A : Algebra<T>> : Algebra<Buffer<T>> {
|
||||
public fun Buffer<T>.zip(other: Buffer<T>, block: A.(left: T, right: T) -> T): Buffer<T> =
|
||||
zipInline(this, other, block)
|
||||
|
||||
@UnstableKMathAPI
|
||||
override fun unaryOperationFunction(operation: String): (arg: Buffer<T>) -> Buffer<T> {
|
||||
val operationFunction = elementAlgebra.unaryOperationFunction(operation)
|
||||
return { arg -> bufferFactory(arg.size) { operationFunction(arg[it]) } }
|
||||
}
|
||||
|
||||
@UnstableKMathAPI
|
||||
override fun binaryOperationFunction(operation: String): (left: Buffer<T>, right: Buffer<T>) -> Buffer<T> {
|
||||
val operationFunction = elementAlgebra.binaryOperationFunction(operation)
|
||||
return { left, right ->
|
||||
@ -141,11 +139,9 @@ public open class BufferRingOps<T, A: Ring<T>>(
|
||||
override fun multiply(left: Buffer<T>, right: Buffer<T>): Buffer<T> = zipInline(left, right) { l, r -> l * r }
|
||||
override fun Buffer<T>.unaryMinus(): Buffer<T> = map { -it }
|
||||
|
||||
@UnstableKMathAPI
|
||||
override fun unaryOperationFunction(operation: String): (arg: Buffer<T>) -> Buffer<T> =
|
||||
super<BufferAlgebra>.unaryOperationFunction(operation)
|
||||
|
||||
@UnstableKMathAPI
|
||||
override fun binaryOperationFunction(operation: String): (left: Buffer<T>, right: Buffer<T>) -> Buffer<T> =
|
||||
super<BufferAlgebra>.binaryOperationFunction(operation)
|
||||
}
|
||||
@ -165,7 +161,6 @@ public open class BufferFieldOps<T, A : Field<T>>(
|
||||
override fun scale(a: Buffer<T>, value: Double): Buffer<T> = a.map { scale(it, value) }
|
||||
override fun Buffer<T>.unaryMinus(): Buffer<T> = map { -it }
|
||||
|
||||
@UnstableKMathAPI
|
||||
override fun binaryOperationFunction(operation: String): (left: Buffer<T>, right: Buffer<T>) -> Buffer<T> =
|
||||
super<BufferRingOps>.binaryOperationFunction(operation)
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ public class DoubleBufferField(public val size: Int) : ExtendedField<Buffer<Doub
|
||||
}
|
||||
}
|
||||
|
||||
@UnstableKMathAPI
|
||||
override fun unaryOperationFunction(operation: String): (arg: Buffer<Double>) -> Buffer<Double> =
|
||||
super<ExtendedField>.unaryOperationFunction(operation)
|
||||
|
||||
|
@ -26,11 +26,9 @@ public abstract class DoubleBufferOps : BufferAlgebra<Double, DoubleField>, Exte
|
||||
override fun Buffer<Double>.map(block: DoubleField.(Double) -> Double): DoubleBuffer =
|
||||
mapInline { DoubleField.block(it) }
|
||||
|
||||
@UnstableKMathAPI
|
||||
override fun unaryOperationFunction(operation: String): (arg: Buffer<Double>) -> Buffer<Double> =
|
||||
super<ExtendedFieldOps>.unaryOperationFunction(operation)
|
||||
|
||||
@UnstableKMathAPI
|
||||
override fun binaryOperationFunction(operation: String): (left: Buffer<Double>, right: Buffer<Double>) -> Buffer<Double> =
|
||||
super<ExtendedFieldOps>.binaryOperationFunction(operation)
|
||||
|
||||
|
@ -7,9 +7,9 @@ plugins {
|
||||
kotlin.sourceSets {
|
||||
all {
|
||||
with(languageSettings) {
|
||||
useExperimentalAnnotation("kotlinx.coroutines.InternalCoroutinesApi")
|
||||
useExperimentalAnnotation("kotlinx.coroutines.ExperimentalCoroutinesApi")
|
||||
useExperimentalAnnotation("kotlinx.coroutines.FlowPreview")
|
||||
optIn("kotlinx.coroutines.InternalCoroutinesApi")
|
||||
optIn("kotlinx.coroutines.ExperimentalCoroutinesApi")
|
||||
optIn("kotlinx.coroutines.FlowPreview")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,5 +23,5 @@ readme {
|
||||
}
|
||||
|
||||
kotlin.sourceSets.all {
|
||||
languageSettings.useExperimentalAnnotation("space.kscience.kmath.misc.UnstableKMathAPI")
|
||||
languageSettings.optIn("space.kscience.kmath.misc.UnstableKMathAPI")
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ readme {
|
||||
}
|
||||
|
||||
kotlin.sourceSets.all {
|
||||
languageSettings.useExperimentalAnnotation("space.kscience.kmath.misc.UnstableKMathAPI")
|
||||
languageSettings.optIn("space.kscience.kmath.misc.UnstableKMathAPI")
|
||||
}
|
||||
|
||||
tasks.processJupyterApiResources {
|
||||
|
@ -8,6 +8,10 @@ kscience {
|
||||
}
|
||||
|
||||
kotlin.sourceSets {
|
||||
all {
|
||||
languageSettings.optIn("space.kscience.kmath.misc.UnstableKMathAPI")
|
||||
}
|
||||
|
||||
commonMain {
|
||||
dependencies {
|
||||
api(project(":kmath-coroutines"))
|
||||
|
@ -6,9 +6,13 @@ plugins {
|
||||
|
||||
kotlin.sourceSets {
|
||||
all {
|
||||
languageSettings.useExperimentalAnnotation("space.kscience.kmath.misc.UnstableKMathAPI")
|
||||
languageSettings.optIn("space.kscience.kmath.misc.UnstableKMathAPI")
|
||||
}
|
||||
|
||||
filter { it.name.contains("test", true) }
|
||||
.map(org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet::languageSettings)
|
||||
.forEach { it.optIn("space.kscience.kmath.misc.PerformancePitfall") }
|
||||
|
||||
commonMain {
|
||||
dependencies {
|
||||
api(project(":kmath-core"))
|
||||
|
@ -384,7 +384,6 @@ public open class DoubleTensorAlgebra :
|
||||
override fun Tensor<Double>.viewAs(other: StructureND<Double>): DoubleTensor =
|
||||
tensor.view(other.shape)
|
||||
|
||||
@PerformancePitfall
|
||||
override infix fun StructureND<Double>.dot(other: StructureND<Double>): DoubleTensor {
|
||||
if (tensor.shape.size == 1 && other.shape.size == 1) {
|
||||
return DoubleTensor(intArrayOf(1), doubleArrayOf(tensor.times(other).tensor.mutableBuffer.array().sum()))
|
||||
|
@ -5,14 +5,10 @@ pluginManagement {
|
||||
gradlePluginPortal()
|
||||
}
|
||||
|
||||
val kotlinVersion = "1.6.0-RC"
|
||||
val toolsVersion = "0.10.5"
|
||||
val kotlinVersion = "1.6.0"
|
||||
|
||||
plugins {
|
||||
id("org.jetbrains.kotlinx.benchmark") version "0.3.1"
|
||||
id("ru.mipt.npm.gradle.project") version toolsVersion
|
||||
id("ru.mipt.npm.gradle.jvm") version toolsVersion
|
||||
id("ru.mipt.npm.gradle.mpp") version toolsVersion
|
||||
kotlin("multiplatform") version kotlinVersion
|
||||
kotlin("plugin.allopen") version kotlinVersion
|
||||
}
|
||||
@ -20,9 +16,6 @@ pluginManagement {
|
||||
|
||||
rootProject.name = "kmath"
|
||||
|
||||
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
|
||||
enableFeaturePreview("VERSION_CATALOGS")
|
||||
|
||||
include(
|
||||
":kmath-memory",
|
||||
":kmath-complex",
|
||||
|
Loading…
Reference in New Issue
Block a user