Refactor for build tools 0.13.0

This commit is contained in:
Alexander Nozik 2022-09-04 20:59:30 +03:00
parent 0c1d0aa64e
commit ad97751327
No known key found for this signature in database
GPG Key ID: F7FCF2DD25C71357
37 changed files with 136 additions and 64 deletions

View File

@ -1,3 +1,6 @@
import space.kscience.gradle.useApache2Licence
import space.kscience.gradle.useSPCTeam
plugins {
id("space.kscience.gradle.project")
id("org.jetbrains.kotlinx.kover") version "0.5.0"
@ -68,8 +71,12 @@ subprojects {
readme.readmeTemplate = file("docs/templates/README-TEMPLATE.md")
ksciencePublish {
github("kmath", addToRelease = false)
space()
pom("https://github.com/SciProgCentre/kmath") {
useApache2Licence()
useSPCTeam()
}
github("kmath", "SciProgCentre", addToRelease = false)
space("https://maven.pkg.jetbrains.space/mipt-npm/p/sci/dev")
sonatype()
}

View File

@ -5,6 +5,7 @@
package space.kscience.kmath.structures
import space.kscience.kmath.misc.PerformancePitfall
import space.kscience.kmath.nd.*
import space.kscience.kmath.operations.DoubleField
import space.kscience.kmath.operations.ExtendedField
@ -49,6 +50,7 @@ class StreamDoubleFieldND(override val shape: IntArray) : FieldND<Double, Double
return BufferND(strides, array.asBuffer())
}
@OptIn(PerformancePitfall::class)
override fun StructureND<Double>.map(
transform: DoubleField.(Double) -> Double,
): BufferND<Double> {
@ -56,6 +58,7 @@ class StreamDoubleFieldND(override val shape: IntArray) : FieldND<Double, Double
return BufferND(strides, array.asBuffer())
}
@OptIn(PerformancePitfall::class)
override fun StructureND<Double>.mapIndexed(
transform: DoubleField.(index: IntArray, Double) -> Double,
): BufferND<Double> {
@ -69,6 +72,7 @@ class StreamDoubleFieldND(override val shape: IntArray) : FieldND<Double, Double
return BufferND(strides, array.asBuffer())
}
@OptIn(PerformancePitfall::class)
override fun zip(
left: StructureND<Double>,
right: StructureND<Double>,

View File

@ -5,6 +5,7 @@
package space.kscience.kmath.tensors
import space.kscience.kmath.misc.PerformancePitfall
import space.kscience.kmath.operations.invoke
import space.kscience.kmath.tensors.core.DoubleTensor
import space.kscience.kmath.tensors.core.DoubleTensorAlgebra
@ -13,6 +14,7 @@ import kotlin.math.abs
// OLS estimator using SVD
@OptIn(PerformancePitfall::class)
fun main() {
//seed for random
val randSeed = 100500L

View File

@ -3,8 +3,11 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:OptIn(PerformancePitfall::class)
package space.kscience.kmath.tensors
import space.kscience.kmath.misc.PerformancePitfall
import space.kscience.kmath.operations.invoke
import space.kscience.kmath.tensors.core.BroadcastDoubleTensorAlgebra
import space.kscience.kmath.tensors.core.DoubleTensor

View File

@ -12,4 +12,4 @@ org.gradle.configureondemand=true
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx4096m
toolsVersion=0.12.0-kotlin-1.7.20-Beta
toolsVersion=0.13.0-kotlin-1.7.20-Beta

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -1,6 +1,9 @@
plugins {
kotlin("multiplatform")
id("space.kscience.gradle.common")
id("space.kscience.gradle.mpp")
}
kscience{
native()
}
kotlin.js {

View File

@ -0,0 +1,9 @@
/*
* Copyright 2018-2022 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.
*/
package space.kscience.kmath.ast.rendering
internal actual fun Double.multiplatformToString(): String = toString()
internal actual fun Float.multiplatformToString(): String = toString()

View File

@ -0,0 +1,10 @@
/*
* Copyright 2018-2022 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.
*/
package space.kscience.kmath.ast
internal actual inline fun runCompilerTest(action: CompilerTestContext.() -> Unit) {
//doNothing
}

View File

@ -1,6 +1,5 @@
plugins {
kotlin("jvm")
id("space.kscience.gradle.common")
id("space.kscience.gradle.jvm")
}
description = "Commons math binding for kmath"

View File

@ -1,7 +1,9 @@
plugins {
kotlin("multiplatform")
id("space.kscience.gradle.common")
id("space.kscience.gradle.native")
id("space.kscience.gradle.mpp")
}
kscience {
native()
}
kotlin.sourceSets {
@ -20,14 +22,14 @@ readme {
feature(
id = "complex",
ref = "src/commonMain/kotlin/space/kscience/kmath/complex/Complex.kt"
){
) {
"Complex numbers operations"
}
feature(
id = "quaternion",
ref = "src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt"
){
) {
"Quaternions and their composition"
}
}

View File

@ -1,6 +1,13 @@
plugins {
id("space.kscience.gradle.mpp")
id("space.kscience.gradle.native")
}
kscience{
native()
dependencies {
api(project(":kmath-memory"))
}
}
kotlin.sourceSets {
@ -10,20 +17,8 @@ kotlin.sourceSets {
it.optIn("space.kscience.kmath.misc.PerformancePitfall")
it.optIn("space.kscience.kmath.misc.UnstableKMathAPI")
}
commonMain {
dependencies {
api(project(":kmath-memory"))
}
}
}
//generateUml {
// classTree {
//
// }
//}
readme {
description = "Core classes, algebra definitions, basic linear algebra"
maturity = space.kscience.gradle.Maturity.DEVELOPMENT

View File

@ -1,7 +1,9 @@
plugins {
kotlin("multiplatform")
id("space.kscience.gradle.common")
id("space.kscience.gradle.native")
id("space.kscience.gradle.mpp")
}
kscience{
native()
}
kotlin.sourceSets {

View File

@ -1,6 +1,9 @@
plugins {
id("space.kscience.gradle.mpp")
id("space.kscience.gradle.native")
}
kscience{
native()
}
description = "A proof of concept module for adding type-safe dimensions to structures"

View File

@ -1,8 +1,7 @@
import space.kscience.kmath.ejml.codegen.ejmlCodegen
plugins {
kotlin("jvm")
id("space.kscience.gradle.common")
id("space.kscience.gradle.jvm")
}
dependencies {

View File

@ -1,6 +1,6 @@
/*
* Copyright 2018-2022 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.
* 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 file.
*/
/* This file is generated with buildSrc/src/main/kotlin/space/kscience/kmath/ejml/codegen/ejmlCodegen.kt */

View File

@ -1,7 +1,9 @@
plugins {
kotlin("multiplatform")
id("space.kscience.gradle.common")
id("space.kscience.gradle.native")
id("space.kscience.gradle.mpp")
}
kscience{
native()
}
kotlin.sourceSets.commonMain {

View File

@ -1,7 +1,9 @@
plugins {
kotlin("multiplatform")
id("space.kscience.gradle.common")
id("space.kscience.gradle.native")
id("space.kscience.gradle.mpp")
}
kscience{
native()
}
description = "Functions, integration and interpolation"

View File

@ -1,6 +1,9 @@
plugins {
id("space.kscience.gradle.mpp")
id("space.kscience.gradle.native")
}
kscience{
native()
}
kotlin.sourceSets.commonMain {

View File

@ -1,6 +1,9 @@
plugins {
id("space.kscience.gradle.mpp")
id("space.kscience.gradle.native")
}
kscience{
native()
}
//apply(plugin = "kotlinx-atomicfu")

View File

@ -1,6 +1,5 @@
plugins {
kotlin("jvm")
id("space.kscience.gradle.common")
id("space.kscience.gradle.jvm")
}
kotlin.sourceSets

View File

@ -1,6 +1,9 @@
plugins {
id("space.kscience.gradle.mpp")
id("space.kscience.gradle.native")
}
kscience {
native()
}
readme {

View File

@ -6,6 +6,7 @@
package space.kscience.kmath.multik
import org.jetbrains.kotlinx.multik.default.DefaultEngine
import space.kscience.kmath.misc.PerformancePitfall
import space.kscience.kmath.nd.StructureND
import space.kscience.kmath.nd.one
import space.kscience.kmath.operations.DoubleField
@ -14,6 +15,7 @@ import space.kscience.kmath.tensors.core.tensorAlgebra
import kotlin.test.Test
import kotlin.test.assertTrue
@OptIn(PerformancePitfall::class)
internal class MultikNDTest {
val multikAlgebra = MultikDoubleAlgebra(DefaultEngine())

View File

@ -1,6 +1,5 @@
plugins {
kotlin("jvm")
id("space.kscience.gradle.common")
id("space.kscience.gradle.jvm")
}
description = "ND4J NDStructure implementation and according NDAlgebra classes"

View File

@ -45,6 +45,7 @@ public sealed interface Nd4jArrayAlgebra<T, out C : Algebra<T>> : AlgebraND<T, C
return newStruct
}
@OptIn(PerformancePitfall::class)
override fun StructureND<T>.mapIndexed(
transform: C.(index: IntArray, T) -> T,
): Nd4jArrayStructure<T> {
@ -53,6 +54,7 @@ public sealed interface Nd4jArrayAlgebra<T, out C : Algebra<T>> : AlgebraND<T, C
return new
}
@OptIn(PerformancePitfall::class)
override fun zip(
left: StructureND<T>,
right: StructureND<T>,

View File

@ -40,12 +40,15 @@ public sealed interface Nd4jTensorAlgebra<T : Number, A : Field<T>> : AnalyticTe
override fun structureND(shape: Shape, initializer: A.(IntArray) -> T): Nd4jArrayStructure<T>
@OptIn(PerformancePitfall::class)
override fun StructureND<T>.map(transform: A.(T) -> T): Nd4jArrayStructure<T> =
structureND(shape) { index -> elementAlgebra.transform(get(index)) }
@OptIn(PerformancePitfall::class)
override fun StructureND<T>.mapIndexed(transform: A.(index: IntArray, T) -> T): Nd4jArrayStructure<T> =
structureND(shape) { index -> elementAlgebra.transform(index, get(index)) }
@OptIn(PerformancePitfall::class)
override fun zip(left: StructureND<T>, right: StructureND<T>, transform: A.(T, T) -> T): Nd4jArrayStructure<T> {
require(left.shape.contentEquals(right.shape))
return structureND(left.shape) { index -> elementAlgebra.transform(left[index], right[index]) }

View File

@ -1,6 +1,9 @@
plugins {
id("space.kscience.gradle.mpp")
id("space.kscience.gradle.native")
}
kscience{
native()
}
kotlin.sourceSets {

View File

@ -1,7 +1,9 @@
plugins {
id("space.kscience.gradle.mpp")
// Disable native target to avoid CI crashes
// id("space.kscience.gradle.native")
}
kscience{
native()
}
description = "Polynomials, rational functions, and utilities"

View File

@ -1,6 +1,9 @@
plugins {
id("space.kscience.gradle.mpp")
id("space.kscience.gradle.native")
}
kscience{
native()
}
kotlin.sourceSets {

View File

@ -4,8 +4,7 @@
*/
plugins {
kotlin("jvm")
id("space.kscience.gradle.common")
id("space.kscience.gradle.jvm")
}
description = "Symja integration module"

View File

@ -93,6 +93,7 @@ public fun DoubleField.produceWithTF(
*
* The resulting tensors are available outside of scope
*/
@OptIn(UnstableKMathAPI::class)
public fun DoubleField.produceMapWithTF(
block: DoubleTensorFlowAlgebra.() -> Map<Symbol, StructureND<Double>>,
): Map<Symbol, StructureND<Double>> = Graph().use { graph ->

View File

@ -6,6 +6,7 @@
package space.kscience.kmath.tensorflow
import org.junit.jupiter.api.Test
import space.kscience.kmath.misc.UnstableKMathAPI
import space.kscience.kmath.nd.get
import space.kscience.kmath.nd.structureND
import space.kscience.kmath.operations.DoubleField
@ -13,6 +14,7 @@ import space.kscience.kmath.tensors.core.DoubleTensorAlgebra
import space.kscience.kmath.tensors.core.DoubleTensorAlgebra.Companion.sum
import kotlin.test.assertEquals
@OptIn(UnstableKMathAPI::class)
class DoubleTensorFlowOps {
@Test
fun basicOps() {

View File

@ -1,7 +1,9 @@
plugins {
kotlin("multiplatform")
id("space.kscience.gradle.common")
id("space.kscience.gradle.native")
id("space.kscience.gradle.mpp")
}
kscience{
native()
}
kotlin.sourceSets {

View File

@ -1,7 +1,9 @@
plugins {
kotlin("multiplatform")
id("space.kscience.gradle.common")
id("space.kscience.gradle.native")
id("space.kscience.gradle.mpp")
}
kscience{
native()
}
kotlin.sourceSets.commonMain {

View File

@ -1,13 +1,12 @@
plugins {
kotlin("jvm")
id("space.kscience.gradle.common")
id("space.kscience.gradle.jvm")
}
description = "Binding for https://github.com/JetBrains-Research/viktor"
dependencies {
api(project(":kmath-core"))
api("org.jetbrains.bio:viktor:1.1.0")
api("org.jetbrains.bio:viktor:1.2.0")
}
readme {

View File

@ -13,7 +13,7 @@ import space.kscience.kmath.structures.MutableBuffer
@JvmInline
public value class ViktorBuffer(public val flatArray: F64FlatArray) : MutableBuffer<Double> {
override val size: Int
get() = flatArray.size
get() = flatArray.length
override inline fun get(index: Int): Double = flatArray[index]

View File

@ -1,6 +1,9 @@
plugins {
id("space.kscience.gradle.mpp")
id("space.kscience.gradle.native")
}
kscience{
native()
}
kotlin.sourceSets {