diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index cffef64b0..cde58b6d6 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -13,20 +13,29 @@ jobs:
runs-on: ${{matrix.os}}
timeout-minutes: 40
steps:
- - uses: actions/checkout@v3.0.0
- - uses: actions/setup-java@v3.0.0
+ - name: Checkout the repo
+ uses: actions/checkout@v2
+ - name: Set up JDK 11
+ uses: DeLaGuardo/setup-graalvm@4.0
with:
- java-version: 11
- distribution: liberica
+ graalvm: 21.2.0
+ java: java11
+ arch: amd64
+ - name: Cache gradle
+ uses: actions/cache@v2
+ with:
+ path: |
+ ~/.gradle/caches
+ ~/.gradle/wrapper
+ key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
+ restore-keys: |
+ ${{ runner.os }}-gradle-
- name: Cache konan
- uses: actions/cache@v3.0.1
+ uses: actions/cache@v2
with:
path: ~/.konan
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-
- - name: Gradle Wrapper Validation
- uses: gradle/wrapper-validation-action@v1.0.4
- - uses: gradle/gradle-build-action@v2.1.5
- with:
- arguments: build
+ - name: Build
+ run: ./gradlew build --build-cache --no-daemon --stacktrace
diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml
index 9b76fd16e..23ed54357 100644
--- a/.github/workflows/pages.yml
+++ b/.github/workflows/pages.yml
@@ -9,22 +9,20 @@ jobs:
runs-on: ubuntu-20.04
timeout-minutes: 40
steps:
- - uses: actions/checkout@v3.0.0
- - uses: actions/setup-java@v3.0.0
+ - uses: actions/checkout@v2
+ - uses: DeLaGuardo/setup-graalvm@4.0
with:
- java-version: 11
- distribution: liberica
- - name: Cache konan
- uses: actions/cache@v3.0.1
+ graalvm: 21.2.0
+ java: java11
+ arch: amd64
+ - uses: actions/cache@v2
with:
- path: ~/.konan
+ path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-
- - uses: gradle/gradle-build-action@v2.1.5
- with:
- arguments: dokkaHtmlMultiModule --no-parallel
- - uses: JamesIves/github-pages-deploy-action@4.2.5
+ - run: ./gradlew dokkaHtmlMultiModule --build-cache --no-daemon --no-parallel --stacktrace
+ - uses: JamesIves/github-pages-deploy-action@4.1.0
with:
branch: gh-pages
folder: build/dokka/htmlMultiModule
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 8e9b98dcb..c5075cb0f 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -14,36 +14,40 @@ jobs:
os: [ macOS-latest, windows-latest ]
runs-on: ${{matrix.os}}
steps:
- - uses: actions/checkout@v3.0.0
- - uses: actions/setup-java@v3.0.0
+ - name: Checkout the repo
+ uses: actions/checkout@v2
+ - name: Set up JDK 11
+ uses: DeLaGuardo/setup-graalvm@4.0
with:
- java-version: 11
- distribution: liberica
+ graalvm: 21.2.0
+ java: java11
+ arch: amd64
+ - name: Cache gradle
+ uses: actions/cache@v2
+ with:
+ path: |
+ ~/.gradle/caches
+ ~/.gradle/wrapper
+ key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
+ restore-keys: |
+ ${{ runner.os }}-gradle-
- name: Cache konan
- uses: actions/cache@v3.0.1
+ uses: actions/cache@v2
with:
path: ~/.konan
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-
- - uses: gradle/wrapper-validation-action@v1.0.4
- name: Publish Windows Artifacts
if: matrix.os == 'windows-latest'
- uses: gradle/gradle-build-action@v2.1.5
- with:
- arguments: |
- releaseAll
- -Ppublishing.enabled=true
- -Ppublishing.space.user=${{ secrets.SPACE_APP_ID }}
- -Ppublishing.space.token=${{ secrets.SPACE_APP_SECRET }}
+ shell: cmd
+ run: >
+ ./gradlew release --no-daemon --build-cache -Ppublishing.enabled=true
+ -Ppublishing.space.user=${{ secrets.SPACE_APP_ID }}
+ -Ppublishing.space.token=${{ secrets.SPACE_APP_SECRET }}
- name: Publish Mac Artifacts
if: matrix.os == 'macOS-latest'
- uses: gradle/gradle-build-action@v2.1.5
- with:
- arguments: |
- releaseMacosX64
- releaseIosArm64
- releaseIosX64
- -Ppublishing.enabled=true
- -Ppublishing.space.user=${{ secrets.SPACE_APP_ID }}
- -Ppublishing.space.token=${{ secrets.SPACE_APP_SECRET }}
+ run: >
+ ./gradlew release --no-daemon --build-cache -Ppublishing.enabled=true -Ppublishing.platform=macosX64
+ -Ppublishing.space.user=${{ secrets.SPACE_APP_ID }}
+ -Ppublishing.space.token=${{ secrets.SPACE_APP_SECRET }}
diff --git a/.gitignore b/.gitignore
index 5ddd846a8..d6c4af4e3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,8 @@ out/
.idea/
+!.idea/copyright/
+!.idea/scopes/
.vscode/
@@ -16,7 +18,3 @@ out/
# Generated by javac -h and runtime
*.class
*.log
-
-!/.idea/copyright/
-!/.idea/scopes/
-/kotlin-js-store/yarn.lock
diff --git a/.idea/copyright/kmath.xml b/.idea/copyright/kmath.xml
index 17e44e4d0..1070e5d33 100644
--- a/.idea/copyright/kmath.xml
+++ b/.idea/copyright/kmath.xml
@@ -1,6 +1,6 @@
-
+
diff --git a/.idea/scopes/Apply_copyright.xml b/.idea/scopes/Apply_copyright.xml
index a2575f774..0eb589133 100644
--- a/.idea/scopes/Apply_copyright.xml
+++ b/.idea/scopes/Apply_copyright.xml
@@ -1,3 +1,4 @@
-
-
\ No newline at end of file
+
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a19b1f467..12540821e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,12 +13,8 @@
- Extended operations for ND4J fields
- Jupyter Notebook integration module (kmath-jupyter)
- `@PerformancePitfall` annotation to mark possibly slow API
-- Unified architecture for Integration and Optimization using features.
- `BigInt` operation performance improvement and fixes by @zhelenskiy (#328)
- Integration between `MST` and Symja `IExpr`
-- Complex power
-- Separate methods for UInt, Int and Number powers. NaN safety.
-- Tensorflow prototype
### Changed
- Exponential operations merged with hyperbolic functions
@@ -40,17 +36,8 @@
- Remove Any restriction on polynomials
- Add `out` variance to type parameters of `StructureND` and its implementations where possible
- Rename `DifferentiableMstExpression` to `KotlingradExpression`
-- `FeatureSet` now accepts only `Feature`. It is possible to override keys and use interfaces.
-- Use `Symbol` factory function instead of `StringSymbol`
-- New discoverability pattern: `.algebra.`
-- Adjusted commons-math API for linear solvers to match conventions.
-- Buffer algebra does not require size anymore
-- Operations -> Ops
-- Default Buffer and ND algebras are now Ops and lack neutral elements (0, 1) as well as algebra-level shapes.
-- Tensor algebra takes read-only structures as input and inherits AlgebraND
### Deprecated
-- Specialized `DoubleBufferAlgebra`
### Removed
- Nearest in Domain. To be implemented in geometry package.
@@ -60,7 +47,6 @@
- Expression algebra builders
- Complex and Quaternion no longer are elements.
- Second generic from DifferentiableExpression
-- Algebra elements are completely removed. Use algebra contexts instead.
### Fixed
- Ring inherits RingOperations, not GroupOperations
diff --git a/README.md b/README.md
index aea94f529..db069d4e0 100644
--- a/README.md
+++ b/README.md
@@ -50,20 +50,52 @@ module definitions below. The module stability could have the following levels:
with [binary-compatibility-validator](https://github.com/Kotlin/binary-compatibility-validator) tool.
* **STABLE**. The API stabilized. Breaking changes are allowed only in major releases.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
## Modules
+
-### [benchmarks](benchmarks)
+* ### [benchmarks](benchmarks)
>
>
> **Maturity**: EXPERIMENTAL
+
-### [examples](examples)
+* ### [examples](examples)
>
>
> **Maturity**: EXPERIMENTAL
+
-### [kmath-ast](kmath-ast)
+* ### [kmath-ast](kmath-ast)
>
>
> **Maturity**: EXPERIMENTAL
@@ -74,13 +106,15 @@ module definitions below. The module stability could have the following levels:
> - [mst-js-codegen](kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/estree.kt) : Dynamic MST to JS compiler
> - [rendering](kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/rendering/MathRenderer.kt) : Extendable MST rendering
+
-### [kmath-commons](kmath-commons)
+* ### [kmath-commons](kmath-commons)
>
>
> **Maturity**: EXPERIMENTAL
+
-### [kmath-complex](kmath-complex)
+* ### [kmath-complex](kmath-complex)
> Complex numbers and quaternions.
>
> **Maturity**: PROTOTYPE
@@ -89,8 +123,9 @@ module definitions below. The module stability could have the following levels:
> - [complex](kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Complex.kt) : Complex Numbers
> - [quaternion](kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt) : Quaternions
+
-### [kmath-core](kmath-core)
+* ### [kmath-core](kmath-core)
> Core classes, algebra definitions, basic linear algebra
>
> **Maturity**: DEVELOPMENT
@@ -106,18 +141,21 @@ performance calculations to code generation.
> - [domains](kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains) : Domains
> - [autodiff](kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/SimpleAutoDiff.kt) : Automatic differentiation
+
-### [kmath-coroutines](kmath-coroutines)
+* ### [kmath-coroutines](kmath-coroutines)
>
>
> **Maturity**: EXPERIMENTAL
+
-### [kmath-dimensions](kmath-dimensions)
+* ### [kmath-dimensions](kmath-dimensions)
>
>
> **Maturity**: PROTOTYPE
+
-### [kmath-ejml](kmath-ejml)
+* ### [kmath-ejml](kmath-ejml)
>
>
> **Maturity**: PROTOTYPE
@@ -127,8 +165,9 @@ performance calculations to code generation.
> - [ejml-matrix](kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt) : Matrix implementation.
> - [ejml-linear-space](kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt) : LinearSpace implementations.
+
-### [kmath-for-real](kmath-for-real)
+* ### [kmath-for-real](kmath-for-real)
> Extension module that should be used to achieve numpy-like behavior.
All operations are specialized to work with `Double` numbers without declaring algebraic contexts.
One can still use generic algebras though.
@@ -140,8 +179,9 @@ One can still use generic algebras though.
> - [DoubleMatrix](kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/DoubleMatrix.kt) : Numpy-like operations for 2d real structures
> - [grids](kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/structures/grids.kt) : Uniform grid generators
+
-### [kmath-functions](kmath-functions)
+* ### [kmath-functions](kmath-functions)
>
>
> **Maturity**: EXPERIMENTAL
@@ -153,18 +193,21 @@ One can still use generic algebras though.
> - [spline interpolation](kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt) : Cubic spline XY interpolator.
> - [integration](kmath-functions/#) : Univariate and multivariate quadratures
+
-### [kmath-geometry](kmath-geometry)
+* ### [kmath-geometry](kmath-geometry)
>
>
> **Maturity**: PROTOTYPE
+
-### [kmath-histograms](kmath-histograms)
+* ### [kmath-histograms](kmath-histograms)
>
>
> **Maturity**: PROTOTYPE
+
-### [kmath-jafama](kmath-jafama)
+* ### [kmath-jafama](kmath-jafama)
>
>
> **Maturity**: PROTOTYPE
@@ -172,13 +215,15 @@ One can still use generic algebras though.
> **Features:**
> - [jafama-double](kmath-jafama/src/main/kotlin/space/kscience/kmath/jafama/) : Double ExtendedField implementations based on Jafama
+
-### [kmath-jupyter](kmath-jupyter)
+* ### [kmath-jupyter](kmath-jupyter)
>
>
> **Maturity**: PROTOTYPE
+
-### [kmath-kotlingrad](kmath-kotlingrad)
+* ### [kmath-kotlingrad](kmath-kotlingrad)
>
>
> **Maturity**: EXPERIMENTAL
@@ -187,18 +232,15 @@ One can still use generic algebras though.
> - [differentiable-mst-expression](kmath-kotlingrad/src/main/kotlin/space/kscience/kmath/kotlingrad/KotlingradExpression.kt) : MST based DifferentiableExpression.
> - [scalars-adapters](kmath-kotlingrad/src/main/kotlin/space/kscience/kmath/kotlingrad/scalarsAdapters.kt) : Conversions between Kotlin∇'s SFun and MST
+
-### [kmath-memory](kmath-memory)
+* ### [kmath-memory](kmath-memory)
> An API and basic implementation for arranging objects in a continuous memory block.
>
> **Maturity**: DEVELOPMENT
+
-### [kmath-multik](kmath-multik)
->
->
-> **Maturity**: PROTOTYPE
-
-### [kmath-nd4j](kmath-nd4j)
+* ### [kmath-nd4j](kmath-nd4j)
>
>
> **Maturity**: EXPERIMENTAL
@@ -208,28 +250,21 @@ One can still use generic algebras though.
> - [nd4jarrayrings](kmath-nd4j/#) : Rings over Nd4jArrayStructure of Int and Long
> - [nd4jarrayfields](kmath-nd4j/#) : Fields over Nd4jArrayStructure of Float and Double
+
-### [kmath-optimization](kmath-optimization)
+* ### [kmath-stat](kmath-stat)
>
>
> **Maturity**: EXPERIMENTAL
+
-### [kmath-stat](kmath-stat)
->
->
-> **Maturity**: EXPERIMENTAL
-
-### [kmath-symja](kmath-symja)
+* ### [kmath-symja](kmath-symja)
>
>
> **Maturity**: PROTOTYPE
+
-### [kmath-tensorflow](kmath-tensorflow)
->
->
-> **Maturity**: PROTOTYPE
-
-### [kmath-tensors](kmath-tensors)
+* ### [kmath-tensors](kmath-tensors)
>
>
> **Maturity**: PROTOTYPE
@@ -239,11 +274,13 @@ One can still use generic algebras though.
> - [tensor algebra with broadcasting](kmath-tensors/src/commonMain/kotlin/space/kscience/kmath/tensors/core/BroadcastDoubleTensorAlgebra.kt) : Basic linear algebra operations implemented with broadcasting.
> - [linear algebra operations](kmath-tensors/src/commonMain/kotlin/space/kscience/kmath/tensors/api/LinearOpsTensorAlgebra.kt) : Advanced linear algebra operations like LU decomposition, SVD, etc.
+
-### [kmath-viktor](kmath-viktor)
+* ### [kmath-viktor](kmath-viktor)
>
>
> **Maturity**: DEVELOPMENT
+
## Multi-platform support
@@ -282,8 +319,8 @@ repositories {
}
dependencies {
- api("space.kscience:kmath-core:$version")
- // api("space.kscience:kmath-core-jvm:$version") for jvm-specific version
+ api("space.kscience:kmath-core:0.3.0-dev-14")
+ // api("space.kscience:kmath-core-jvm:0.3.0-dev-14") for jvm-specific version
}
```
diff --git a/benchmarks/README.md b/benchmarks/README.md
deleted file mode 100644
index cd8fbafd3..000000000
--- a/benchmarks/README.md
+++ /dev/null
@@ -1,4 +0,0 @@
-# Module benchmarks
-
-
-
diff --git a/benchmarks/build.gradle.kts b/benchmarks/build.gradle.kts
index 22712816d..d96c5a8b6 100644
--- a/benchmarks/build.gradle.kts
+++ b/benchmarks/build.gradle.kts
@@ -13,22 +13,19 @@ sourceSets.register("benchmarks")
repositories {
mavenCentral()
+ maven("https://repo.kotlin.link")
+ maven("https://clojars.org/repo")
+ maven("https://jitpack.io")
+
+ maven("http://logicrunch.research.it.uu.se/maven") {
+ isAllowInsecureProtocol = true
+ }
}
kotlin {
jvm()
- js(IR) {
- nodejs()
- }
-
sourceSets {
- all {
- languageSettings {
- progressiveMode = true
- }
- }
-
val commonMain by getting {
dependencies {
implementation(project(":kmath-ast"))
@@ -38,8 +35,8 @@ kotlin {
implementation(project(":kmath-stat"))
implementation(project(":kmath-dimensions"))
implementation(project(":kmath-for-real"))
- implementation(project(":kmath-tensors"))
- implementation("org.jetbrains.kotlinx:kotlinx-benchmark-runtime:0.4.2")
+ implementation(project(":kmath-jafama"))
+ implementation("org.jetbrains.kotlinx:kotlinx-benchmark-runtime:0.3.1")
}
}
@@ -50,10 +47,6 @@ kotlin {
implementation(project(":kmath-nd4j"))
implementation(project(":kmath-kotlingrad"))
implementation(project(":kmath-viktor"))
- implementation(project(":kmath-jafama"))
- implementation(project(":kmath-multik"))
- implementation(projects.kmath.kmathTensorflow)
- implementation("org.tensorflow:tensorflow-core-platform:0.4.0")
implementation("org.nd4j:nd4j-native:1.0.0-M1")
// uncomment if your system supports AVX2
// val os = System.getProperty("os.name")
@@ -74,13 +67,12 @@ benchmark {
// Setup configurations
targets {
register("jvm")
- register("js")
}
fun kotlinx.benchmark.gradle.BenchmarkConfiguration.commonConfiguration() {
- warmups = 2
+ warmups = 1
iterations = 5
- iterationTime = 2000
+ iterationTime = 1000
iterationTimeUnit = "ms"
}
@@ -89,23 +81,13 @@ benchmark {
include("BufferBenchmark")
}
- configurations.register("nd") {
- commonConfiguration()
- include("NDFieldBenchmark")
- }
-
configurations.register("dot") {
commonConfiguration()
include("DotBenchmark")
}
configurations.register("expressions") {
- // Some extra precision
- warmups = 2
- iterations = 10
- iterationTime = 10
- iterationTimeUnit = "s"
- outputTimeUnit = "s"
+ commonConfiguration()
include("ExpressionsInterpretersBenchmark")
}
@@ -123,21 +105,6 @@ benchmark {
commonConfiguration()
include("JafamaBenchmark")
}
-
- configurations.register("tensorAlgebra") {
- commonConfiguration()
- include("TensorAlgebraBenchmark")
- }
-
- configurations.register("viktor") {
- commonConfiguration()
- include("ViktorBenchmark")
- }
-
- configurations.register("viktorLog") {
- commonConfiguration()
- include("ViktorLogBenchmark")
- }
}
// Fix kotlinx-benchmarks bug
@@ -147,21 +114,23 @@ afterEvaluate {
}
}
+
kotlin.sourceSets.all {
with(languageSettings) {
- optIn("kotlin.contracts.ExperimentalContracts")
- optIn("kotlin.ExperimentalUnsignedTypes")
- optIn("space.kscience.kmath.misc.UnstableKMathAPI")
+ useExperimentalAnnotation("kotlin.contracts.ExperimentalContracts")
+ useExperimentalAnnotation("kotlin.ExperimentalUnsignedTypes")
+ useExperimentalAnnotation("space.kscience.kmath.misc.UnstableKMathAPI")
}
}
-tasks.withType {
+tasks.withType {
kotlinOptions {
jvmTarget = "11"
- freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all" + "-Xlambdas=indy"
+ freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all"
}
}
+
readme {
maturity = ru.mipt.npm.gradle.Maturity.EXPERIMENTAL
}
diff --git a/benchmarks/src/jsMain/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt b/benchmarks/src/jsMain/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt
deleted file mode 100644
index 126a2e648..000000000
--- a/benchmarks/src/jsMain/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * 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.
- */
-
-package space.kscience.kmath.benchmarks
-
-import kotlinx.benchmark.Benchmark
-import kotlinx.benchmark.Blackhole
-import kotlinx.benchmark.Scope
-import kotlinx.benchmark.State
-import space.kscience.kmath.expressions.*
-import space.kscience.kmath.operations.Algebra
-import space.kscience.kmath.operations.DoubleField
-import space.kscience.kmath.operations.bindSymbol
-import space.kscience.kmath.operations.invoke
-import kotlin.math.sin
-import kotlin.random.Random
-import space.kscience.kmath.estree.compileToExpression as estreeCompileToExpression
-import space.kscience.kmath.wasm.compileToExpression as wasmCompileToExpression
-
-@State(Scope.Benchmark)
-class ExpressionsInterpretersBenchmark {
- /**
- * Benchmark case for [Expression] created with [expressionInExtendedField].
- */
- @Benchmark
- fun functionalExpression(blackhole: Blackhole) = invokeAndSum(functional, blackhole)
-
- /**
- * Benchmark case for [Expression] created with [toExpression].
- */
- @Benchmark
- fun mstExpression(blackhole: Blackhole) = invokeAndSum(mst, blackhole)
-
- /**
- * Benchmark case for [Expression] created with [compileToExpression].
- */
- @Benchmark
- fun wasmExpression(blackhole: Blackhole) = invokeAndSum(wasm, blackhole)
-
- /**
- * Benchmark case for [Expression] created with [compileToExpression].
- */
- @Benchmark
- fun estreeExpression(blackhole: Blackhole) = invokeAndSum(estree, blackhole)
-
- /**
- * Benchmark case for [Expression] implemented manually with `kotlin.math` functions.
- */
- @Benchmark
- fun rawExpression(blackhole: Blackhole) = invokeAndSum(raw, blackhole)
-
- /**
- * Benchmark case for direct computation w/o [Expression].
- */
- @Benchmark
- fun justCalculate(blackhole: Blackhole) {
- val random = Random(0)
- var sum = 0.0
-
- repeat(times) {
- val x = random.nextDouble()
- sum += x * 2.0 + 2.0 / x - 16.0 / sin(x)
- }
-
- blackhole.consume(sum)
- }
-
- private fun invokeAndSum(expr: Expression, blackhole: Blackhole) {
- val random = Random(0)
- var sum = 0.0
- val m = HashMap()
-
- repeat(times) {
- m[x] = random.nextDouble()
- sum += expr(m)
- }
-
- blackhole.consume(sum)
- }
-
- private companion object {
- private val x by symbol
- private const val times = 1_000_000
-
- private val functional = DoubleField.expression {
- val x = bindSymbol(Symbol.x)
- x * number(2.0) + 2.0 / x - 16.0 / sin(x)
- }
-
- private val node = MstExtendedField {
- x * 2.0 + number(2.0) / x - number(16.0) / sin(x)
- }
-
- private val mst = node.toExpression(DoubleField)
- private val wasm = node.wasmCompileToExpression(DoubleField)
- private val estree = node.estreeCompileToExpression(DoubleField)
-
- private val raw = Expression { args ->
- val x = args[x]!!
- x * 2.0 + 2.0 / x - 16.0 / sin(x)
- }
- }
-}
diff --git a/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ArrayBenchmark.kt b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ArrayBenchmark.kt
index ff933997f..17983e88c 100644
--- a/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ArrayBenchmark.kt
+++ b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ArrayBenchmark.kt
@@ -1,6 +1,6 @@
/*
* 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 file.
*/
package space.kscience.kmath.benchmarks
diff --git a/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/BigIntBenchmark.kt b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/BigIntBenchmark.kt
index 188a48ca7..6f501dedb 100644
--- a/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/BigIntBenchmark.kt
+++ b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/BigIntBenchmark.kt
@@ -1,6 +1,6 @@
/*
* 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 file.
*/
package space.kscience.kmath.benchmarks
@@ -11,10 +11,7 @@ import org.openjdk.jmh.annotations.Benchmark
import org.openjdk.jmh.annotations.Scope
import org.openjdk.jmh.annotations.State
import space.kscience.kmath.misc.UnstableKMathAPI
-import space.kscience.kmath.operations.BigIntField
-import space.kscience.kmath.operations.JBigIntegerField
-import space.kscience.kmath.operations.invoke
-import space.kscience.kmath.operations.parseBigInteger
+import space.kscience.kmath.operations.*
import java.math.BigInteger
@@ -22,24 +19,12 @@ import java.math.BigInteger
@State(Scope.Benchmark)
internal class BigIntBenchmark {
- val kmSmallNumber = BigIntField.number(100)
- val jvmSmallNumber = JBigIntegerField.number(100)
val kmNumber = BigIntField.number(Int.MAX_VALUE)
val jvmNumber = JBigIntegerField.number(Int.MAX_VALUE)
- val kmLargeNumber = BigIntField { number(11).pow(100_000U) }
- val jvmLargeNumber: BigInteger = JBigIntegerField { number(11).pow(100_000) }
+ val largeKmNumber = BigIntField { number(11).pow(100_000U) }
+ val largeJvmNumber: BigInteger = JBigIntegerField { number(11).pow(100_000) }
val bigExponent = 50_000
- @Benchmark
- fun kmSmallAdd(blackhole: Blackhole) = BigIntField {
- blackhole.consume(kmSmallNumber + kmSmallNumber + kmSmallNumber)
- }
-
- @Benchmark
- fun jvmSmallAdd(blackhole: Blackhole) = JBigIntegerField {
- blackhole.consume(jvmSmallNumber + jvmSmallNumber + jvmSmallNumber)
- }
-
@Benchmark
fun kmAdd(blackhole: Blackhole) = BigIntField {
blackhole.consume(kmNumber + kmNumber + kmNumber)
@@ -52,12 +37,12 @@ internal class BigIntBenchmark {
@Benchmark
fun kmAddLarge(blackhole: Blackhole) = BigIntField {
- blackhole.consume(kmLargeNumber + kmLargeNumber + kmLargeNumber)
+ blackhole.consume(largeKmNumber + largeKmNumber + largeKmNumber)
}
@Benchmark
fun jvmAddLarge(blackhole: Blackhole) = JBigIntegerField {
- blackhole.consume(jvmLargeNumber + jvmLargeNumber + jvmLargeNumber)
+ blackhole.consume(largeJvmNumber + largeJvmNumber + largeJvmNumber)
}
@Benchmark
@@ -67,7 +52,7 @@ internal class BigIntBenchmark {
@Benchmark
fun kmMultiplyLarge(blackhole: Blackhole) = BigIntField {
- blackhole.consume(kmLargeNumber*kmLargeNumber)
+ blackhole.consume(largeKmNumber*largeKmNumber)
}
@Benchmark
@@ -77,7 +62,7 @@ internal class BigIntBenchmark {
@Benchmark
fun jvmMultiplyLarge(blackhole: Blackhole) = JBigIntegerField {
- blackhole.consume(jvmLargeNumber*jvmLargeNumber)
+ blackhole.consume(largeJvmNumber*largeJvmNumber)
}
@Benchmark
diff --git a/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/BufferBenchmark.kt b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/BufferBenchmark.kt
index 39819d407..5cf194b67 100644
--- a/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/BufferBenchmark.kt
+++ b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/BufferBenchmark.kt
@@ -1,6 +1,6 @@
/*
* 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 file.
*/
package space.kscience.kmath.benchmarks
diff --git a/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt
index 7d5ae310b..629408479 100644
--- a/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt
+++ b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt
@@ -1,6 +1,6 @@
/*
* 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 file.
*/
package space.kscience.kmath.benchmarks
@@ -11,15 +11,9 @@ import kotlinx.benchmark.Scope
import kotlinx.benchmark.State
import space.kscience.kmath.commons.linear.CMLinearSpace
import space.kscience.kmath.ejml.EjmlLinearSpaceDDRM
+import space.kscience.kmath.linear.LinearSpace
import space.kscience.kmath.linear.invoke
-import space.kscience.kmath.linear.linearSpace
-import space.kscience.kmath.multik.multikAlgebra
import space.kscience.kmath.operations.DoubleField
-import space.kscience.kmath.operations.invoke
-import space.kscience.kmath.structures.Buffer
-import space.kscience.kmath.tensorflow.produceWithTF
-import space.kscience.kmath.tensors.core.DoubleTensorAlgebra
-import space.kscience.kmath.tensors.core.tensorAlgebra
import kotlin.random.Random
@State(Scope.Benchmark)
@@ -29,12 +23,8 @@ internal class DotBenchmark {
const val dim = 1000
//creating invertible matrix
- val matrix1 = DoubleField.linearSpace.buildMatrix(dim, dim) { _, _ ->
- random.nextDouble()
- }
- val matrix2 = DoubleField.linearSpace.buildMatrix(dim, dim) { _, _ ->
- random.nextDouble()
- }
+ val matrix1 = LinearSpace.real.buildMatrix(dim, dim) { i, j -> if (i <= j) random.nextDouble() else 0.0 }
+ val matrix2 = LinearSpace.real.buildMatrix(dim, dim) { i, j -> if (i <= j) random.nextDouble() else 0.0 }
val cmMatrix1 = CMLinearSpace { matrix1.toCM() }
val cmMatrix2 = CMLinearSpace { matrix2.toCM() }
@@ -43,58 +33,38 @@ internal class DotBenchmark {
val ejmlMatrix2 = EjmlLinearSpaceDDRM { matrix2.toEjml() }
}
-
@Benchmark
- fun tfDot(blackhole: Blackhole) {
- blackhole.consume(
- DoubleField.produceWithTF {
- matrix1 dot matrix1
- }
- )
+ fun cmDot(blackhole: Blackhole) {
+ CMLinearSpace.run {
+ blackhole.consume(cmMatrix1 dot cmMatrix2)
+ }
}
@Benchmark
- fun cmDotWithConversion(blackhole: Blackhole) = CMLinearSpace {
- blackhole.consume(matrix1 dot matrix2)
+ fun ejmlDot(blackhole: Blackhole) {
+ EjmlLinearSpaceDDRM {
+ blackhole.consume(ejmlMatrix1 dot ejmlMatrix2)
+ }
}
@Benchmark
- fun cmDot(blackhole: Blackhole) = CMLinearSpace {
- blackhole.consume(cmMatrix1 dot cmMatrix2)
+ fun ejmlDotWithConversion(blackhole: Blackhole) {
+ EjmlLinearSpaceDDRM {
+ blackhole.consume(matrix1 dot matrix2)
+ }
}
@Benchmark
- fun ejmlDot(blackhole: Blackhole) = EjmlLinearSpaceDDRM {
- blackhole.consume(ejmlMatrix1 dot ejmlMatrix2)
+ fun bufferedDot(blackhole: Blackhole) {
+ LinearSpace.auto(DoubleField).invoke {
+ blackhole.consume(matrix1 dot matrix2)
+ }
}
@Benchmark
- fun ejmlDotWithConversion(blackhole: Blackhole) = EjmlLinearSpaceDDRM {
- blackhole.consume(matrix1 dot matrix2)
- }
-
- @Benchmark
- fun tensorDot(blackhole: Blackhole) = with(DoubleField.tensorAlgebra) {
- blackhole.consume(matrix1 dot matrix2)
- }
-
- @Benchmark
- fun multikDot(blackhole: Blackhole) = with(DoubleField.multikAlgebra) {
- blackhole.consume(matrix1 dot matrix2)
- }
-
- @Benchmark
- fun bufferedDot(blackhole: Blackhole) = with(DoubleField.linearSpace(Buffer.Companion::auto)) {
- blackhole.consume(matrix1 dot matrix2)
- }
-
- @Benchmark
- fun doubleDot(blackhole: Blackhole) = with(DoubleField.linearSpace) {
- blackhole.consume(matrix1 dot matrix2)
- }
-
- @Benchmark
- fun doubleTensorDot(blackhole: Blackhole) = DoubleTensorAlgebra.invoke {
- blackhole.consume(matrix1 dot matrix2)
+ fun realDot(blackhole: Blackhole) {
+ LinearSpace.real {
+ blackhole.consume(matrix1 dot matrix2)
+ }
}
}
diff --git a/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt
index db3524e67..8c3c8ec2b 100644
--- a/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt
+++ b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt
@@ -1,6 +1,6 @@
/*
* 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 file.
*/
package space.kscience.kmath.benchmarks
@@ -11,7 +11,6 @@ import kotlinx.benchmark.Scope
import kotlinx.benchmark.State
import space.kscience.kmath.asm.compileToExpression
import space.kscience.kmath.expressions.*
-import space.kscience.kmath.operations.Algebra
import space.kscience.kmath.operations.DoubleField
import space.kscience.kmath.operations.bindSymbol
import space.kscience.kmath.operations.invoke
@@ -36,30 +35,7 @@ internal class ExpressionsInterpretersBenchmark {
* Benchmark case for [Expression] created with [compileToExpression].
*/
@Benchmark
- fun asmGenericExpression(blackhole: Blackhole) = invokeAndSum(asmGeneric, blackhole)
-
- /**
- * Benchmark case for [Expression] created with [compileToExpression].
- */
- @Benchmark
- fun asmPrimitiveExpressionArray(blackhole: Blackhole) {
- val random = Random(0)
- var sum = 0.0
- val m = DoubleArray(1)
-
- repeat(times) {
- m[xIdx] = random.nextDouble()
- sum += asmPrimitive(m)
- }
-
- blackhole.consume(sum)
- }
-
- /**
- * Benchmark case for [Expression] created with [compileToExpression].
- */
- @Benchmark
- fun asmPrimitiveExpression(blackhole: Blackhole) = invokeAndSum(asmPrimitive, blackhole)
+ fun asmExpression(blackhole: Blackhole) = invokeAndSum(asm, blackhole)
/**
* Benchmark case for [Expression] implemented manually with `kotlin.math` functions.
@@ -86,11 +62,9 @@ internal class ExpressionsInterpretersBenchmark {
private fun invokeAndSum(expr: Expression, blackhole: Blackhole) {
val random = Random(0)
var sum = 0.0
- val m = HashMap()
repeat(times) {
- m[x] = random.nextDouble()
- sum += expr(m)
+ sum += expr(x to random.nextDouble())
}
blackhole.consume(sum)
@@ -98,11 +72,11 @@ internal class ExpressionsInterpretersBenchmark {
private companion object {
private val x by symbol
+ private val algebra = DoubleField
private const val times = 1_000_000
- private val functional = DoubleField.expression {
- val x = bindSymbol(Symbol.x)
- x * number(2.0) + 2.0 / x - 16.0 / sin(x)
+ private val functional = DoubleField.expressionInExtendedField {
+ bindSymbol(x) * number(2.0) + number(2.0) / bindSymbol(x) - number(16.0) / sin(bindSymbol(x))
}
private val node = MstExtendedField {
@@ -110,11 +84,7 @@ internal class ExpressionsInterpretersBenchmark {
}
private val mst = node.toExpression(DoubleField)
-
- private val asmPrimitive = node.compileToExpression(DoubleField)
- private val xIdx = asmPrimitive.indexer.indexOf(x)
-
- private val asmGeneric = node.compileToExpression(DoubleField as Algebra)
+ private val asm = node.compileToExpression(DoubleField)
private val raw = Expression { args ->
val x = args[x]!!
diff --git a/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/JafamaBenchmark.kt b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/JafamaBenchmark.kt
index 5d4eee7c0..9c6551302 100644
--- a/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/JafamaBenchmark.kt
+++ b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/JafamaBenchmark.kt
@@ -1,6 +1,6 @@
/*
* 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 file.
*/
package space.kscience.kmath.benchmarks
diff --git a/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/MatrixInverseBenchmark.kt b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/MatrixInverseBenchmark.kt
index 4ff687aac..1072a55c3 100644
--- a/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/MatrixInverseBenchmark.kt
+++ b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/MatrixInverseBenchmark.kt
@@ -1,6 +1,6 @@
/*
* 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 file.
*/
package space.kscience.kmath.benchmarks
@@ -10,12 +10,13 @@ import kotlinx.benchmark.Blackhole
import kotlinx.benchmark.Scope
import kotlinx.benchmark.State
import space.kscience.kmath.commons.linear.CMLinearSpace
-import space.kscience.kmath.commons.linear.lupSolver
+import space.kscience.kmath.commons.linear.inverse
import space.kscience.kmath.ejml.EjmlLinearSpaceDDRM
+import space.kscience.kmath.linear.InverseMatrixFeature
+import space.kscience.kmath.linear.LinearSpace
+import space.kscience.kmath.linear.inverseWithLup
import space.kscience.kmath.linear.invoke
-import space.kscience.kmath.linear.linearSpace
-import space.kscience.kmath.linear.lupSolver
-import space.kscience.kmath.operations.algebra
+import space.kscience.kmath.nd.getFeature
import kotlin.random.Random
@State(Scope.Benchmark)
@@ -24,7 +25,7 @@ internal class MatrixInverseBenchmark {
private val random = Random(1224)
private const val dim = 100
- private val space = Double.algebra.linearSpace
+ private val space = LinearSpace.real
//creating invertible matrix
private val u = space.buildMatrix(dim, dim) { i, j -> if (i <= j) random.nextDouble() else 0.0 }
@@ -34,20 +35,20 @@ internal class MatrixInverseBenchmark {
@Benchmark
fun kmathLupInversion(blackhole: Blackhole) {
- blackhole.consume(Double.algebra.linearSpace.lupSolver().inverse(matrix))
+ blackhole.consume(LinearSpace.real.inverseWithLup(matrix))
}
@Benchmark
fun cmLUPInversion(blackhole: Blackhole) {
CMLinearSpace {
- blackhole.consume(lupSolver().inverse(matrix))
+ blackhole.consume(inverse(matrix))
}
}
@Benchmark
fun ejmlInverse(blackhole: Blackhole) {
EjmlLinearSpaceDDRM {
- blackhole.consume(matrix.toEjml().inverse())
+ blackhole.consume(matrix.getFeature>()?.inverse)
}
}
}
diff --git a/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/NDFieldBenchmark.kt b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/NDFieldBenchmark.kt
index e3b3dde05..0cd9a46ab 100644
--- a/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/NDFieldBenchmark.kt
+++ b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/NDFieldBenchmark.kt
@@ -1,6 +1,6 @@
/*
* 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 file.
*/
package space.kscience.kmath.benchmarks
@@ -9,97 +9,45 @@ import kotlinx.benchmark.Benchmark
import kotlinx.benchmark.Blackhole
import kotlinx.benchmark.Scope
import kotlinx.benchmark.State
-import org.jetbrains.kotlinx.multik.api.Multik
-import org.jetbrains.kotlinx.multik.api.ones
-import org.jetbrains.kotlinx.multik.ndarray.data.DN
-import org.jetbrains.kotlinx.multik.ndarray.data.DataType
-import space.kscience.kmath.multik.multikAlgebra
-import space.kscience.kmath.nd.BufferedFieldOpsND
-import space.kscience.kmath.nd.StructureND
-import space.kscience.kmath.nd.ndAlgebra
-import space.kscience.kmath.nd.one
-import space.kscience.kmath.nd4j.nd4j
+import space.kscience.kmath.nd.*
import space.kscience.kmath.operations.DoubleField
import space.kscience.kmath.structures.Buffer
-import space.kscience.kmath.tensors.core.DoubleTensor
-import space.kscience.kmath.tensors.core.one
-import space.kscience.kmath.tensors.core.tensorAlgebra
-import space.kscience.kmath.viktor.viktorAlgebra
@State(Scope.Benchmark)
internal class NDFieldBenchmark {
@Benchmark
- fun autoFieldAdd(blackhole: Blackhole) = with(autoField) {
- var res: StructureND = one(shape)
- repeat(n) { res += 1.0 }
- blackhole.consume(res)
+ fun autoFieldAdd(blackhole: Blackhole) {
+ with(autoField) {
+ var res: StructureND = one
+ repeat(n) { res += one }
+ blackhole.consume(res)
+ }
}
@Benchmark
- fun specializedFieldAdd(blackhole: Blackhole) = with(specializedField) {
- var res: StructureND = one(shape)
- repeat(n) { res += 1.0 }
- blackhole.consume(res)
+ fun specializedFieldAdd(blackhole: Blackhole) {
+ with(specializedField) {
+ var res: StructureND = one
+ repeat(n) { res += 1.0 }
+ blackhole.consume(res)
+ }
}
+
@Benchmark
- fun boxingFieldAdd(blackhole: Blackhole) = with(genericField) {
- var res: StructureND = one(shape)
- repeat(n) { res += 1.0 }
- blackhole.consume(res)
+ fun boxingFieldAdd(blackhole: Blackhole) {
+ with(genericField) {
+ var res: StructureND = one
+ repeat(n) { res += 1.0 }
+ blackhole.consume(res)
+ }
}
- @Benchmark
- fun multikAdd(blackhole: Blackhole) = with(multikField) {
- var res: StructureND = one(shape)
- repeat(n) { res += 1.0 }
- blackhole.consume(res)
- }
-
- @Benchmark
- fun viktorAdd(blackhole: Blackhole) = with(viktorField) {
- var res: StructureND = one(shape)
- repeat(n) { res += 1.0 }
- blackhole.consume(res)
- }
-
- @Benchmark
- fun tensorAdd(blackhole: Blackhole) = with(Double.tensorAlgebra) {
- var res: DoubleTensor = one(shape)
- repeat(n) { res = res + 1.0 }
- blackhole.consume(res)
- }
-
- @Benchmark
- fun tensorInPlaceAdd(blackhole: Blackhole) = with(Double.tensorAlgebra) {
- val res: DoubleTensor = one(shape)
- repeat(n) { res += 1.0 }
- blackhole.consume(res)
- }
-
- @Benchmark
- fun multikInPlaceAdd(blackhole: Blackhole) = with(DoubleField.multikAlgebra) {
- val res = Multik.ones(shape, DataType.DoubleDataType).wrap()
- repeat(n) { res += 1.0 }
- blackhole.consume(res)
- }
-
-// @Benchmark
-// fun nd4jAdd(blackhole: Blackhole) = with(nd4jField) {
-// var res: StructureND = one(dim, dim)
-// repeat(n) { res += 1.0 }
-// blackhole.consume(res)
-// }
-
private companion object {
private const val dim = 1000
private const val n = 100
- private val shape = intArrayOf(dim, dim)
- private val autoField = BufferedFieldOpsND(DoubleField, Buffer.Companion::auto)
- private val specializedField = DoubleField.ndAlgebra
- private val genericField = BufferedFieldOpsND(DoubleField, Buffer.Companion::boxing)
- private val nd4jField = DoubleField.nd4j
- private val multikField = DoubleField.multikAlgebra
- private val viktorField = DoubleField.viktorAlgebra
+ private val autoField = AlgebraND.auto(DoubleField, dim, dim)
+ private val specializedField = AlgebraND.real(dim, dim)
+ private val genericField = AlgebraND.field(DoubleField, Buffer.Companion::boxing, dim, dim)
}
}
diff --git a/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/TensorAlgebraBenchmark.kt b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/TensorAlgebraBenchmark.kt
deleted file mode 100644
index 38e064e53..000000000
--- a/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/TensorAlgebraBenchmark.kt
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.
- */
-
-package space.kscience.kmath.benchmarks
-
-import kotlinx.benchmark.Benchmark
-import kotlinx.benchmark.Blackhole
-import kotlinx.benchmark.Scope
-import kotlinx.benchmark.State
-import space.kscience.kmath.linear.linearSpace
-import space.kscience.kmath.linear.matrix
-import space.kscience.kmath.linear.symmetric
-import space.kscience.kmath.operations.DoubleField
-import space.kscience.kmath.tensors.core.tensorAlgebra
-import kotlin.random.Random
-
-@State(Scope.Benchmark)
-internal class TensorAlgebraBenchmark {
- companion object {
- private val random = Random(12224)
- private const val dim = 30
-
- private val matrix = DoubleField.linearSpace.matrix(dim, dim).symmetric { _, _ -> random.nextDouble() }
- }
-
- @Benchmark
- fun tensorSymEigSvd(blackhole: Blackhole) = with(Double.tensorAlgebra) {
- blackhole.consume(matrix.symEigSvd(1e-10))
- }
-
- @Benchmark
- fun tensorSymEigJacobi(blackhole: Blackhole) = with(Double.tensorAlgebra) {
- blackhole.consume(matrix.symEigJacobi(50, 1e-10))
- }
-}
\ No newline at end of file
diff --git a/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ViktorBenchmark.kt b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ViktorBenchmark.kt
index de301678c..1ddc79cf8 100644
--- a/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ViktorBenchmark.kt
+++ b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ViktorBenchmark.kt
@@ -1,6 +1,6 @@
/*
* 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 file.
*/
package space.kscience.kmath.benchmarks
@@ -10,17 +10,19 @@ import kotlinx.benchmark.Blackhole
import kotlinx.benchmark.Scope
import kotlinx.benchmark.State
import org.jetbrains.bio.viktor.F64Array
-import space.kscience.kmath.nd.*
+import space.kscience.kmath.nd.AlgebraND
+import space.kscience.kmath.nd.StructureND
+import space.kscience.kmath.nd.auto
+import space.kscience.kmath.nd.real
import space.kscience.kmath.operations.DoubleField
-import space.kscience.kmath.structures.Buffer
-import space.kscience.kmath.viktor.ViktorFieldND
+import space.kscience.kmath.viktor.ViktorNDField
@State(Scope.Benchmark)
internal class ViktorBenchmark {
@Benchmark
fun automaticFieldAddition(blackhole: Blackhole) {
with(autoField) {
- var res: StructureND = one(shape)
+ var res: StructureND = one
repeat(n) { res += 1.0 }
blackhole.consume(res)
}
@@ -29,7 +31,7 @@ internal class ViktorBenchmark {
@Benchmark
fun realFieldAddition(blackhole: Blackhole) {
with(realField) {
- var res: StructureND = one(shape)
+ var res: StructureND = one
repeat(n) { res += 1.0 }
blackhole.consume(res)
}
@@ -38,7 +40,7 @@ internal class ViktorBenchmark {
@Benchmark
fun viktorFieldAddition(blackhole: Blackhole) {
with(viktorField) {
- var res = one(shape)
+ var res = one
repeat(n) { res += 1.0 }
blackhole.consume(res)
}
@@ -55,11 +57,10 @@ internal class ViktorBenchmark {
private companion object {
private const val dim = 1000
private const val n = 100
- private val shape = Shape(dim, dim)
// automatically build context most suited for given type.
- private val autoField = BufferedFieldOpsND(DoubleField, Buffer.Companion::auto)
- private val realField = DoubleField.ndAlgebra
- private val viktorField = ViktorFieldND(dim, dim)
+ private val autoField = AlgebraND.auto(DoubleField, dim, dim)
+ private val realField = AlgebraND.real(dim, dim)
+ private val viktorField = ViktorNDField(dim, dim)
}
}
diff --git a/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt
index dfdd89d74..8622e8f30 100644
--- a/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt
+++ b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt
@@ -1,6 +1,6 @@
/*
* 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 file.
*/
package space.kscience.kmath.benchmarks
@@ -10,21 +10,19 @@ import kotlinx.benchmark.Blackhole
import kotlinx.benchmark.Scope
import kotlinx.benchmark.State
import org.jetbrains.bio.viktor.F64Array
-import space.kscience.kmath.nd.BufferedFieldOpsND
-import space.kscience.kmath.nd.Shape
-import space.kscience.kmath.nd.ndAlgebra
-import space.kscience.kmath.nd.one
+import space.kscience.kmath.nd.AlgebraND
+import space.kscience.kmath.nd.auto
+import space.kscience.kmath.nd.real
import space.kscience.kmath.operations.DoubleField
-import space.kscience.kmath.structures.Buffer
import space.kscience.kmath.viktor.ViktorFieldND
@State(Scope.Benchmark)
internal class ViktorLogBenchmark {
@Benchmark
fun realFieldLog(blackhole: Blackhole) {
- with(realField) {
- val fortyTwo = structureND(shape) { 42.0 }
- var res = one(shape)
+ with(realNdField) {
+ val fortyTwo = produce { 42.0 }
+ var res = one
repeat(n) { res = ln(fortyTwo) }
blackhole.consume(res)
}
@@ -33,7 +31,7 @@ internal class ViktorLogBenchmark {
@Benchmark
fun viktorFieldLog(blackhole: Blackhole) {
with(viktorField) {
- val fortyTwo = structureND(shape) { 42.0 }
+ val fortyTwo = produce { 42.0 }
var res = one
repeat(n) { res = ln(fortyTwo) }
blackhole.consume(res)
@@ -51,11 +49,10 @@ internal class ViktorLogBenchmark {
private companion object {
private const val dim = 1000
private const val n = 100
- private val shape = Shape(dim, dim)
// automatically build context most suited for given type.
- private val autoField = BufferedFieldOpsND(DoubleField, Buffer.Companion::auto)
- private val realField = DoubleField.ndAlgebra
- private val viktorField = ViktorFieldND(dim, dim)
+ private val autoField = AlgebraND.auto(DoubleField, dim, dim)
+ private val realNdField = AlgebraND.real(dim, dim)
+ private val viktorField = ViktorFieldND(intArrayOf(dim, dim))
}
}
diff --git a/build.gradle.kts b/build.gradle.kts
index 445976853..6bb19cd35 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,23 +1,31 @@
+import java.net.URL
+
plugins {
id("ru.mipt.npm.gradle.project")
- id("org.jetbrains.kotlinx.kover") version "0.5.0"
+ kotlin("jupyter.api") apply false
}
allprojects {
repositories {
- maven("https://repo.kotlin.link")
+ maven("https://clojars.org/repo")
+ maven("https://jitpack.io")
+
+ maven("http://logicrunch.research.it.uu.se/maven") {
+ isAllowInsecureProtocol = true
+ }
+
maven("https://oss.sonatype.org/content/repositories/snapshots")
mavenCentral()
}
group = "space.kscience"
- version = "0.3.0-dev-20"
+ version = "0.3.0-dev-14"
}
subprojects {
if (name.startsWith("kmath")) apply()
- plugins.withId("org.jetbrains.dokka"){
+ afterEvaluate {
tasks.withType {
dependsOn(tasks["assemble"])
@@ -31,7 +39,7 @@ subprojects {
localDirectory.set(kotlinDir)
remoteUrl.set(
- java.net.URL("https://github.com/mipt-npm/kmath/tree/master/${this@subprojects.name}/$kotlinDirPath")
+ URL("https://github.com/mipt-npm/${rootProject.name}/tree/master/${this@subprojects.name}/$kotlinDirPath")
)
}
@@ -56,9 +64,9 @@ subprojects {
readme.readmeTemplate = file("docs/templates/README-TEMPLATE.md")
ksciencePublish {
- github("kmath", addToRelease = false)
- space()
- sonatype()
+ vcs("https://github.com/mipt-npm/kmath")
+ space(publish = true)
+ sonatype(publish = true)
}
apiValidation.nonPublicMarkers.add("space.kscience.kmath.misc.UnstableKMathAPI")
diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts
index fa5142538..36a1ffd9e 100644
--- a/buildSrc/build.gradle.kts
+++ b/buildSrc/build.gradle.kts
@@ -1,31 +1,20 @@
plugins {
`kotlin-dsl`
- `version-catalog`
- alias(miptNpmLibs.plugins.kotlin.plugin.serialization)
+ kotlin("plugin.serialization") version "1.4.31"
}
-java.targetCompatibility = JavaVersion.VERSION_11
-
repositories {
- mavenLocal()
maven("https://repo.kotlin.link")
mavenCentral()
gradlePluginPortal()
}
-val toolsVersion: String by extra
-val kotlinVersion = miptNpmLibs.versions.kotlin.asProvider().get()
-val benchmarksVersion = miptNpmLibs.versions.kotlinx.benchmark.get()
-
dependencies {
- api("ru.mipt.npm:gradle-tools:$toolsVersion")
- //plugins form benchmarks
- api("org.jetbrains.kotlinx:kotlinx-benchmark-plugin:$benchmarksVersion")
- api("org.jetbrains.kotlin:kotlin-allopen:$kotlinVersion")
- //to be used inside build-script only
- implementation(miptNpmLibs.kotlinx.serialization.json)
+ api("org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0")
+ api("ru.mipt.npm:gradle-tools:0.10.2")
+ api("org.jetbrains.kotlinx:kotlinx-benchmark-plugin:0.3.1")
}
kotlin.sourceSets.all {
- languageSettings.optIn("kotlin.OptIn")
+ languageSettings.useExperimentalAnnotation("kotlin.ExperimentalStdlibApi")
}
diff --git a/buildSrc/gradle.properties b/buildSrc/gradle.properties
deleted file mode 100644
index a0b05e812..000000000
--- a/buildSrc/gradle.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# 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.
-#
-
-kotlin.code.style=official
-toolsVersion=0.11.2-kotlin-1.6.10
diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts
deleted file mode 100644
index 7c1df133d..000000000
--- a/buildSrc/settings.gradle.kts
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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.
- */
-
-enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
-
-dependencyResolutionManagement {
- val toolsVersion: String by extra
-
- repositories {
- mavenLocal()
- maven("https://repo.kotlin.link")
- mavenCentral()
- gradlePluginPortal()
- }
-
- versionCatalogs {
- create("miptNpmLibs") {
- from("ru.mipt.npm: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 eaa0f59d8..6859de845 100644
--- a/buildSrc/src/main/kotlin/space/kscience/kmath/benchmarks/JmhReport.kt
+++ b/buildSrc/src/main/kotlin/space/kscience/kmath/benchmarks/JmhReport.kt
@@ -1,6 +1,6 @@
/*
* 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 file.
*/
package space.kscience.kmath.benchmarks
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 dc9327348..72c9ff0ad 100644
--- a/buildSrc/src/main/kotlin/space/kscience/kmath/benchmarks/addBenchmarkProperties.kt
+++ b/buildSrc/src/main/kotlin/space/kscience/kmath/benchmarks/addBenchmarkProperties.kt
@@ -1,20 +1,17 @@
/*
* 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 file.
*/
package space.kscience.kmath.benchmarks
import kotlinx.benchmark.gradle.BenchmarksExtension
-import kotlinx.serialization.decodeFromString
-import kotlinx.serialization.json.Json
+import kotlinx.serialization.*
+import kotlinx.serialization.json.*
import org.gradle.api.Project
import ru.mipt.npm.gradle.KScienceReadmeExtension
-import java.time.LocalDateTime
-import java.time.ZoneId
-import java.time.format.DateTimeFormatter
-import java.time.format.DateTimeFormatterBuilder
-import java.time.format.SignStyle
+import java.time.*
+import java.time.format.*
import java.time.temporal.ChronoField.*
private val ISO_DATE_TIME: DateTimeFormatter = DateTimeFormatterBuilder().run {
@@ -50,14 +47,14 @@ fun Project.addBenchmarkProperties() {
rootProject.subprojects.forEach { p ->
p.extensions.findByType(KScienceReadmeExtension::class.java)?.run {
benchmarksProject.extensions.findByType(BenchmarksExtension::class.java)?.configurations?.forEach { cfg ->
- property("benchmark${cfg.name.capitalize()}") {
+ property("benchmark${cfg.name.replaceFirstChar(Char::uppercase)}") {
val launches = benchmarksProject.buildDir.resolve("reports/benchmarks/${cfg.name}")
val resDirectory = launches.listFiles()?.maxByOrNull {
LocalDateTime.parse(it.name, ISO_DATE_TIME).atZone(ZoneId.systemDefault()).toInstant()
}
- if (resDirectory == null || !(resDirectory.resolve("jvm.json")).exists()) {
+ if (resDirectory == null) {
"> **Can't find appropriate benchmark data. Try generating readme files after running benchmarks**."
} else {
val reports =
diff --git a/buildSrc/src/main/kotlin/space/kscience/kmath/ejml/codegen/ejmlCodegen.kt b/buildSrc/src/main/kotlin/space/kscience/kmath/ejml/codegen/ejmlCodegen.kt
index 7f8cb35b3..68bb10428 100644
--- a/buildSrc/src/main/kotlin/space/kscience/kmath/ejml/codegen/ejmlCodegen.kt
+++ b/buildSrc/src/main/kotlin/space/kscience/kmath/ejml/codegen/ejmlCodegen.kt
@@ -1,6 +1,6 @@
/*
* 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 file.
*/
@file:Suppress("KDocUnresolvedReference")
@@ -203,7 +203,7 @@ public object EjmlLinearSpace${ops} : EjmlLinearSpace<${type}, ${kmathAlgebra},
override fun ${type}.times(v: Point<${type}>): Ejml${type}Vector<${ejmlMatrixType}> = v * this
@UnstableKMathAPI
- override fun computeFeature(structure: Matrix<${type}>, type: KClass): F? {
+ override fun getFeature(structure: Matrix<${type}>, type: KClass): F? {
structure.getFeature(type)?.let { return it }
val origin = structure.toEjml().origin
@@ -240,10 +240,10 @@ public object EjmlLinearSpace${ops} : EjmlLinearSpace<${type}, ${kmathAlgebra},
}
override val q: Matrix<${type}> by lazy {
- qr.getQ(null, false).wrapMatrix().withFeature(OrthogonalFeature)
+ qr.getQ(null, false).wrapMatrix() + OrthogonalFeature
}
- override val r: Matrix<${type}> by lazy { qr.getR(null, false).wrapMatrix().withFeature(UFeature) }
+ override val r: Matrix<${type}> by lazy { qr.getR(null, false).wrapMatrix() + UFeature }
}
CholeskyDecompositionFeature::class -> object : CholeskyDecompositionFeature<${type}> {
@@ -251,7 +251,7 @@ public object EjmlLinearSpace${ops} : EjmlLinearSpace<${type}, ${kmathAlgebra},
val cholesky =
DecompositionFactory_${ops}.chol(structure.rowNum, true).apply { decompose(origin.copy()) }
- cholesky.getT(null).wrapMatrix().withFeature(LFeature)
+ cholesky.getT(null).wrapMatrix() + LFeature
}
}
@@ -261,11 +261,11 @@ public object EjmlLinearSpace${ops} : EjmlLinearSpace<${type}, ${kmathAlgebra},
}
override val l: Matrix<${type}> by lazy {
- lup.getLower(null).wrapMatrix().withFeature(LFeature)
+ lup.getLower(null).wrapMatrix() + LFeature
}
override val u: Matrix<${type}> by lazy {
- lup.getUpper(null).wrapMatrix().withFeature(UFeature)
+ lup.getUpper(null).wrapMatrix() + UFeature
}
override val p: Matrix<${type}> by lazy { lup.getRowPivot(null).wrapMatrix() }
@@ -275,10 +275,10 @@ public object EjmlLinearSpace${ops} : EjmlLinearSpace<${type}, ${kmathAlgebra},
}
override val q: Matrix<${type}> by lazy {
- qr.getQ(null, false).wrapMatrix().withFeature(OrthogonalFeature)
+ qr.getQ(null, false).wrapMatrix() + OrthogonalFeature
}
- override val r: Matrix<${type}> by lazy { qr.getR(null, false).wrapMatrix().withFeature(UFeature) }
+ override val r: Matrix<${type}> by lazy { qr.getR(null, false).wrapMatrix() + UFeature }
}
CholeskyDecompositionFeature::class -> object : CholeskyDecompositionFeature<${type}> {
@@ -286,7 +286,7 @@ public object EjmlLinearSpace${ops} : EjmlLinearSpace<${type}, ${kmathAlgebra},
val cholesky =
DecompositionFactory_${ops}.cholesky().apply { decompose(origin.copy()) }
- (cholesky.getT(null) as ${ejmlMatrixParentTypeMatrix}).wrapMatrix().withFeature(LFeature)
+ (cholesky.getT(null) as ${ejmlMatrixParentTypeMatrix}).wrapMatrix() + LFeature
}
}
@@ -297,11 +297,11 @@ public object EjmlLinearSpace${ops} : EjmlLinearSpace<${type}, ${kmathAlgebra},
}
override val l: Matrix<${type}> by lazy {
- lu.getLower(null).wrapMatrix().withFeature(LFeature)
+ lu.getLower(null).wrapMatrix() + LFeature
}
override val u: Matrix<${type}> by lazy {
- lu.getUpper(null).wrapMatrix().withFeature(UFeature)
+ lu.getUpper(null).wrapMatrix() + UFeature
}
override val inverse: Matrix<${type}> by lazy {
diff --git a/docs/diagrams/core.puml b/docs/diagrams/core.puml
deleted file mode 100644
index 87f8f2e2d..000000000
--- a/docs/diagrams/core.puml
+++ /dev/null
@@ -1,1020 +0,0 @@
-@startuml
-interface "ColumnarData" {
- size: Int
-}
-interface "XYColumnarData" {
- x: Buffer
- y: Buffer
-}
-interface "XYErrorColumnarData" {
- yErr: Buffer
-}
-interface "XYZColumnarData" {
- z: Buffer
-}
-interface "Domain" {
- dimension: Int
-}
-interface "DoubleDomain" {
-
-}
-class "HyperSquareDomain" {
- lower: Buffer
- upper: Buffer
-}
-class "UnconstrainedDomain" {
- dimension: Int
-}
-class "UnivariateDomain" {
- range: ClosedFloatingPointRange
-}
-interface "DifferentiableExpression" {
-
-}
-interface "SpecialDifferentiableExpression" {
-
-}
-abstract "FirstDerivativeExpression" {
-
-}
-interface "AutoDiffProcessor" {
-
-}
-interface "Expression" {
-
-}
-interface "ExpressionAlgebra" {
-
-}
-abstract "FunctionalExpressionAlgebra" {
- algebra: A
-}
-class "FunctionalExpressionGroup" {
- algebra: A
-}
-class "FunctionalExpressionRing" {
- algebra: A
-}
-class "FunctionalExpressionField" {
- algebra: A
-}
-class "FunctionalExpressionExtendedField" {
- algebra: A
-}
-interface "MST" {
-
-}
-class "Numeric" {
- value: Number
-}
-class "Unary" {
- operation: String
- value: MST
-}
-class "Binary" {
- operation: String
- left: MST
- right: MST
-}
-class "InnerAlgebra" {
- algebra: Algebra
- arguments: Map
-}
-class "MstNumericAlgebra" {
- number()
- bindSymbolOrNull()
- bindSymbol()
- unaryOperationFunction()
- binaryOperationFunction()
-}
-class "MstGroup" {
- zero: MST.Numericnumber()
- bindSymbolOrNull()
- add()
- unaryPlus()
- unaryMinus()
- minus()
- scale()
- binaryOperationFunction()
- unaryOperationFunction()
-}
-class "MstRing" {
- zero: MST.Numeric
- one: MST.Numericnumber()
- bindSymbolOrNull()
- add()
- scale()
- multiply()
- unaryPlus()
- unaryMinus()
- minus()
- binaryOperationFunction()
- unaryOperationFunction()
-}
-class "MstField" {
- zero: MST.Numeric
- one: MST.NumericbindSymbolOrNull()
- number()
- add()
- scale()
- multiply()
- divide()
- unaryPlus()
- unaryMinus()
- minus()
- binaryOperationFunction()
- unaryOperationFunction()
-}
-class "MstExtendedField" {
- zero: MST.Numeric
- one: MST.NumericbindSymbolOrNull()
- number()
- sin()
- cos()
- tan()
- asin()
- acos()
- atan()
- sinh()
- cosh()
- tanh()
- asinh()
- acosh()
- atanh()
- add()
- sqrt()
- scale()
- multiply()
- divide()
- unaryPlus()
- unaryMinus()
- minus()
- power()
- exp()
- ln()
- binaryOperationFunction()
- unaryOperationFunction()
-}
-class "MstLogicAlgebra" {
- bindSymbolOrNull()
- const()
- not()
- and()
- or()
- xor()
-}
-class "AutoDiffValue" {
- value: T
-}
-class "DerivationResult" {
- value: T
- derivativeValues: Map
- context: Field
-}
-class "SimpleAutoDiffField" {
- context: F
- bindings: Map
-}
-class "AutoDiffVariableWithDerivative" {
- identity: String
- value: T
- d: T
-}
-class "SimpleAutoDiffExpression" {
- field: F
- function: SimpleAutoDiffField
-}
-class "SimpleAutoDiffExtendedField" {
- context: F
- bindings: Map
-}
-interface "Symbol" {
- identity: String
-}
-class "StringSymbol" {
- identity: String
-}
-interface "SymbolIndexer" {
- symbols: List
-}
-class "SimpleSymbolIndexer" {
- symbols: List
-}
-class "BufferedLinearSpace" {
- elementAlgebra: A
- bufferFactory: BufferFactory
-}
-interface "LinearSolver" {
-
-}
-interface "LinearSpace" {
- elementAlgebra: A
-}
-class "LupDecomposition" {
- context: LinearSpace
- elementContext: Field
- lu: Matrix
- pivot: IntArray
- even: Boolean
-}
-class "MatrixBuilder" {
- linearSpace: LinearSpace
- rows: Int
- columns: Int
-}
-class "SymmetricMatrixFeature" {
-
-}
-interface "MatrixFeature" {
-
-}
-interface "DiagonalFeature" {
-
-}
-class "ZeroFeature" {
-
-}
-class "UnitFeature" {
-
-}
-interface "InverseMatrixFeature" {
- inverse: Matrix
-}
-interface "DeterminantFeature" {
- determinant: T
-}
-class "LFeature" {
-
-}
-class "UFeature" {
-
-}
-interface "LUDecompositionFeature" {
- l: Matrix
- u: Matrix
-}
-interface "LupDecompositionFeature" {
- l: Matrix
- u: Matrix
- p: Matrix
-}
-class "OrthogonalFeature" {
-
-}
-interface "QRDecompositionFeature" {
- q: Matrix
- r: Matrix
-}
-interface "CholeskyDecompositionFeature" {
- l: Matrix
-}
-interface "SingularValueDecompositionFeature" {
- u: Matrix
- s: Matrix
- v: Matrix
- singularValues: Point
-}
-class "MatrixWrapper" {
- origin: Matrix
- features: FeatureSet
-}
-class "TransposedFeature" {
- original: Matrix
-}
-class "VirtualMatrix" {
- rowNum: Int
- colNum: Int
- generator: (i:Int,j:Int)->T
-}
-class "UnstableKMathAPI" {
-
-}
-class "PerformancePitfall" {
- message: String
-}
-interface "Featured" {
-
-}
-interface "Feature" {
- key: FeatureKey
-}
-class "FeatureSet" {
- features: Map
-}
-interface "Loggable" {
-
-}
-class "ShapeMismatchException" {
- expected: IntArray
- actual: IntArray
-}
-interface "AlgebraND" {
- shape: IntArray
- elementContext: C
-}
-interface "GroupND" {
-
-}
-interface "RingND" {
-
-}
-interface "FieldND" {
-
-}
-interface "BufferAlgebraND" {
- strides: Strides
- bufferFactory: BufferFactory
- buffer: Buffer
-}
-class "BufferedGroupND" {
- shape: IntArray
- elementContext: A
- bufferFactory: BufferFactory
-}
-class "BufferedRingND" {
- shape: IntArray
- elementContext: R
- bufferFactory: BufferFactory
-}
-class "BufferedFieldND" {
- shape: IntArray
- elementContext: R
- bufferFactory: BufferFactory
-}
-class "BufferND" {
- strides: Strides
- buffer: Buffer
-}
-class "MutableBufferND" {
- strides: Strides
- mutableBuffer: MutableBuffer
-}
-class "DoubleFieldND" {
- shape: IntArray
-}
-class "ShortRingND" {
- shape: IntArray
-}
-interface "Structure1D" {
- dimension: Int
-}
-interface "MutableStructure1D" {
-
-}
-class "Structure1DWrapper" {
- structure: StructureND
-}
-class "MutableStructure1DWrapper" {
- structure: MutableStructureND
-}
-class "Buffer1DWrapper" {
- buffer: Buffer
-}
-class "MutableBuffer1DWrapper" {
- buffer: MutableBuffer
-}
-interface "Structure2D" {
- rowNum: Int
- colNum: Int
- shape: IntArray
- rows: List
- columns: List
-}
-interface "MutableStructure2D" {
- rows: List
- columns: List
-}
-class "Structure2DWrapper" {
- structure: StructureND
-}
-class "MutableStructure2DWrapper" {
- structure: MutableStructureND
-}
-interface "StructureFeature" {
-
-}
-interface "StructureND" {
- shape: IntArray
- dimension: Int
-}
-interface "MutableStructureND" {
-
-}
-interface "Strides" {
- shape: IntArray
- strides: IntArray
- linearSize: Int
-}
-class "DefaultStrides" {
- shape: IntArray
-}
-class "KMathContext" {
-
-}
-interface "Algebra" {
-
-}
-interface "GroupOperations" {
-
-}
-interface "Group" {
- zero: T
-}
-interface "RingOperations" {
-
-}
-interface "Ring" {
- one: T
-}
-interface "FieldOperations" {
-
-}
-interface "Field" {
-
-}
-interface "AlgebraElement" {
- context: C
-}
-interface "GroupElement" {
-
-}
-interface "RingElement" {
-
-}
-interface "FieldElement" {
-
-}
-class "BigIntField" {
- zero: BigInt
- one: BigIntnumber()
- unaryMinus()
- add()
- scale()
- multiply()
- divide()
- unaryPlus()
- unaryMinus()
-}
-class "BigInt" {
- sign: Byte
- magnitude: Magnitude
-}
-interface "BufferAlgebra" {
- bufferFactory: BufferFactory
- elementAlgebra: A
-}
-class "BufferField" {
- bufferFactory: BufferFactory
- elementAlgebra: A
- size: Int
-}
-interface "LogicAlgebra" {
-
-}
-class "BooleanAlgebra" {
- const()
- not()
- and()
- or()
- xor()
-}
-interface "ExtendedFieldOperations" {
-
-}
-interface "ExtendedField" {
-
-}
-class "DoubleField" {
- zero: Double
- one: Doublenumber()
- binaryOperationFunction()
- add()
- multiply()
- divide()
- scale()
- sin()
- cos()
- tan()
- acos()
- asin()
- atan()
- sinh()
- cosh()
- tanh()
- asinh()
- acosh()
- atanh()
- sqrt()
- power()
- exp()
- ln()
- norm()
- unaryMinus()
- plus()
- minus()
- times()
- div()
-}
-class "FloatField" {
- zero: Float
- one: Floatnumber()
- binaryOperationFunction()
- add()
- scale()
- multiply()
- divide()
- sin()
- cos()
- tan()
- acos()
- asin()
- atan()
- sinh()
- cosh()
- tanh()
- asinh()
- acosh()
- atanh()
- sqrt()
- power()
- exp()
- ln()
- norm()
- unaryMinus()
- plus()
- minus()
- times()
- div()
-}
-class "IntRing" {
- zero: Int
- one: Intnumber()
- add()
- multiply()
- norm()
- unaryMinus()
- plus()
- minus()
- times()
-}
-class "ShortRing" {
- zero: Short
- one: Shortnumber()
- add()
- multiply()
- norm()
- unaryMinus()
- plus()
- minus()
- times()
-}
-class "ByteRing" {
- zero: Byte
- one: Bytenumber()
- add()
- multiply()
- norm()
- unaryMinus()
- plus()
- minus()
- times()
-}
-class "LongRing" {
- zero: Long
- one: Longnumber()
- add()
- multiply()
- norm()
- unaryMinus()
- plus()
- minus()
- times()
-}
-interface "NumericAlgebra" {
-
-}
-interface "ScaleOperations" {
-
-}
-interface "NumbersAddOperations" {
-
-}
-interface "TrigonometricOperations" {
-
-}
-interface "PowerOperations" {
-
-}
-interface "ExponentialOperations" {
-
-}
-interface "Norm" {
-
-}
-interface "Buffer" {
- size: Int
-}
-interface "MutableBuffer" {
-
-}
-class "ListBuffer" {
- list: List
-}
-class "MutableListBuffer" {
- list: MutableList
-}
-class "ArrayBuffer" {
- array: Array
-}
-class "ReadOnlyBuffer" {
- buffer: MutableBuffer
-}
-class "VirtualBuffer" {
- size: Int
- generator: (Int)->T
-}
-class "BufferAccessor2D" {
- rowNum: Int
- colNum: Int
- factory: MutableBufferFactory
-}
-class "Row" {
- buffer: MutableBuffer
- rowIndex: Int
-}
-class "DoubleBuffer" {
- array: DoubleArray
-}
-class "DoubleBufferFieldOperations" {
- unaryMinus()
- add()
- multiply()
- divide()
- sin()
- cos()
- tan()
- asin()
- acos()
- atan()
- sinh()
- cosh()
- tanh()
- asinh()
- acosh()
- atanh()
- power()
- exp()
- ln()
-}
-class "DoubleL2Norm" {
- norm()
-}
-class "DoubleBufferField" {
- size: Int
-}
-enum "ValueFlag" {
- NAN
- MISSING
- NEGATIVE_INFINITY
- POSITIVE_INFINITY
-}
-interface "FlaggedBuffer" {
-
-}
-class "FlaggedDoubleBuffer" {
- values: DoubleArray
- flags: ByteArray
-}
-class "FloatBuffer" {
- array: FloatArray
-}
-class "IntBuffer" {
- array: IntArray
-}
-class "LongBuffer" {
- array: LongArray
-}
-class "MemoryBuffer" {
- memory: Memory
- spec: MemorySpec
-}
-class "MutableMemoryBuffer" {
- memory: Memory
- spec: MemorySpec
-}
-class "ShortBuffer" {
- array: ShortArray
-}
-class "ExpressionFieldTest" {
- x
-}
-class "InterpretTest" {
-
-}
-class "SimpleAutoDiffTest" {
- x
- y
- z
-}
-class "DoubleLUSolverTest" {
-
-}
-class "MatrixTest" {
-
-}
-class "CumulativeKtTest" {
-
-}
-class "BigIntAlgebraTest" {
-
-}
-class "BigIntConstructorTest" {
-
-}
-class "BigIntConversionsTest" {
-
-}
-class "BigIntOperationsTest" {
-
-}
-class "DoubleFieldTest" {
-
-}
-class "NDFieldTest" {
-
-}
-class "NumberNDFieldTest" {
- algebra
- array1
- array2
-}
-class "L2Norm" {
- norm()
-}
-interface "AlgebraicVerifier" {
- algebra: A
-}
-class "FieldVerifier" {
- algebra: A
- a: T
- b: T
- c: T
- x: Number
-}
-class "RingVerifier" {
- algebra: A
- a: T
- b: T
- c: T
- x: Number
-}
-class "SpaceVerifier" {
- algebra: S
- a: T
- b: T
- c: T
- x: Number
-}
-class "JBigIntegerField" {
- zero: BigInteger
- one: BigIntegernumber()
- add()
- minus()
- multiply()
- unaryMinus()
-}
-abstract "JBigDecimalFieldBase" {
- mathContext: MathContext
-}
-class "JBigDecimalField" {
- mathContext: MathContext
-}
-"ColumnarData" <|--- XYColumnarData
-"XYColumnarData" <|--- XYErrorColumnarData
-"XYColumnarData" <|--- XYZColumnarData
-"Domain" <|--- DoubleDomain
-"DoubleDomain" <|--- HyperSquareDomain
-"DoubleDomain" <|--- UnconstrainedDomain
-"DoubleDomain" <|--- UnivariateDomain
-"Expression" <|--- DifferentiableExpression
-"DifferentiableExpression" <|--- SpecialDifferentiableExpression
-"DifferentiableExpression" <|--- FirstDerivativeExpression
-"Algebra" <|--- ExpressionAlgebra
-"ExpressionAlgebra" <|--- FunctionalExpressionAlgebra
-"FunctionalExpressionAlgebra" <|--- FunctionalExpressionGroup
-"Group" <|--- FunctionalExpressionGroup
-"FunctionalExpressionGroup" <|--- FunctionalExpressionRing
-"Ring" <|--- FunctionalExpressionRing
-"FunctionalExpressionRing" <|--- FunctionalExpressionField
-"Field" <|--- FunctionalExpressionField
-"ScaleOperations" <|--- FunctionalExpressionField
-"FunctionalExpressionField" <|--- FunctionalExpressionExtendedField
-"ExtendedField" <|--- FunctionalExpressionExtendedField
-"MST" <|--- Numeric
-"MST" <|--- Unary
-"MST" <|--- Binary
-"NumericAlgebra" <|--- InnerAlgebra
-"NumericAlgebra" <|--- MstNumericAlgebra
-"Group" <|--- MstGroup
-"NumericAlgebra" <|--- MstGroup
-"ScaleOperations" <|--- MstGroup
-"Ring" <|--- MstRing
-"NumbersAddOperations" <|--- MstRing
-"ScaleOperations" <|--- MstRing
-"Field" <|--- MstField
-"NumbersAddOperations" <|--- MstField
-"ScaleOperations" <|--- MstField
-"ExtendedField" <|--- MstExtendedField
-"NumericAlgebra" <|--- MstExtendedField
-"LogicAlgebra" <|--- MstLogicAlgebra
-"Field" <|--- SimpleAutoDiffField
-"ExpressionAlgebra" <|--- SimpleAutoDiffField
-"NumbersAddOperations" <|--- SimpleAutoDiffField
-"AutoDiffValue" <|--- AutoDiffVariableWithDerivative
-"Symbol" <|--- AutoDiffVariableWithDerivative
-"FirstDerivativeExpression" <|--- SimpleAutoDiffExpression
-"ExtendedField" <|--- SimpleAutoDiffExtendedField
-"ScaleOperations" <|--- SimpleAutoDiffExtendedField
-'"" <|--- SimpleAutoDiffExtendedField
-"SimpleAutoDiffField" <|--- SimpleAutoDiffExtendedField
-"MST" <|--- Symbol
-"Symbol" <|--- StringSymbol
-"SymbolIndexer" <|--- SimpleSymbolIndexer
-"LinearSpace" <|--- BufferedLinearSpace
-"LupDecompositionFeature" <|--- LupDecomposition
-"DeterminantFeature" <|--- LupDecomposition
-"MatrixFeature" <|--- SymmetricMatrixFeature
-"StructureFeature" <|--- MatrixFeature
-"MatrixFeature" <|--- DiagonalFeature
-"DiagonalFeature" <|--- ZeroFeature
-"DiagonalFeature" <|--- UnitFeature
-"MatrixFeature" <|--- InverseMatrixFeature
-"MatrixFeature" <|--- DeterminantFeature
-"MatrixFeature" <|--- LFeature
-"MatrixFeature" <|--- UFeature
-"MatrixFeature" <|--- LUDecompositionFeature
-"MatrixFeature" <|--- LupDecompositionFeature
-"MatrixFeature" <|--- OrthogonalFeature
-"MatrixFeature" <|--- QRDecompositionFeature
-"MatrixFeature" <|--- CholeskyDecompositionFeature
-"MatrixFeature" <|--- SingularValueDecompositionFeature
-'"Matrixbyorigin{
-'
-'
-' @UnstableKMathAPI
-' @Suppress
-'overridefungetFeature:F? =
-'features.getFeature
-'
-'overridefuntoString"
-'}" <|--- MatrixWrapper
-"MatrixFeature" <|--- TransposedFeature
-"Matrix" <|--- VirtualMatrix
-"Featured" <|--- FeatureSet
-"RuntimeException" <|--- ShapeMismatchException
-"Group" <|--- GroupND
-"AlgebraND" <|--- GroupND
-"Ring" <|--- RingND
-"GroupND" <|--- RingND
-"Field" <|--- FieldND
-"RingND" <|--- FieldND
-"AlgebraND" <|--- BufferAlgebraND
-"GroupND" <|--- BufferedGroupND
-"BufferAlgebraND" <|--- BufferedGroupND
-"BufferedGroupND" <|--- BufferedRingND
-"RingND" <|--- BufferedRingND
-"BufferedRingND" <|--- BufferedFieldND
-"FieldND" <|--- BufferedFieldND
-"StructureND" <|--- BufferND
-"MutableStructureND" <|--- MutableBufferND
-"BufferND" <|--- MutableBufferND
-"BufferedFieldND" <|--- DoubleFieldND
-'"
-'" <|--- DoubleFieldND
-'"NumbersAddOperations" <|--- DoubleFieldND
-'"
-'" <|--- DoubleFieldND
-'"ScaleOperations" <|--- DoubleFieldND
-'"
-'" <|--- DoubleFieldND
-"ExtendedField" <|--- DoubleFieldND
-"BufferedRingND" <|--- ShortRingND
-'"
-'" <|--- ShortRingND
-"NumbersAddOperations" <|--- ShortRingND
-"StructureND" <|--- Structure1D
-"Buffer" <|--- Structure1D
-"Structure1D" <|--- MutableStructure1D
-"MutableStructureND" <|--- MutableStructure1D
-"MutableBuffer" <|--- MutableStructure1D
-"Structure1D" <|--- Structure1DWrapper
-"MutableStructure1D" <|--- MutableStructure1DWrapper
-"Structure1D" <|--- Buffer1DWrapper
-"MutableStructure1D" <|--- MutableBuffer1DWrapper
-"StructureND" <|--- Structure2D
-"Structure2D" <|--- MutableStructure2D
-"MutableStructureND" <|--- MutableStructure2D
-"Structure2D" <|--- Structure2DWrapper
-"MutableStructure2D" <|--- MutableStructure2DWrapper
-"Feature" <|--- StructureFeature
-"Featured" <|--- StructureND
-"StructureND" <|--- MutableStructureND
-"Strides" <|--- DefaultStrides
-"Algebra" <|--- GroupOperations
-"GroupOperations" <|--- Group
-"GroupOperations" <|--- RingOperations
-"Group" <|--- Ring
-"RingOperations" <|--- Ring
-"RingOperations" <|--- FieldOperations
-"Ring" <|--- Field
-"FieldOperations" <|--- Field
-"ScaleOperations" <|--- Field
-"NumericAlgebra" <|--- Field
-"AlgebraElement" <|--- GroupElement
-"GroupElement" <|--- RingElement
-"RingElement" <|--- FieldElement
-"Field" <|--- BigIntField
-"NumbersAddOperations" <|--- BigIntField
-"ScaleOperations" <|--- BigIntField
-"Comparable" <|--- BigInt
-"Algebra" <|--- BufferAlgebra
-"BufferAlgebra" <|--- BufferField
-"Field" <|--- BufferField
-"Algebra" <|--- LogicAlgebra
-"LogicAlgebra" <|--- BooleanAlgebra
-"FieldOperations" <|--- ExtendedFieldOperations
-'"
-'" <|--- ExtendedFieldOperations
-'"TrigonometricOperations" <|--- ExtendedFieldOperations
-'"
-'" <|--- ExtendedFieldOperations
-'"PowerOperations" <|--- ExtendedFieldOperations
-'"
-'" <|--- ExtendedFieldOperations
-"ExponentialOperations" <|--- ExtendedFieldOperations
-"ExtendedFieldOperations" <|--- ExtendedField
-"Field" <|--- ExtendedField
-"NumericAlgebra" <|--- ExtendedField
-"ScaleOperations" <|--- ExtendedField
-"ExtendedField" <|--- DoubleField
-"Norm" <|--- DoubleField
-"ScaleOperations" <|--- DoubleField
-"ExtendedField" <|--- FloatField
-"Norm" <|--- FloatField
-"Ring" <|--- IntRing
-"Norm" <|--- IntRing
-"NumericAlgebra" <|--- IntRing
-"Ring" <|--- ShortRing
-"Norm" <|--- ShortRing
-"NumericAlgebra" <|--- ShortRing
-"Ring" <|--- ByteRing
-"Norm" <|--- ByteRing
-"NumericAlgebra" <|--- ByteRing
-"Ring" <|--- LongRing
-"Norm" <|--- LongRing
-"NumericAlgebra" <|--- LongRing
-"Algebra" <|--- NumericAlgebra
-"Algebra" <|--- ScaleOperations
-"Ring" <|--- NumbersAddOperations
-"NumericAlgebra" <|--- NumbersAddOperations
-"Algebra" <|--- TrigonometricOperations
-"Algebra" <|--- PowerOperations
-"Algebra" <|--- ExponentialOperations
-"Buffer" <|--- MutableBuffer
-"Buffer" <|--- ListBuffer
-"MutableBuffer" <|--- MutableListBuffer
-"MutableBuffer" <|--- ArrayBuffer
-"Buffer" <|--- ReadOnlyBuffer
-"Buffer" <|--- VirtualBuffer
-"MutableBuffer" <|--- Row
-"MutableBuffer" <|--- DoubleBuffer
-"ExtendedFieldOperations" <|--- DoubleBufferFieldOperations
-"Norm" <|--- DoubleL2Norm
-"ExtendedField" <|--- DoubleBufferField
-"Norm" <|--- DoubleBufferField
-"Buffer" <|--- FlaggedBuffer
-"FlaggedBuffer" <|--- FlaggedDoubleBuffer
-'"
-'" <|--- FlaggedDoubleBuffer
-"Buffer" <|--- FlaggedDoubleBuffer
-"MutableBuffer" <|--- FloatBuffer
-"MutableBuffer" <|--- IntBuffer
-"MutableBuffer" <|--- LongBuffer
-"Buffer" <|--- MemoryBuffer
-"MemoryBuffer" <|--- MutableMemoryBuffer
-'"
-'" <|--- MutableMemoryBuffer
-"MutableBuffer" <|--- MutableMemoryBuffer
-"MutableBuffer" <|--- ShortBuffer
-"Norm" <|--- L2Norm
-"RingVerifier" <|--- FieldVerifier
-"SpaceVerifier" <|--- RingVerifier
-"AlgebraicVerifier" <|--- SpaceVerifier
-"Ring" <|--- JBigIntegerField
-"NumericAlgebra" <|--- JBigIntegerField
-"Field" <|--- JBigDecimalFieldBase
-"PowerOperations" <|--- JBigDecimalFieldBase
-"NumericAlgebra" <|--- JBigDecimalFieldBase
-"ScaleOperations" <|--- JBigDecimalFieldBase
-"JBigDecimalFieldBase" <|--- JBigDecimalField
-@enduml
\ No newline at end of file
diff --git a/docs/images/KM.svg b/docs/images/KM.svg
index 6f80e4d08..f5ec452c7 100644
--- a/docs/images/KM.svg
+++ b/docs/images/KM.svg
@@ -1,7 +1,7 @@