diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index f2c76a354..cffef64b0 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -13,25 +13,13 @@ jobs:
runs-on: ${{matrix.os}}
timeout-minutes: 40
steps:
- - name: Checkout the repo
- uses: actions/checkout@v2
- - name: Set up JDK 11
- uses: DeLaGuardo/setup-graalvm@4.0
+ - uses: actions/checkout@v3.0.0
+ - uses: actions/setup-java@v3.0.0
with:
- 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-
+ java-version: 11
+ distribution: liberica
- name: Cache konan
- uses: actions/cache@v2
+ uses: actions/cache@v3.0.1
with:
path: ~/.konan
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
@@ -39,5 +27,6 @@ jobs:
${{ runner.os }}-gradle-
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v1.0.4
- - name: Build
- run: ./gradlew build --build-cache --no-daemon --stacktrace
+ - uses: gradle/gradle-build-action@v2.1.5
+ with:
+ arguments: build
diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml
index 23ed54357..2abaf0b9f 100644
--- a/.github/workflows/pages.yml
+++ b/.github/workflows/pages.yml
@@ -1,28 +1,31 @@
name: Dokka publication
on:
- push:
- branches: [ master ]
+ workflow_dispatch:
+ release:
+ types: [ created ]
jobs:
build:
runs-on: ubuntu-20.04
timeout-minutes: 40
steps:
- - uses: actions/checkout@v2
- - uses: DeLaGuardo/setup-graalvm@4.0
+ - uses: actions/checkout@v3.0.0
+ - uses: actions/setup-java@v3.0.0
with:
- graalvm: 21.2.0
- java: java11
- arch: amd64
- - uses: actions/cache@v2
+ java-version: 11
+ distribution: liberica
+ - name: Cache konan
+ uses: actions/cache@v3.0.1
with:
- path: ~/.gradle/caches
+ path: ~/.konan
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-
- - run: ./gradlew dokkaHtmlMultiModule --build-cache --no-daemon --no-parallel --stacktrace
- - uses: JamesIves/github-pages-deploy-action@4.1.0
+ - uses: gradle/gradle-build-action@v2.1.5
+ with:
+ arguments: dokkaHtmlMultiModule --no-parallel
+ - uses: JamesIves/github-pages-deploy-action@v4.3.0
with:
branch: gh-pages
folder: build/dokka/htmlMultiModule
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index fa3cb700c..794881b09 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -14,42 +14,38 @@ jobs:
os: [ macOS-latest, windows-latest ]
runs-on: ${{matrix.os}}
steps:
- - name: Checkout the repo
- uses: actions/checkout@v2
- - name: Set up JDK 11
- uses: DeLaGuardo/setup-graalvm@4.0
+ - uses: actions/checkout@v3.0.0
+ - uses: actions/setup-java@v3.0.0
with:
- 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-
+ java-version: 11
+ distribution: liberica
- name: Cache konan
- uses: actions/cache@v2
+ uses: actions/cache@v3.0.1
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/wrapper-validation-action@v1.0.4
- name: Publish Windows Artifacts
if: matrix.os == 'windows-latest'
- 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 }}
+ uses: gradle/gradle-build-action@v2.1.5
+ with:
+ arguments: |
+ releaseAll
+ -Ppublishing.enabled=true
+ -Ppublishing.sonatype=false
+ -Ppublishing.space.user=${{ secrets.SPACE_APP_ID }}
+ -Ppublishing.space.token=${{ secrets.SPACE_APP_SECRET }}
- name: Publish Mac Artifacts
if: matrix.os == 'macOS-latest'
- 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 }}
+ uses: gradle/gradle-build-action@v2.1.5
+ with:
+ arguments: |
+ releaseMacosX64
+ releaseIosArm64
+ releaseIosX64
+ -Ppublishing.enabled=true
+ -Ppublishing.sonatype=false
+ -Ppublishing.space.user=${{ secrets.SPACE_APP_ID }}
+ -Ppublishing.space.token=${{ secrets.SPACE_APP_SECRET }}
diff --git a/.gitignore b/.gitignore
index 79f3238e1..5ddd846a8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,3 +19,4 @@ out/
!/.idea/copyright/
!/.idea/scopes/
+/kotlin-js-store/yarn.lock
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a19b1f467..c4b8c06cf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,21 @@
## [Unreleased]
### Added
+
+### Changed
+- Kotlin 1.7
+- `LazyStructure` `deffered` -> `async` to comply with coroutines code style
+
+### Deprecated
+
+### Removed
+
+### Fixed
+
+### Security
+
+## [0.3.0]
+### Added
- `ScaleOperations` interface
- `Field` extends `ScaleOperations`
- Basic integration API
@@ -19,6 +34,12 @@
- Complex power
- Separate methods for UInt, Int and Number powers. NaN safety.
- Tensorflow prototype
+- `ValueAndErrorField`
+- MST compilation to WASM: #286
+- Jafama integration: #176
+- `contentEquals` with tolerance: #364
+- Compilation to TeX for MST: #254
+
### Changed
- Exponential operations merged with hyperbolic functions
@@ -48,10 +69,15 @@
- 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
+- `UnivariateDistribution` renamed to `Distribution1D`
+- Rework of histograms.
+- `UnivariateFunction` -> `Function1D`, `MultivariateFunction` -> `FunctionND`
+
### Deprecated
- Specialized `DoubleBufferAlgebra`
+
### Removed
- Nearest in Domain. To be implemented in geometry package.
- Number multiplication and division in main Algebra chain
@@ -62,10 +88,12 @@
- Second generic from DifferentiableExpression
- Algebra elements are completely removed. Use algebra contexts instead.
+
### Fixed
- Ring inherits RingOperations, not GroupOperations
- Univariate histogram filling
+
### Security
## [0.2.0]
@@ -88,6 +116,7 @@
- New `MatrixFeature` interfaces for matrix decompositions
- Basic Quaternion vector support in `kmath-complex`.
+
### Changed
- Package changed from `scientifik` to `space.kscience`
- Gradle version: 6.6 -> 6.8.2
@@ -112,7 +141,6 @@
- `symbol` method in `Algebra` renamed to `bindSymbol` to avoid ambiguity
- Add `out` projection to `Buffer` generic
-### Deprecated
### Removed
- `kmath-koma` module because it doesn't support Kotlin 1.4.
@@ -122,13 +150,11 @@
- `Real` class
- StructureND identity and equals
+
### Fixed
- `symbol` method in `MstExtendedField` (https://github.com/mipt-npm/kmath/pull/140)
-### Security
-
## [0.1.4]
-
### Added
- Functional Expressions API
- Mathematical Syntax Tree, its interpreter and API
@@ -146,6 +172,7 @@
- Full hyperbolic functions support and default implementations within `ExtendedField`
- Norm support for `Complex`
+
### Changed
- `readAsMemory` now has `throws IOException` in JVM signature.
- Several functions taking functional types were made `inline`.
@@ -157,9 +184,10 @@
- Gradle version: 6.3 -> 6.6
- Moved probability distributions to commons-rng and to `kmath-prob`
+
### Fixed
- Missing copy method in Memory implementation on JS (https://github.com/mipt-npm/kmath/pull/106)
- D3.dim value in `kmath-dimensions`
- Multiplication in integer rings in `kmath-core` (https://github.com/mipt-npm/kmath/pull/101)
- Commons RNG compatibility (https://github.com/mipt-npm/kmath/issues/93)
-- Multiplication of BigInt by scalar
+- Multiplication of BigInt by scalar
\ No newline at end of file
diff --git a/README.md b/README.md
index aeedfefbb..8353d341b 100644
--- a/README.md
+++ b/README.md
@@ -52,21 +52,18 @@ module definitions below. The module stability could have the following levels:
## Modules
-
-* ### [benchmarks](benchmarks)
+### [benchmarks](benchmarks)
>
>
> **Maturity**: EXPERIMENTAL
-
-* ### [examples](examples)
+### [examples](examples)
>
>
> **Maturity**: EXPERIMENTAL
-
-* ### [kmath-ast](kmath-ast)
+### [kmath-ast](kmath-ast)
>
>
> **Maturity**: EXPERIMENTAL
@@ -77,15 +74,13 @@ 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
@@ -94,9 +89,8 @@ 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
@@ -112,21 +106,18 @@ 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
@@ -136,9 +127,8 @@ 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.
@@ -150,9 +140,8 @@ 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
@@ -164,21 +153,18 @@ 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
@@ -186,15 +172,13 @@ 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
@@ -203,21 +187,18 @@ 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)
+### [kmath-multik](kmath-multik)
>
>
> **Maturity**: PROTOTYPE
-
-* ### [kmath-nd4j](kmath-nd4j)
+### [kmath-nd4j](kmath-nd4j)
>
>
> **Maturity**: EXPERIMENTAL
@@ -227,27 +208,28 @@ 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-optimization](kmath-optimization)
>
>
> **Maturity**: EXPERIMENTAL
-
-* ### [kmath-stat](kmath-stat)
+### [kmath-stat](kmath-stat)
>
>
> **Maturity**: EXPERIMENTAL
-
-* ### [kmath-symja](kmath-symja)
+### [kmath-symja](kmath-symja)
>
>
> **Maturity**: PROTOTYPE
-
-* ### [kmath-tensors](kmath-tensors)
+### [kmath-tensorflow](kmath-tensorflow)
+>
+>
+> **Maturity**: PROTOTYPE
+
+### [kmath-tensors](kmath-tensors)
>
>
> **Maturity**: PROTOTYPE
@@ -257,13 +239,11 @@ 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
@@ -302,8 +282,8 @@ repositories {
}
dependencies {
- api("space.kscience:kmath-core:0.3.0-dev-17")
- // api("space.kscience:kmath-core-jvm:0.3.0-dev-17") for jvm-specific version
+ api("space.kscience:kmath-core:$version")
+ // api("space.kscience:kmath-core-jvm:$version") for jvm-specific version
}
```
diff --git a/benchmarks/README.md b/benchmarks/README.md
new file mode 100644
index 000000000..cd8fbafd3
--- /dev/null
+++ b/benchmarks/README.md
@@ -0,0 +1,4 @@
+# Module benchmarks
+
+
+
diff --git a/benchmarks/build.gradle.kts b/benchmarks/build.gradle.kts
index 90ec5dfbe..22712816d 100644
--- a/benchmarks/build.gradle.kts
+++ b/benchmarks/build.gradle.kts
@@ -52,6 +52,8 @@ kotlin {
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")
@@ -122,6 +124,11 @@ benchmark {
include("JafamaBenchmark")
}
+ configurations.register("tensorAlgebra") {
+ commonConfiguration()
+ include("TensorAlgebraBenchmark")
+ }
+
configurations.register("viktor") {
commonConfiguration()
include("ViktorBenchmark")
@@ -148,7 +155,7 @@ kotlin.sourceSets.all {
}
}
-tasks.withType {
+tasks.withType {
kotlinOptions {
jvmTarget = "11"
freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all" + "-Xlambdas=indy"
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 63165baaa..7d5ae310b 100644
--- a/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt
+++ b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt
@@ -15,7 +15,11 @@ 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)
@@ -39,6 +43,16 @@ internal class DotBenchmark {
val ejmlMatrix2 = EjmlLinearSpaceDDRM { matrix2.toEjml() }
}
+
+ @Benchmark
+ fun tfDot(blackhole: Blackhole) {
+ blackhole.consume(
+ DoubleField.produceWithTF {
+ matrix1 dot matrix1
+ }
+ )
+ }
+
@Benchmark
fun cmDotWithConversion(blackhole: Blackhole) = CMLinearSpace {
blackhole.consume(matrix1 dot matrix2)
@@ -59,13 +73,13 @@ internal class DotBenchmark {
blackhole.consume(matrix1 dot matrix2)
}
-// @Benchmark
-// fun tensorDot(blackhole: Blackhole) = with(Double.tensorAlgebra) {
-// blackhole.consume(matrix1 dot matrix2)
-// }
+ @Benchmark
+ fun tensorDot(blackhole: Blackhole) = with(DoubleField.tensorAlgebra) {
+ blackhole.consume(matrix1 dot matrix2)
+ }
@Benchmark
- fun multikDot(blackhole: Blackhole) = with(Double.multikAlgebra) {
+ fun multikDot(blackhole: Blackhole) = with(DoubleField.multikAlgebra) {
blackhole.consume(matrix1 dot matrix2)
}
@@ -78,4 +92,9 @@ internal class DotBenchmark {
fun doubleDot(blackhole: Blackhole) = with(DoubleField.linearSpace) {
blackhole.consume(matrix1 dot matrix2)
}
+
+ @Benchmark
+ fun doubleTensorDot(blackhole: Blackhole) = DoubleTensorAlgebra.invoke {
+ blackhole.consume(matrix1 dot matrix2)
+ }
}
diff --git a/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/TensorAlgebraBenchmark.kt b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/TensorAlgebraBenchmark.kt
new file mode 100644
index 000000000..38e064e53
--- /dev/null
+++ b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/TensorAlgebraBenchmark.kt
@@ -0,0 +1,37 @@
+/*
+ * 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/build.gradle.kts b/build.gradle.kts
index 1b2d9d7c0..d8c591799 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,22 +1,23 @@
plugins {
id("ru.mipt.npm.gradle.project")
- id("org.jetbrains.kotlinx.kover") version "0.5.0-RC"
+ id("org.jetbrains.kotlinx.kover") version "0.5.0"
}
allprojects {
repositories {
+ maven("https://repo.kotlin.link")
maven("https://oss.sonatype.org/content/repositories/snapshots")
mavenCentral()
}
group = "space.kscience"
- version = "0.3.0-dev-17"
+ version = "0.3.1-dev-1"
}
subprojects {
if (name.startsWith("kmath")) apply()
- plugins.withId("org.jetbrains.dokka"){
+ plugins.withId("org.jetbrains.dokka") {
tasks.withType {
dependsOn(tasks["assemble"])
@@ -50,12 +51,24 @@ subprojects {
}
}
}
+
+ plugins.withId("org.jetbrains.kotlin.multiplatform") {
+ configure {
+ sourceSets {
+ val commonTest by getting {
+ dependencies {
+ implementation(projects.testUtils)
+ }
+ }
+ }
+ }
+ }
}
readme.readmeTemplate = file("docs/templates/README-TEMPLATE.md")
ksciencePublish {
- github("kmath")
+ github("kmath", addToRelease = false)
space()
sonatype()
}
diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts
index ceb220bd5..20611e92d 100644
--- a/buildSrc/build.gradle.kts
+++ b/buildSrc/build.gradle.kts
@@ -1,4 +1,5 @@
plugins {
+ kotlin("jvm") version "1.7.0"
`kotlin-dsl`
`version-catalog`
alias(npmlibs.plugins.kotlin.plugin.serialization)
@@ -7,17 +8,19 @@ plugins {
java.targetCompatibility = JavaVersion.VERSION_11
repositories {
+ mavenLocal()
maven("https://repo.kotlin.link")
mavenCentral()
gradlePluginPortal()
}
-val toolsVersion: String by extra
+val toolsVersion = npmlibs.versions.tools.get()
val kotlinVersion = npmlibs.versions.kotlin.asProvider().get()
-val benchmarksVersion = "0.4.2"
+val benchmarksVersion = npmlibs.versions.kotlinx.benchmark.get()
dependencies {
api("ru.mipt.npm:gradle-tools:$toolsVersion")
+ api(npmlibs.atomicfu.gradle)
//plugins form benchmarks
api("org.jetbrains.kotlinx:kotlinx-benchmark-plugin:$benchmarksVersion")
api("org.jetbrains.kotlin:kotlin-allopen:$kotlinVersion")
diff --git a/buildSrc/gradle.properties b/buildSrc/gradle.properties
deleted file mode 100644
index 6678f24a8..000000000
--- a/buildSrc/gradle.properties
+++ /dev/null
@@ -1,14 +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
-kotlin.mpp.stability.nowarn=true
-
-kotlin.jupyter.add.scanner=false
-
-org.gradle.configureondemand=true
-org.gradle.parallel=true
-
-toolsVersion=0.10.9-kotlin-1.6.10
diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts
index 87ff205f6..bce265510 100644
--- a/buildSrc/settings.gradle.kts
+++ b/buildSrc/settings.gradle.kts
@@ -3,17 +3,26 @@
* 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")
-enableFeaturePreview("VERSION_CATALOGS")
dependencyResolutionManagement {
+ val projectProperties = java.util.Properties()
+ file("../gradle.properties").inputStream().use {
+ projectProperties.load(it)
+ }
- val toolsVersion: String by extra
+ projectProperties.forEach { key, value ->
+ extra.set(key.toString(), value)
+ }
+
+
+ val toolsVersion: String = projectProperties["toolsVersion"].toString()
repositories {
+ mavenLocal()
maven("https://repo.kotlin.link")
mavenCentral()
+ gradlePluginPortal()
}
versionCatalogs {
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..7c23d8ea0 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
@@ -319,7 +319,9 @@ public object EjmlLinearSpace${ops} : EjmlLinearSpace<${type}, ${kmathAlgebra},
}
else -> null
- }?.let(type::cast)
+ }?.let{
+ type.cast(it)
+ }
}
/**
diff --git a/docs/templates/README-TEMPLATE.md b/docs/templates/README-TEMPLATE.md
index 2e64a3e09..0ab284ee9 100644
--- a/docs/templates/README-TEMPLATE.md
+++ b/docs/templates/README-TEMPLATE.md
@@ -52,7 +52,7 @@ module definitions below. The module stability could have the following levels:
## Modules
-$modules
+${modules}
## Multi-platform support
diff --git a/examples/README.md b/examples/README.md
new file mode 100644
index 000000000..d4e1c5289
--- /dev/null
+++ b/examples/README.md
@@ -0,0 +1,4 @@
+# Module examples
+
+
+
diff --git a/examples/build.gradle.kts b/examples/build.gradle.kts
index 36715cd78..60f8f5aed 100644
--- a/examples/build.gradle.kts
+++ b/examples/build.gradle.kts
@@ -58,7 +58,7 @@ kotlin.sourceSets.all {
}
}
-tasks.withType {
+tasks.withType {
kotlinOptions {
jvmTarget = "11"
freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all" + "-Xopt-in=kotlin.RequiresOptIn" + "-Xlambdas=indy"
diff --git a/examples/src/main/kotlin/space/kscience/kmath/functions/integrate.kt b/examples/src/main/kotlin/space/kscience/kmath/functions/integrate.kt
index f60b1ab45..59eaba5bd 100644
--- a/examples/src/main/kotlin/space/kscience/kmath/functions/integrate.kt
+++ b/examples/src/main/kotlin/space/kscience/kmath/functions/integrate.kt
@@ -13,7 +13,7 @@ import kotlin.math.pow
fun main() {
//Define a function
- val function: UnivariateFunction = { x -> 3 * x.pow(2) + 2 * x + 1 }
+ val function: Function1D = { x -> 3 * x.pow(2) + 2 * x + 1 }
//get the result of the integration
val result = DoubleField.gaussIntegrator.integrate(0.0..10.0, function = function)
diff --git a/examples/src/main/kotlin/space/kscience/kmath/functions/interpolateSquare.kt b/examples/src/main/kotlin/space/kscience/kmath/functions/interpolateSquare.kt
index 091242829..a50df0931 100644
--- a/examples/src/main/kotlin/space/kscience/kmath/functions/interpolateSquare.kt
+++ b/examples/src/main/kotlin/space/kscience/kmath/functions/interpolateSquare.kt
@@ -5,8 +5,8 @@
package space.kscience.kmath.functions
-import space.kscience.kmath.interpolation.SplineInterpolator
import space.kscience.kmath.interpolation.interpolatePolynomials
+import space.kscience.kmath.interpolation.splineInterpolator
import space.kscience.kmath.operations.DoubleField
import space.kscience.kmath.real.map
import space.kscience.kmath.real.step
@@ -18,7 +18,7 @@ import space.kscience.plotly.scatter
@OptIn(UnstablePlotlyAPI::class)
fun main() {
- val function: UnivariateFunction = { x ->
+ val function: Function1D = { x ->
if (x in 30.0..50.0) {
1.0
} else {
@@ -28,7 +28,7 @@ fun main() {
val xs = 0.0..100.0 step 0.5
val ys = xs.map(function)
- val polynomial: PiecewisePolynomial = SplineInterpolator.double.interpolatePolynomials(xs, ys)
+ val polynomial: PiecewisePolynomial = DoubleField.splineInterpolator.interpolatePolynomials(xs, ys)
val polyFunction = polynomial.asFunction(DoubleField, 0.0)
diff --git a/gradle.properties b/gradle.properties
index 7dd9e6d61..5202289fa 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -2,14 +2,14 @@
# 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
-kotlin.mpp.stability.nowarn=true
-
kotlin.jupyter.add.scanner=false
+kotlin.mpp.stability.nowarn=true
+kotlin.native.ignoreDisabledTargets=true
+//kotlin.incremental.js.ir=true
org.gradle.configureondemand=true
org.gradle.parallel=true
-org.gradle.jvmargs=-XX:MaxMetaspaceSize=1G
+org.gradle.jvmargs=-Xmx4096m
-toolsVersion=0.11.1-kotlin-1.6.10
+toolsVersion=0.11.7-kotlin-1.7.0
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 7454180f2..41d9927a4 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 2e6e5897b..aa991fcea 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/kmath-ast/README.md b/kmath-ast/README.md
index 5e3366881..553c60bb3 100644
--- a/kmath-ast/README.md
+++ b/kmath-ast/README.md
@@ -1,6 +1,6 @@
# Module kmath-ast
-Performance and visualization extensions to MST API.
+Extensions to MST API: transformations, dynamic compilation and visualization.
- [expression-language](src/commonMain/kotlin/space/kscience/kmath/ast/parser.kt) : Expression language and its parser
- [mst-jvm-codegen](src/jvmMain/kotlin/space/kscience/kmath/asm/asm.kt) : Dynamic MST to JVM bytecode compiler
@@ -10,17 +10,17 @@ Performance and visualization extensions to MST API.
## Artifact:
-The Maven coordinates of this project are `space.kscience:kmath-ast:0.3.0-dev-17`.
+The Maven coordinates of this project are `space.kscience:kmath-ast:0.3.0`.
-**Gradle:**
-```gradle
+**Gradle Groovy:**
+```groovy
repositories {
maven { url 'https://repo.kotlin.link' }
mavenCentral()
}
dependencies {
- implementation 'space.kscience:kmath-ast:0.3.0-dev-17'
+ implementation 'space.kscience:kmath-ast:0.3.0'
}
```
**Gradle Kotlin DSL:**
@@ -31,10 +31,30 @@ repositories {
}
dependencies {
- implementation("space.kscience:kmath-ast:0.3.0-dev-17")
+ implementation("space.kscience:kmath-ast:0.3.0")
}
```
+## Parsing expressions
+
+In this module there is a parser from human-readable strings like `"x^3-x+3"` (in the more specific [grammar](reference/ArithmeticsEvaluator.g4)) to MST instances.
+
+Supported literals:
+1. Constants and variables (consist of latin letters, digits and underscores, can't start with digit): `x`, `_Abc2`.
+2. Numbers: `123`, `1.02`, `1e10`, `1e-10`, `1.0e+3`—all parsed either as `kotlin.Long` or `kotlin.Double`.
+
+Supported binary operators (from the highest precedence to the lowest one):
+1. `^`
+2. `*`, `/`
+3. `+`, `-`
+
+Supported unary operator:
+1. `-`, e. g. `-x`
+
+Arbitrary unary and binary functions are also supported: names consist of latin letters, digits and underscores, can't start with digit. Examples:
+1. `sin(x)`
+2. `add(x, y)`
+
## Dynamic expression code generation
### On JVM
@@ -42,48 +62,66 @@ dependencies {
`kmath-ast` JVM module supports runtime code generation to eliminate overhead of tree traversal. Code generator builds a
special implementation of `Expression` with implemented `invoke` function.
-For example, the following builder:
+For example, the following code:
```kotlin
-import space.kscience.kmath.expressions.Symbol.Companion.x
-import space.kscience.kmath.expressions.*
-import space.kscience.kmath.operations.*
-import space.kscience.kmath.asm.*
-
-MstField { x + 2 }.compileToExpression(DoubleField)
-```
-
-... leads to generation of bytecode, which can be decompiled to the following Java class:
-
-```java
-package space.kscience.kmath.asm.generated;
-
-import java.util.Map;
-
-import kotlin.jvm.functions.Function2;
-import space.kscience.kmath.asm.internal.MapIntrinsics;
-import space.kscience.kmath.expressions.Expression;
-import space.kscience.kmath.expressions.Symbol;
-
-public final class AsmCompiledExpression_45045_0 implements Expression {
- private final Object[] constants;
-
- public final Double invoke(Map arguments) {
- return (Double) ((Function2) this.constants[0]).invoke((Double) MapIntrinsics.getOrFail(arguments, "x"), 2);
- }
-
- public AsmCompiledExpression_45045_0(Object[] constants) {
- this.constants = constants;
- }
-}
+import space.kscience.kmath.asm.compileToExpression
+import space.kscience.kmath.operations.DoubleField
+"x^3-x+3".parseMath().compileToExpression(DoubleField)
```
-#### Known issues
+… leads to generation of bytecode, which can be decompiled to the following Java class:
-- The same classes may be generated and loaded twice, so it is recommended to cache compiled expressions to avoid class
- loading overhead.
-- This API is not supported by non-dynamic JVM implementations (like TeaVM and GraalVM) because of using class loaders.
+```java
+import java.util.*;
+import kotlin.jvm.functions.*;
+import space.kscience.kmath.asm.internal.*;
+import space.kscience.kmath.complex.*;
+import space.kscience.kmath.expressions.*;
+
+public final class CompiledExpression_45045_0 implements Expression {
+ private final Object[] constants;
+
+ public Complex invoke(Map arguments) {
+ Complex var2 = (Complex)MapIntrinsics.getOrFail(arguments, "x");
+ return (Complex)((Function2)this.constants[0]).invoke(var2, (Complex)this.constants[1]);
+ }
+}
+```
+
+For `LongRing`, `IntRing`, and `DoubleField` specialization is supported for better performance:
+
+```java
+import java.util.*;
+import space.kscience.kmath.asm.internal.*;
+import space.kscience.kmath.expressions.*;
+
+public final class CompiledExpression_-386104628_0 implements DoubleExpression {
+ private final SymbolIndexer indexer;
+
+ public SymbolIndexer getIndexer() {
+ return this.indexer;
+ }
+
+ public double invoke(double[] arguments) {
+ double var2 = arguments[0];
+ return Math.pow(var2, 3.0D) - var2 + 3.0D;
+ }
+
+ public final Double invoke(Map arguments) {
+ double var2 = ((Double)MapIntrinsics.getOrFail(arguments, "x")).doubleValue();
+ return Math.pow(var2, 3.0D) - var2 + 3.0D;
+ }
+}
+```
+
+Setting JVM system property `space.kscience.kmath.ast.dump.generated.classes` to `1` makes the translator dump class files to program's working directory, so they can be reviewed manually.
+
+#### Limitations
+
+- The same classes may be generated and loaded twice, so it is recommended to cache compiled expressions to avoid class loading overhead.
+- This API is not supported by non-dynamic JVM implementations like TeaVM or GraalVM Native Image because they may not support class loaders.
### On JS
@@ -121,15 +159,15 @@ MstField { x + 2 }.compileToExpression(DoubleField)
An example of emitted Wasm IR in the form of WAT:
```lisp
-(func $executable (param $0 f64) (result f64)
+(func \$executable (param \$0 f64) (result f64)
(f64.add
- (local.get $0)
+ (local.get \$0)
(f64.const 2)
)
)
```
-#### Known issues
+#### Limitations
- ESTree expression compilation uses `eval` which can be unavailable in several environments.
- WebAssembly isn't supported by old versions of browsers (see https://webassembly.org/roadmap/).
@@ -161,10 +199,7 @@ public fun main() {
Result LaTeX:
-
-
-![](https://latex.codecogs.com/gif.latex?%5Coperatorname{exp}%5C,%5Cleft(%5Csqrt{x}%5Cright)-%5Cfrac{%5Cfrac{%5Coperatorname{arcsin}%5C,%5Cleft(2%5C,x%5Cright)}{2%5Ctimes10^{10}%2Bx^{3}}}{12}+x^{2/3})
-
+$$\operatorname{exp}\\,\left(\sqrt{x}\right)-\frac{\frac{\operatorname{arcsin}\\,\left(2\\,x\right)}{2\times10^{10}+x^{3}}}{12}+x^{2/3}$$
Result MathML (can be used with MathJax or other renderers):
diff --git a/kmath-ast/build.gradle.kts b/kmath-ast/build.gradle.kts
index 15b1d0900..f49c2767a 100644
--- a/kmath-ast/build.gradle.kts
+++ b/kmath-ast/build.gradle.kts
@@ -24,7 +24,7 @@ kotlin.sourceSets {
commonMain {
dependencies {
- api("com.github.h0tk3y.betterParse:better-parse:0.4.2")
+ api("com.github.h0tk3y.betterParse:better-parse:0.4.4")
api(project(":kmath-core"))
}
}
@@ -57,7 +57,7 @@ tasks.dokkaHtml {
if (System.getProperty("space.kscience.kmath.ast.dump.generated.classes") == "1")
tasks.jvmTest {
- jvmArgs = (jvmArgs ?: emptyList()) + listOf("-Dspace.kscience.kmath.ast.dump.generated.classes=1")
+ jvmArgs("-Dspace.kscience.kmath.ast.dump.generated.classes=1")
}
readme {
diff --git a/kmath-ast/docs/README-TEMPLATE.md b/kmath-ast/docs/README-TEMPLATE.md
index 9494af63a..96bbfbf5a 100644
--- a/kmath-ast/docs/README-TEMPLATE.md
+++ b/kmath-ast/docs/README-TEMPLATE.md
@@ -1,11 +1,31 @@
# Module kmath-ast
-Performance and visualization extensions to MST API.
+Extensions to MST API: transformations, dynamic compilation and visualization.
${features}
${artifact}
+## Parsing expressions
+
+In this module there is a parser from human-readable strings like `"x^3-x+3"` (in the more specific [grammar](reference/ArithmeticsEvaluator.g4)) to MST instances.
+
+Supported literals:
+1. Constants and variables (consist of latin letters, digits and underscores, can't start with digit): `x`, `_Abc2`.
+2. Numbers: `123`, `1.02`, `1e10`, `1e-10`, `1.0e+3`—all parsed either as `kotlin.Long` or `kotlin.Double`.
+
+Supported binary operators (from the highest precedence to the lowest one):
+1. `^`
+2. `*`, `/`
+3. `+`, `-`
+
+Supported unary operator:
+1. `-`, e. g. `-x`
+
+Arbitrary unary and binary functions are also supported: names consist of latin letters, digits and underscores, can't start with digit. Examples:
+1. `sin(x)`
+2. `add(x, y)`
+
## Dynamic expression code generation
### On JVM
@@ -13,48 +33,66 @@ ${artifact}
`kmath-ast` JVM module supports runtime code generation to eliminate overhead of tree traversal. Code generator builds a
special implementation of `Expression` with implemented `invoke` function.
-For example, the following builder:
+For example, the following code:
```kotlin
-import space.kscience.kmath.expressions.Symbol.Companion.x
-import space.kscience.kmath.expressions.*
-import space.kscience.kmath.operations.*
-import space.kscience.kmath.asm.*
-
-MstField { x + 2 }.compileToExpression(DoubleField)
-```
-
-... leads to generation of bytecode, which can be decompiled to the following Java class:
-
-```java
-package space.kscience.kmath.asm.generated;
-
-import java.util.Map;
-
-import kotlin.jvm.functions.Function2;
-import space.kscience.kmath.asm.internal.MapIntrinsics;
-import space.kscience.kmath.expressions.Expression;
-import space.kscience.kmath.expressions.Symbol;
-
-public final class AsmCompiledExpression_45045_0 implements Expression {
- private final Object[] constants;
-
- public final Double invoke(Map arguments) {
- return (Double) ((Function2) this.constants[0]).invoke((Double) MapIntrinsics.getOrFail(arguments, "x"), 2);
- }
-
- public AsmCompiledExpression_45045_0(Object[] constants) {
- this.constants = constants;
- }
-}
+import space.kscience.kmath.asm.compileToExpression
+import space.kscience.kmath.operations.DoubleField
+"x^3-x+3".parseMath().compileToExpression(DoubleField)
```
-#### Known issues
+… leads to generation of bytecode, which can be decompiled to the following Java class:
-- The same classes may be generated and loaded twice, so it is recommended to cache compiled expressions to avoid class
- loading overhead.
-- This API is not supported by non-dynamic JVM implementations (like TeaVM and GraalVM) because of using class loaders.
+```java
+import java.util.*;
+import kotlin.jvm.functions.*;
+import space.kscience.kmath.asm.internal.*;
+import space.kscience.kmath.complex.*;
+import space.kscience.kmath.expressions.*;
+
+public final class CompiledExpression_45045_0 implements Expression {
+ private final Object[] constants;
+
+ public Complex invoke(Map arguments) {
+ Complex var2 = (Complex)MapIntrinsics.getOrFail(arguments, "x");
+ return (Complex)((Function2)this.constants[0]).invoke(var2, (Complex)this.constants[1]);
+ }
+}
+```
+
+For `LongRing`, `IntRing`, and `DoubleField` specialization is supported for better performance:
+
+```java
+import java.util.*;
+import space.kscience.kmath.asm.internal.*;
+import space.kscience.kmath.expressions.*;
+
+public final class CompiledExpression_-386104628_0 implements DoubleExpression {
+ private final SymbolIndexer indexer;
+
+ public SymbolIndexer getIndexer() {
+ return this.indexer;
+ }
+
+ public double invoke(double[] arguments) {
+ double var2 = arguments[0];
+ return Math.pow(var2, 3.0D) - var2 + 3.0D;
+ }
+
+ public final Double invoke(Map arguments) {
+ double var2 = ((Double)MapIntrinsics.getOrFail(arguments, "x")).doubleValue();
+ return Math.pow(var2, 3.0D) - var2 + 3.0D;
+ }
+}
+```
+
+Setting JVM system property `space.kscience.kmath.ast.dump.generated.classes` to `1` makes the translator dump class files to program's working directory, so they can be reviewed manually.
+
+#### Limitations
+
+- The same classes may be generated and loaded twice, so it is recommended to cache compiled expressions to avoid class loading overhead.
+- This API is not supported by non-dynamic JVM implementations like TeaVM or GraalVM Native Image because they may not support class loaders.
### On JS
@@ -100,7 +138,7 @@ An example of emitted Wasm IR in the form of WAT:
)
```
-#### Known issues
+#### Limitations
- ESTree expression compilation uses `eval` which can be unavailable in several environments.
- WebAssembly isn't supported by old versions of browsers (see https://webassembly.org/roadmap/).
@@ -132,10 +170,7 @@ public fun main() {
Result LaTeX:
-
-
-![](https://latex.codecogs.com/gif.latex?%5Coperatorname{exp}%5C,%5Cleft(%5Csqrt{x}%5Cright)-%5Cfrac{%5Cfrac{%5Coperatorname{arcsin}%5C,%5Cleft(2%5C,x%5Cright)}{2%5Ctimes10^{10}%2Bx^{3}}}{12}+x^{2/3})
-
+$$\operatorname{exp}\\,\left(\sqrt{x}\right)-\frac{\frac{\operatorname{arcsin}\\,\left(2\\,x\right)}{2\times10^{10}+x^{3}}}{12}+x^{2/3}$$
Result MathML (can be used with MathJax or other renderers):
diff --git a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/TypedMst.kt b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/TypedMst.kt
new file mode 100644
index 000000000..8a8b8797d
--- /dev/null
+++ b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/TypedMst.kt
@@ -0,0 +1,177 @@
+/*
+ * 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.ast
+
+import space.kscience.kmath.expressions.Expression
+import space.kscience.kmath.expressions.Symbol
+import space.kscience.kmath.misc.UnstableKMathAPI
+import space.kscience.kmath.operations.Algebra
+import space.kscience.kmath.operations.NumericAlgebra
+
+/**
+ * MST form where all values belong to the type [T]. It is optimal for constant folding, dynamic compilation, etc.
+ *
+ * @param T the type.
+ */
+@UnstableKMathAPI
+public sealed interface TypedMst {
+ /**
+ * A node containing a unary operation.
+ *
+ * @param T the type.
+ * @property operation The identifier of operation.
+ * @property function The function implementing this operation.
+ * @property value The argument of this operation.
+ */
+ public class Unary(public val operation: String, public val function: (T) -> T, public val value: TypedMst) :
+ TypedMst {
+ override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other == null || this::class != other::class) return false
+ other as Unary<*>
+ if (operation != other.operation) return false
+ if (value != other.value) return false
+ return true
+ }
+
+ override fun hashCode(): Int {
+ var result = operation.hashCode()
+ result = 31 * result + value.hashCode()
+ return result
+ }
+
+ override fun toString(): String = "Unary(operation=$operation, value=$value)"
+ }
+
+ /**
+ * A node containing binary operation.
+ *
+ * @param T the type.
+ * @property operation The identifier of operation.
+ * @property function The binary function implementing this operation.
+ * @property left The left operand.
+ * @property right The right operand.
+ */
+ public class Binary(
+ public val operation: String,
+ public val function: Function,
+ public val left: TypedMst,
+ public val right: TypedMst,
+ ) : TypedMst {
+ override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other == null || this::class != other::class) return false
+
+ other as Binary<*>
+
+ if (operation != other.operation) return false
+ if (left != other.left) return false
+ if (right != other.right) return false
+
+ return true
+ }
+
+ override fun hashCode(): Int {
+ var result = operation.hashCode()
+ result = 31 * result + left.hashCode()
+ result = 31 * result + right.hashCode()
+ return result
+ }
+
+ override fun toString(): String = "Binary(operation=$operation, left=$left, right=$right)"
+ }
+
+ /**
+ * The non-numeric constant value.
+ *
+ * @param T the type.
+ * @property value The held value.
+ * @property number The number this value corresponds.
+ */
+ public class Constant(public val value: T, public val number: Number?) : TypedMst {
+ override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other == null || this::class != other::class) return false
+ other as Constant<*>
+ if (value != other.value) return false
+ if (number != other.number) return false
+ return true
+ }
+
+ override fun hashCode(): Int {
+ var result = value?.hashCode() ?: 0
+ result = 31 * result + (number?.hashCode() ?: 0)
+ return result
+ }
+
+ override fun toString(): String = "Constant(value=$value, number=$number)"
+ }
+
+ /**
+ * The node containing a variable
+ *
+ * @param T the type.
+ * @property symbol The symbol of the variable.
+ */
+ public class Variable(public val symbol: Symbol) : TypedMst {
+ override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other == null || this::class != other::class) return false
+ other as Variable<*>
+ if (symbol != other.symbol) return false
+ return true
+ }
+
+ override fun hashCode(): Int = symbol.hashCode()
+ override fun toString(): String = "Variable(symbol=$symbol)"
+ }
+}
+
+/**
+ * Interprets the [TypedMst] node with this [Algebra] and [arguments].
+ */
+@UnstableKMathAPI
+public fun TypedMst.interpret(algebra: Algebra, arguments: Map): T = when (this) {
+ is TypedMst.Unary -> algebra.unaryOperation(operation, interpret(algebra, arguments))
+
+ is TypedMst.Binary -> when {
+ algebra is NumericAlgebra && left is TypedMst.Constant && left.number != null ->
+ algebra.leftSideNumberOperation(operation, left.number, right.interpret(algebra, arguments))
+
+ algebra is NumericAlgebra && right is TypedMst.Constant && right.number != null ->
+ algebra.rightSideNumberOperation(operation, left.interpret(algebra, arguments), right.number)
+
+ else -> algebra.binaryOperation(
+ operation,
+ left.interpret(algebra, arguments),
+ right.interpret(algebra, arguments),
+ )
+ }
+
+ is TypedMst.Constant -> value
+ is TypedMst.Variable -> arguments.getValue(symbol)
+}
+
+/**
+ * Interprets the [TypedMst] node with this [Algebra] and optional [arguments].
+ */
+@UnstableKMathAPI
+public fun TypedMst.interpret(algebra: Algebra, vararg arguments: Pair): T = interpret(
+ algebra,
+ when (arguments.size) {
+ 0 -> emptyMap()
+ 1 -> mapOf(arguments[0])
+ else -> hashMapOf(*arguments)
+ },
+)
+
+/**
+ * Interpret this [TypedMst] node as expression.
+ */
+@UnstableKMathAPI
+public fun TypedMst.toExpression(algebra: Algebra): Expression = Expression { arguments ->
+ interpret(algebra, arguments)
+}
diff --git a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/evaluateConstants.kt b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/evaluateConstants.kt
new file mode 100644
index 000000000..71fb154c9
--- /dev/null
+++ b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/evaluateConstants.kt
@@ -0,0 +1,93 @@
+/*
+ * 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.ast
+
+import space.kscience.kmath.expressions.MST
+import space.kscience.kmath.expressions.Symbol
+import space.kscience.kmath.misc.UnstableKMathAPI
+import space.kscience.kmath.operations.Algebra
+import space.kscience.kmath.operations.NumericAlgebra
+import space.kscience.kmath.operations.bindSymbolOrNull
+
+/**
+ * Evaluates constants in given [MST] for given [algebra] at the same time with converting to [TypedMst].
+ */
+@UnstableKMathAPI
+public fun MST.evaluateConstants(algebra: Algebra): TypedMst = when (this) {
+ is MST.Numeric -> TypedMst.Constant(
+ (algebra as? NumericAlgebra)?.number(value) ?: error("Numeric nodes are not supported by $algebra"),
+ value,
+ )
+
+ is MST.Unary -> when (val arg = value.evaluateConstants(algebra)) {
+ is TypedMst.Constant -> {
+ val value = algebra.unaryOperation(
+ operation,
+ arg.value,
+ )
+
+ TypedMst.Constant(value, if (value is Number) value else null)
+ }
+
+ else -> TypedMst.Unary(operation, algebra.unaryOperationFunction(operation), arg)
+ }
+
+ is MST.Binary -> {
+ val left = left.evaluateConstants(algebra)
+ val right = right.evaluateConstants(algebra)
+
+ when {
+ left is TypedMst.Constant && right is TypedMst.Constant -> {
+ val value = when {
+ algebra is NumericAlgebra && left.number != null -> algebra.leftSideNumberOperation(
+ operation,
+ left.number,
+ right.value,
+ )
+
+ algebra is NumericAlgebra && right.number != null -> algebra.rightSideNumberOperation(
+ operation,
+ left.value,
+ right.number,
+ )
+
+ else -> algebra.binaryOperation(
+ operation,
+ left.value,
+ right.value,
+ )
+ }
+
+ TypedMst.Constant(value, if (value is Number) value else null)
+ }
+
+ algebra is NumericAlgebra && left is TypedMst.Constant && left.number != null -> TypedMst.Binary(
+ operation,
+ algebra.leftSideNumberOperationFunction(operation),
+ left,
+ right,
+ )
+
+ algebra is NumericAlgebra && right is TypedMst.Constant && right.number != null -> TypedMst.Binary(
+ operation,
+ algebra.rightSideNumberOperationFunction(operation),
+ left,
+ right,
+ )
+
+ else -> TypedMst.Binary(operation, algebra.binaryOperationFunction(operation), left, right)
+ }
+ }
+
+ is Symbol -> {
+ val boundSymbol = algebra.bindSymbolOrNull(this)
+
+ if (boundSymbol != null)
+ TypedMst.Constant(boundSymbol, if (boundSymbol is Number) boundSymbol else null)
+ else
+ TypedMst.Variable(this)
+ }
+}
diff --git a/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/TestFolding.kt b/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/TestFolding.kt
new file mode 100644
index 000000000..954a0f330
--- /dev/null
+++ b/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/TestFolding.kt
@@ -0,0 +1,52 @@
+/*
+ * 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.ast
+
+import space.kscience.kmath.operations.ByteRing
+import space.kscience.kmath.operations.DoubleField
+import space.kscience.kmath.operations.IntRing
+import space.kscience.kmath.operations.pi
+import kotlin.test.Test
+import kotlin.test.assertEquals
+import kotlin.test.fail
+
+internal class TestFolding {
+ @Test
+ fun foldUnary() = assertEquals(
+ -1,
+ ("-(1)".parseMath().evaluateConstants(IntRing) as? TypedMst.Constant ?: fail()).value,
+ )
+
+ @Test
+ fun foldDeepUnary() = assertEquals(
+ 1,
+ ("-(-(1))".parseMath().evaluateConstants(IntRing) as? TypedMst.Constant ?: fail()).value,
+ )
+
+ @Test
+ fun foldBinary() = assertEquals(
+ 2,
+ ("1*2".parseMath().evaluateConstants(IntRing) as? TypedMst.Constant ?: fail()).value,
+ )
+
+ @Test
+ fun foldDeepBinary() = assertEquals(
+ 10,
+ ("1*2*5".parseMath().evaluateConstants(IntRing) as? TypedMst.Constant ?: fail()).value,
+ )
+
+ @Test
+ fun foldSymbol() = assertEquals(
+ DoubleField.pi,
+ ("pi".parseMath().evaluateConstants(DoubleField) as? TypedMst.Constant ?: fail()).value,
+ )
+
+ @Test
+ fun foldNumeric() = assertEquals(
+ 42.toByte(),
+ ("42".parseMath().evaluateConstants(ByteRing) as? TypedMst.Constant ?: fail()).value,
+ )
+}
diff --git a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/estree.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/estree.kt
index a6b6e022b..240acf1d7 100644
--- a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/estree.kt
+++ b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/estree.kt
@@ -5,87 +5,48 @@
package space.kscience.kmath.estree
+import space.kscience.kmath.ast.TypedMst
+import space.kscience.kmath.ast.evaluateConstants
import space.kscience.kmath.estree.internal.ESTreeBuilder
import space.kscience.kmath.expressions.Expression
import space.kscience.kmath.expressions.MST
-import space.kscience.kmath.expressions.MST.*
import space.kscience.kmath.expressions.Symbol
import space.kscience.kmath.expressions.invoke
import space.kscience.kmath.internal.estree.BaseExpression
+import space.kscience.kmath.misc.UnstableKMathAPI
import space.kscience.kmath.operations.Algebra
-import space.kscience.kmath.operations.NumericAlgebra
-import space.kscience.kmath.operations.bindSymbolOrNull
-
-@PublishedApi
-internal fun MST.compileWith(algebra: Algebra): Expression {
- fun ESTreeBuilder.visit(node: MST): BaseExpression = when (node) {
- is Symbol -> {
- val symbol = algebra.bindSymbolOrNull(node)
-
- if (symbol != null)
- constant(symbol)
- else
- variable(node.identity)
- }
-
- is Numeric -> constant(
- (algebra as? NumericAlgebra)?.number(node.value) ?: error("Numeric nodes are not supported by $this")
- )
-
- is Unary -> when {
- algebra is NumericAlgebra && node.value is Numeric -> constant(
- algebra.unaryOperationFunction(node.operation)(algebra.number((node.value as Numeric).value))
- )
-
- else -> call(algebra.unaryOperationFunction(node.operation), visit(node.value))
- }
-
- is Binary -> when {
- algebra is NumericAlgebra && node.left is Numeric && node.right is Numeric -> constant(
- algebra.binaryOperationFunction(node.operation).invoke(
- algebra.number((node.left as Numeric).value),
- algebra.number((node.right as Numeric).value)
- )
- )
-
- algebra is NumericAlgebra && node.left is Numeric -> call(
- algebra.leftSideNumberOperationFunction(node.operation),
- visit(node.left),
- visit(node.right),
- )
-
- algebra is NumericAlgebra && node.right is Numeric -> call(
- algebra.rightSideNumberOperationFunction(node.operation),
- visit(node.left),
- visit(node.right),
- )
-
- else -> call(
- algebra.binaryOperationFunction(node.operation),
- visit(node.left),
- visit(node.right),
- )
- }
- }
-
- return ESTreeBuilder { visit(this@compileWith) }.instance
-}
/**
* Create a compiled expression with given [MST] and given [algebra].
*/
-public fun MST.compileToExpression(algebra: Algebra): Expression = compileWith(algebra)
+@OptIn(UnstableKMathAPI::class)
+public fun MST.compileToExpression(algebra: Algebra): Expression {
+ val typed = evaluateConstants(algebra)
+ if (typed is TypedMst.Constant) return Expression { typed.value }
+ fun ESTreeBuilder.visit(node: TypedMst): BaseExpression = when (node) {
+ is TypedMst.Constant -> constant(node.value)
+ is TypedMst.Variable -> variable(node.symbol)
+ is TypedMst.Unary -> call(node.function, visit(node.value))
+
+ is TypedMst.Binary -> call(
+ node.function,
+ visit(node.left),
+ visit(node.right),
+ )
+ }
+
+ return ESTreeBuilder { visit(typed) }.instance
+}
/**
* Compile given MST to expression and evaluate it against [arguments]
*/
-public inline fun MST.compile(algebra: Algebra, arguments: Map): T =
- compileToExpression(algebra).invoke(arguments)
-
+public fun MST.compile(algebra: Algebra, arguments: Map): T =
+ compileToExpression(algebra)(arguments)
/**
* Compile given MST to expression and evaluate it against [arguments]
*/
-public inline fun MST.compile(algebra: Algebra, vararg arguments: Pair): T =
- compileToExpression(algebra).invoke(*arguments)
+public fun MST.compile(algebra: Algebra, vararg arguments: Pair): T =
+ compileToExpression(algebra)(*arguments)
diff --git a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/ESTreeBuilder.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/ESTreeBuilder.kt
index 4907d8225..16a59d273 100644
--- a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/ESTreeBuilder.kt
+++ b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/ESTreeBuilder.kt
@@ -22,28 +22,20 @@ internal class ESTreeBuilder(val bodyCallback: ESTreeBuilder.() -> BaseExp
}
}
+ @Suppress("UNUSED_VARIABLE")
val instance: Expression by lazy {
val node = Program(
sourceType = "script",
- VariableDeclaration(
- kind = "var",
- VariableDeclarator(
- id = Identifier("executable"),
- init = FunctionExpression(
- params = arrayOf(Identifier("constants"), Identifier("arguments")),
- body = BlockStatement(ReturnStatement(bodyCallback())),
- ),
- ),
- ),
+ ReturnStatement(bodyCallback())
)
- eval(generate(node))
- GeneratedExpression(js("executable"), constants.toTypedArray())
+ val code = generate(node)
+ GeneratedExpression(js("new Function('constants', 'arguments_0', code)"), constants.toTypedArray())
}
private val constants = mutableListOf()
- fun constant(value: Any?) = when {
+ fun constant(value: Any?): BaseExpression = when {
value == null || jsTypeOf(value) == "number" || jsTypeOf(value) == "string" || jsTypeOf(value) == "boolean" ->
SimpleLiteral(value)
@@ -61,7 +53,8 @@ internal class ESTreeBuilder(val bodyCallback: ESTreeBuilder.() -> BaseExp
}
}
- fun variable(name: String): BaseExpression = call(getOrFail, Identifier("arguments"), SimpleLiteral(name))
+ fun variable(name: Symbol): BaseExpression =
+ call(getOrFail, Identifier("arguments_0"), SimpleLiteral(name.identity))
fun call(function: Function, vararg args: BaseExpression): BaseExpression = SimpleCallExpression(
optional = false,
diff --git a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/estree/estree.extensions.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/estree/estree.extensions.kt
index 3aa31f921..5b1ce914e 100644
--- a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/estree/estree.extensions.kt
+++ b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/estree/estree.extensions.kt
@@ -3,6 +3,8 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
+@file:Suppress("unused")
+
package space.kscience.kmath.internal.estree
internal fun Program(sourceType: String, vararg body: dynamic) = object : Program {
@@ -28,9 +30,10 @@ internal fun Identifier(name: String) = object : Identifier {
override var name = name
}
-internal fun FunctionExpression(params: Array, body: BlockStatement) = object : FunctionExpression {
+internal fun FunctionExpression(id: Identifier?, params: Array, body: BlockStatement) = object : FunctionExpression {
override var params = params
override var type = "FunctionExpression"
+ override var id: Identifier? = id
override var body = body
}
diff --git a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/wasm/internal/WasmBuilder.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/wasm/internal/WasmBuilder.kt
index 96090a633..878919d8d 100644
--- a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/wasm/internal/WasmBuilder.kt
+++ b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/wasm/internal/WasmBuilder.kt
@@ -5,8 +5,8 @@
package space.kscience.kmath.wasm.internal
+import space.kscience.kmath.ast.TypedMst
import space.kscience.kmath.expressions.*
-import space.kscience.kmath.expressions.MST.*
import space.kscience.kmath.internal.binaryen.*
import space.kscience.kmath.internal.webassembly.Instance
import space.kscience.kmath.misc.UnstableKMathAPI
@@ -16,11 +16,12 @@ import space.kscience.kmath.internal.webassembly.Module as WasmModule
private val spreader = eval("(obj, args) => obj(...args)")
+@OptIn(UnstableKMathAPI::class)
@Suppress("UnsafeCastFromDynamic")
internal sealed class WasmBuilder>(
protected val binaryenType: Type,
protected val algebra: Algebra,
- protected val target: MST,
+ protected val target: TypedMst,
) {
protected val keys: MutableList = mutableListOf()
protected lateinit var ctx: BinaryenModule
@@ -51,59 +52,41 @@ internal sealed class WasmBuilder>(
Instance(c, js("{}")).exports.executable
}
- protected open fun visitSymbol(node: Symbol): ExpressionRef {
- algebra.bindSymbolOrNull(node)?.let { return visitNumeric(Numeric(it)) }
+ protected abstract fun visitNumber(number: Number): ExpressionRef
- var idx = keys.indexOf(node)
+ protected open fun visitVariable(node: TypedMst.Variable): ExpressionRef {
+ var idx = keys.indexOf(node.symbol)
if (idx == -1) {
- keys += node
+ keys += node.symbol
idx = keys.lastIndex
}
return ctx.local.get(idx, binaryenType)
}
- protected abstract fun visitNumeric(node: Numeric): ExpressionRef
-
- protected open fun visitUnary(node: Unary): ExpressionRef =
+ protected open fun visitUnary(node: TypedMst.Unary): ExpressionRef =
error("Unary operation ${node.operation} not defined in $this")
- protected open fun visitBinary(mst: Binary): ExpressionRef =
+ protected open fun visitBinary(mst: TypedMst.Binary): ExpressionRef =
error("Binary operation ${mst.operation} not defined in $this")
- protected open fun createModule(): BinaryenModule = js("new \$module\$binaryen.Module()")
+ protected open fun createModule(): BinaryenModule = space.kscience.kmath.internal.binaryen.Module()
- protected fun visit(node: MST): ExpressionRef = when (node) {
- is Symbol -> visitSymbol(node)
- is Numeric -> visitNumeric(node)
+ protected fun visit(node: TypedMst): ExpressionRef = when (node) {
+ is TypedMst.Constant -> visitNumber(
+ node.number ?: error("Object constants are not supported by pritimive ASM builder"),
+ )
- is Unary -> when {
- algebra is NumericAlgebra && node.value is Numeric -> visitNumeric(
- Numeric(algebra.unaryOperationFunction(node.operation)(algebra.number((node.value as Numeric).value)))
- )
-
- else -> visitUnary(node)
- }
-
- is Binary -> when {
- algebra is NumericAlgebra && node.left is Numeric && node.right is Numeric -> visitNumeric(
- Numeric(
- algebra.binaryOperationFunction(node.operation)
- .invoke(
- algebra.number((node.left as Numeric).value),
- algebra.number((node.right as Numeric).value)
- )
- )
- )
-
- else -> visitBinary(node)
- }
+ is TypedMst.Variable -> visitVariable(node)
+ is TypedMst.Unary -> visitUnary(node)
+ is TypedMst.Binary -> visitBinary(node)
}
}
@UnstableKMathAPI
-internal class DoubleWasmBuilder(target: MST) : WasmBuilder(f64, DoubleField, target) {
+internal class DoubleWasmBuilder(target: TypedMst) :
+ WasmBuilder(f64, DoubleField, target) {
override val instance by lazy {
object : DoubleExpression {
override val indexer = SimpleSymbolIndexer(keys)
@@ -114,9 +97,9 @@ internal class DoubleWasmBuilder(target: MST) : WasmBuilder): ExpressionRef = when (node.operation) {
GroupOps.MINUS_OPERATION -> ctx.f64.neg(visit(node.value))
GroupOps.PLUS_OPERATION -> visit(node.value)
PowerOperations.SQRT_OPERATION -> ctx.f64.sqrt(visit(node.value))
@@ -137,7 +120,7 @@ internal class DoubleWasmBuilder(target: MST) : WasmBuilder super.visitUnary(node)
}
- override fun visitBinary(mst: Binary): ExpressionRef = when (mst.operation) {
+ override fun visitBinary(mst: TypedMst.Binary): ExpressionRef = when (mst.operation) {
GroupOps.PLUS_OPERATION -> ctx.f64.add(visit(mst.left), visit(mst.right))
GroupOps.MINUS_OPERATION -> ctx.f64.sub(visit(mst.left), visit(mst.right))
RingOps.TIMES_OPERATION -> ctx.f64.mul(visit(mst.left), visit(mst.right))
@@ -148,7 +131,7 @@ internal class DoubleWasmBuilder(target: MST) : WasmBuilder(i32, IntRing, target) {
+internal class IntWasmBuilder(target: TypedMst) : WasmBuilder(i32, IntRing, target) {
override val instance by lazy {
object : IntExpression {
override val indexer = SimpleSymbolIndexer(keys)
@@ -157,15 +140,15 @@ internal class IntWasmBuilder(target: MST) : WasmBuilder(i32
}
}
- override fun visitNumeric(node: Numeric) = ctx.i32.const(node.value.toInt())
+ override fun visitNumber(number: Number) = ctx.i32.const(number.toInt())
- override fun visitUnary(node: Unary): ExpressionRef = when (node.operation) {
+ override fun visitUnary(node: TypedMst.Unary): ExpressionRef = when (node.operation) {
GroupOps.MINUS_OPERATION -> ctx.i32.sub(ctx.i32.const(0), visit(node.value))
GroupOps.PLUS_OPERATION -> visit(node.value)
else -> super.visitUnary(node)
}
- override fun visitBinary(mst: Binary): ExpressionRef = when (mst.operation) {
+ override fun visitBinary(mst: TypedMst.Binary): ExpressionRef = when (mst.operation) {
GroupOps.PLUS_OPERATION -> ctx.i32.add(visit(mst.left), visit(mst.right))
GroupOps.MINUS_OPERATION -> ctx.i32.sub(visit(mst.left), visit(mst.right))
RingOps.TIMES_OPERATION -> ctx.i32.mul(visit(mst.left), visit(mst.right))
diff --git a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/wasm/wasm.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/wasm/wasm.kt
index 12e6b41af..f9540f9db 100644
--- a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/wasm/wasm.kt
+++ b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/wasm/wasm.kt
@@ -7,7 +7,8 @@
package space.kscience.kmath.wasm
-import space.kscience.kmath.estree.compileWith
+import space.kscience.kmath.ast.TypedMst
+import space.kscience.kmath.ast.evaluateConstants
import space.kscience.kmath.expressions.*
import space.kscience.kmath.misc.UnstableKMathAPI
import space.kscience.kmath.operations.DoubleField
@@ -21,8 +22,16 @@ import space.kscience.kmath.wasm.internal.IntWasmBuilder
* @author Iaroslav Postovalov
*/
@UnstableKMathAPI
-public fun MST.compileToExpression(algebra: IntRing): IntExpression = IntWasmBuilder(this).instance
+public fun MST.compileToExpression(algebra: IntRing): IntExpression {
+ val typed = evaluateConstants(algebra)
+ return if (typed is TypedMst.Constant) object : IntExpression {
+ override val indexer = SimpleSymbolIndexer(emptyList())
+
+ override fun invoke(arguments: IntArray): Int = typed.value
+ } else
+ IntWasmBuilder(typed).instance
+}
/**
* Compile given MST to expression and evaluate it against [arguments].
@@ -31,7 +40,7 @@ public fun MST.compileToExpression(algebra: IntRing): IntExpression = IntWasmBui
*/
@UnstableKMathAPI
public fun MST.compile(algebra: IntRing, arguments: Map): Int =
- compileToExpression(algebra).invoke(arguments)
+ compileToExpression(algebra)(arguments)
/**
@@ -49,7 +58,16 @@ public fun MST.compile(algebra: IntRing, vararg arguments: Pair): I
* @author Iaroslav Postovalov
*/
@UnstableKMathAPI
-public fun MST.compileToExpression(algebra: DoubleField): Expression = DoubleWasmBuilder(this).instance
+public fun MST.compileToExpression(algebra: DoubleField): Expression {
+ val typed = evaluateConstants(algebra)
+
+ return if (typed is TypedMst.Constant) object : DoubleExpression {
+ override val indexer = SimpleSymbolIndexer(emptyList())
+
+ override fun invoke(arguments: DoubleArray): Double = typed.value
+ } else
+ DoubleWasmBuilder(typed).instance
+}
/**
@@ -59,7 +77,7 @@ public fun MST.compileToExpression(algebra: DoubleField): Expression = D
*/
@UnstableKMathAPI
public fun MST.compile(algebra: DoubleField, arguments: Map): Double =
- compileToExpression(algebra).invoke(arguments)
+ compileToExpression(algebra)(arguments)
/**
@@ -69,4 +87,4 @@ public fun MST.compile(algebra: DoubleField, arguments: Map): Do
*/
@UnstableKMathAPI
public fun MST.compile(algebra: DoubleField, vararg arguments: Pair): Double =
- compileToExpression(algebra).invoke(*arguments)
+ compileToExpression(algebra)(*arguments)
diff --git a/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/asm.kt b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/asm.kt
index 8e426622d..73b9c97a7 100644
--- a/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/asm.kt
+++ b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/asm.kt
@@ -8,10 +8,14 @@
package space.kscience.kmath.asm
import space.kscience.kmath.asm.internal.*
+import space.kscience.kmath.ast.TypedMst
+import space.kscience.kmath.ast.evaluateConstants
import space.kscience.kmath.expressions.*
-import space.kscience.kmath.expressions.MST.*
import space.kscience.kmath.misc.UnstableKMathAPI
-import space.kscience.kmath.operations.*
+import space.kscience.kmath.operations.Algebra
+import space.kscience.kmath.operations.DoubleField
+import space.kscience.kmath.operations.IntRing
+import space.kscience.kmath.operations.LongRing
/**
* Compiles given MST to an Expression using AST compiler.
@@ -21,102 +25,64 @@ import space.kscience.kmath.operations.*
* @return the compiled expression.
* @author Alexander Nozik
*/
+@OptIn(UnstableKMathAPI::class)
@PublishedApi
internal fun MST.compileWith(type: Class, algebra: Algebra): Expression {
- fun GenericAsmBuilder.variablesVisitor(node: MST): Unit = when (node) {
- is Symbol -> prepareVariable(node.identity)
- is Unary -> variablesVisitor(node.value)
+ val typed = evaluateConstants(algebra)
+ if (typed is TypedMst.Constant) return Expression { typed.value }
- is Binary -> {
+ fun GenericAsmBuilder.variablesVisitor(node: TypedMst): Unit = when (node) {
+ is TypedMst.Unary -> variablesVisitor(node.value)
+
+ is TypedMst.Binary -> {
variablesVisitor(node.left)
variablesVisitor(node.right)
}
- else -> Unit
+ is TypedMst.Variable -> prepareVariable(node.symbol)
+ is TypedMst.Constant -> Unit
}
- fun GenericAsmBuilder.expressionVisitor(node: MST): Unit = when (node) {
- is Symbol -> {
- val symbol = algebra.bindSymbolOrNull(node)
+ fun GenericAsmBuilder.expressionVisitor(node: TypedMst): Unit = when (node) {
+ is TypedMst.Constant -> if (node.number != null)
+ loadNumberConstant(node.number)
+ else
+ loadObjectConstant(node.value)
- if (symbol != null)
- loadObjectConstant(symbol as Any)
- else
- loadVariable(node.identity)
- }
+ is TypedMst.Variable -> loadVariable(node.symbol)
+ is TypedMst.Unary -> buildCall(node.function) { expressionVisitor(node.value) }
- is Numeric -> if (algebra is NumericAlgebra) {
- if (Number::class.java.isAssignableFrom(type))
- loadNumberConstant(algebra.number(node.value) as Number)
- else
- loadObjectConstant(algebra.number(node.value))
- } else
- error("Numeric nodes are not supported by $this")
-
- is Unary -> when {
- algebra is NumericAlgebra && node.value is Numeric -> loadObjectConstant(
- algebra.unaryOperationFunction(node.operation)(algebra.number((node.value as Numeric).value)),
- )
-
- else -> buildCall(algebra.unaryOperationFunction(node.operation)) { expressionVisitor(node.value) }
- }
-
- is Binary -> when {
- algebra is NumericAlgebra && node.left is Numeric && node.right is Numeric -> loadObjectConstant(
- algebra.binaryOperationFunction(node.operation).invoke(
- algebra.number((node.left as Numeric).value),
- algebra.number((node.right as Numeric).value),
- )
- )
-
- algebra is NumericAlgebra && node.left is Numeric -> buildCall(
- algebra.leftSideNumberOperationFunction(node.operation),
- ) {
- expressionVisitor(node.left)
- expressionVisitor(node.right)
- }
-
- algebra is NumericAlgebra && node.right is Numeric -> buildCall(
- algebra.rightSideNumberOperationFunction(node.operation),
- ) {
- expressionVisitor(node.left)
- expressionVisitor(node.right)
- }
-
- else -> buildCall(algebra.binaryOperationFunction(node.operation)) {
- expressionVisitor(node.left)
- expressionVisitor(node.right)
- }
+ is TypedMst.Binary -> buildCall(node.function) {
+ expressionVisitor(node.left)
+ expressionVisitor(node.right)
}
}
return GenericAsmBuilder(
type,
- buildName(this),
- { variablesVisitor(this@compileWith) },
- { expressionVisitor(this@compileWith) },
+ buildName("${typed.hashCode()}_${type.simpleName}"),
+ { variablesVisitor(typed) },
+ { expressionVisitor(typed) },
).instance
}
-
/**
* Create a compiled expression with given [MST] and given [algebra].
*/
public inline fun MST.compileToExpression(algebra: Algebra): Expression =
compileWith(T::class.java, algebra)
-
/**
* Compile given MST to expression and evaluate it against [arguments]
*/
public inline fun MST.compile(algebra: Algebra, arguments: Map): T =
- compileToExpression(algebra).invoke(arguments)
+ compileToExpression(algebra)(arguments)
/**
* Compile given MST to expression and evaluate it against [arguments]
*/
public inline fun MST.compile(algebra: Algebra, vararg arguments: Pair): T =
- compileToExpression(algebra).invoke(*arguments)
+ compileToExpression(algebra)(*arguments)
/**
@@ -125,7 +91,16 @@ public inline fun MST.compile(algebra: Algebra, vararg argu
* @author Iaroslav Postovalov
*/
@UnstableKMathAPI
-public fun MST.compileToExpression(algebra: IntRing): IntExpression = IntAsmBuilder(this).instance
+public fun MST.compileToExpression(algebra: IntRing): IntExpression {
+ val typed = evaluateConstants(algebra)
+
+ return if (typed is TypedMst.Constant) object : IntExpression {
+ override val indexer = SimpleSymbolIndexer(emptyList())
+
+ override fun invoke(arguments: IntArray): Int = typed.value
+ } else
+ IntAsmBuilder(typed).instance
+}
/**
* Compile given MST to expression and evaluate it against [arguments].
@@ -134,7 +109,7 @@ public fun MST.compileToExpression(algebra: IntRing): IntExpression = IntAsmBuil
*/
@UnstableKMathAPI
public fun MST.compile(algebra: IntRing, arguments: Map): Int =
- compileToExpression(algebra).invoke(arguments)
+ compileToExpression(algebra)(arguments)
/**
* Compile given MST to expression and evaluate it against [arguments].
@@ -152,8 +127,16 @@ public fun MST.compile(algebra: IntRing, vararg arguments: Pair): I
* @author Iaroslav Postovalov
*/
@UnstableKMathAPI
-public fun MST.compileToExpression(algebra: LongRing): LongExpression = LongAsmBuilder(this).instance
+public fun MST.compileToExpression(algebra: LongRing): LongExpression {
+ val typed = evaluateConstants(algebra)
+ return if (typed is TypedMst.Constant) object : LongExpression {
+ override val indexer = SimpleSymbolIndexer(emptyList())
+
+ override fun invoke(arguments: LongArray): Long = typed.value
+ } else
+ LongAsmBuilder(typed).instance
+}
/**
* Compile given MST to expression and evaluate it against [arguments].
@@ -162,7 +145,7 @@ public fun MST.compileToExpression(algebra: LongRing): LongExpression = LongAsmB
*/
@UnstableKMathAPI
public fun MST.compile(algebra: LongRing, arguments: Map): Long =
- compileToExpression(algebra).invoke(arguments)
+ compileToExpression(algebra)(arguments)
/**
@@ -181,7 +164,17 @@ public fun MST.compile(algebra: LongRing, vararg arguments: Pair):
* @author Iaroslav Postovalov
*/
@UnstableKMathAPI
-public fun MST.compileToExpression(algebra: DoubleField): DoubleExpression = DoubleAsmBuilder(this).instance
+public fun MST.compileToExpression(algebra: DoubleField): DoubleExpression {
+ val typed = evaluateConstants(algebra)
+
+ return if (typed is TypedMst.Constant) object : DoubleExpression {
+ override val indexer = SimpleSymbolIndexer(emptyList())
+
+ override fun invoke(arguments: DoubleArray): Double = typed.value
+ } else
+ DoubleAsmBuilder(typed).instance
+}
+
/**
* Compile given MST to expression and evaluate it against [arguments].
@@ -190,7 +183,7 @@ public fun MST.compileToExpression(algebra: DoubleField): DoubleExpression = Dou
*/
@UnstableKMathAPI
public fun MST.compile(algebra: DoubleField, arguments: Map): Double =
- compileToExpression(algebra).invoke(arguments)
+ compileToExpression(algebra)(arguments)
/**
* Compile given MST to expression and evaluate it against [arguments].
@@ -199,4 +192,4 @@ public fun MST.compile(algebra: DoubleField, arguments: Map): Do
*/
@UnstableKMathAPI
public fun MST.compile(algebra: DoubleField, vararg arguments: Pair): Double =
- compileToExpression(algebra).invoke(*arguments)
+ compileToExpression(algebra)(*arguments)
diff --git a/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/AsmBuilder.kt b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/AsmBuilder.kt
index a85079fc8..a76b47ecc 100644
--- a/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/AsmBuilder.kt
+++ b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/AsmBuilder.kt
@@ -49,5 +49,7 @@ internal abstract class AsmBuilder {
* ASM Type for [space.kscience.kmath.expressions.Symbol].
*/
val SYMBOL_TYPE: Type = getObjectType("space/kscience/kmath/expressions/Symbol")
+
+ const val ARGUMENTS_NAME = "args"
}
}
diff --git a/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/GenericAsmBuilder.kt b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/GenericAsmBuilder.kt
index 5eb739956..6cf3d8721 100644
--- a/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/GenericAsmBuilder.kt
+++ b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/GenericAsmBuilder.kt
@@ -56,7 +56,7 @@ internal class GenericAsmBuilder(
/**
* Local variables indices are indices of symbols in this list.
*/
- private val argumentsLocals = mutableListOf()
+ private val argumentsLocals = mutableListOf()
/**
* Subclasses, loads and instantiates [Expression] for given parameters.
@@ -253,10 +253,10 @@ internal class GenericAsmBuilder(
* Stores value variable [name] into a local. Should be called within [variablesPrepareCallback] before using
* [loadVariable].
*/
- fun prepareVariable(name: String): Unit = invokeMethodVisitor.run {
+ fun prepareVariable(name: Symbol): Unit = invokeMethodVisitor.run {
if (name in argumentsLocals) return@run
load(1, MAP_TYPE)
- aconst(name)
+ aconst(name.identity)
invokestatic(
MAP_INTRINSICS_TYPE.internalName,
@@ -280,7 +280,7 @@ internal class GenericAsmBuilder(
* Loads a variable [name] from arguments [Map] parameter of [Expression.invoke]. The variable should be stored
* with [prepareVariable] first.
*/
- fun loadVariable(name: String): Unit = invokeMethodVisitor.load(2 + argumentsLocals.indexOf(name), tType)
+ fun loadVariable(name: Symbol): Unit = invokeMethodVisitor.load(2 + argumentsLocals.indexOf(name), tType)
inline fun buildCall(function: Function, parameters: GenericAsmBuilder.() -> Unit) {
contract { callsInPlace(parameters, InvocationKind.EXACTLY_ONCE) }
diff --git a/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/PrimitiveAsmBuilder.kt b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/PrimitiveAsmBuilder.kt
index bf1f42395..01bad83e5 100644
--- a/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/PrimitiveAsmBuilder.kt
+++ b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/PrimitiveAsmBuilder.kt
@@ -11,6 +11,7 @@ import org.objectweb.asm.Opcodes.*
import org.objectweb.asm.Type
import org.objectweb.asm.Type.*
import org.objectweb.asm.commons.InstructionAdapter
+import space.kscience.kmath.ast.TypedMst
import space.kscience.kmath.expressions.*
import space.kscience.kmath.misc.UnstableKMathAPI
import space.kscience.kmath.operations.*
@@ -25,9 +26,9 @@ internal sealed class PrimitiveAsmBuilder>(
classOfT: Class<*>,
protected val classOfTPrimitive: Class<*>,
expressionParent: Class,
- protected val target: MST,
+ protected val target: TypedMst,
) : AsmBuilder() {
- private val className: String = buildName(target)
+ private val className: String = buildName("${target.hashCode()}_${classOfT.simpleName}")
/**
* ASM type for [tType].
@@ -329,63 +330,39 @@ internal sealed class PrimitiveAsmBuilder>(
}
private fun visitVariables(
- node: MST,
+ node: TypedMst,
arrayMode: Boolean,
alreadyLoaded: MutableList = mutableListOf()
): Unit = when (node) {
- is Symbol -> when (node) {
- !in alreadyLoaded -> {
- alreadyLoaded += node
- prepareVariable(node, arrayMode)
- }
- else -> {
- }
- }
+ is TypedMst.Variable -> if (node.symbol !in alreadyLoaded) {
+ alreadyLoaded += node.symbol
+ prepareVariable(node.symbol, arrayMode)
+ } else Unit
- is MST.Unary -> visitVariables(node.value, arrayMode, alreadyLoaded)
+ is TypedMst.Unary -> visitVariables(node.value, arrayMode, alreadyLoaded)
- is MST.Binary -> {
+ is TypedMst.Binary -> {
visitVariables(node.left, arrayMode, alreadyLoaded)
visitVariables(node.right, arrayMode, alreadyLoaded)
}
- else -> Unit
+ is TypedMst.Constant -> Unit
}
- private fun visitExpression(node: MST): Unit = when (node) {
- is Symbol -> {
- val symbol = algebra.bindSymbolOrNull(node)
+ private fun visitExpression(node: TypedMst): Unit = when (node) {
+ is TypedMst.Variable -> loadVariable(node.symbol)
- if (symbol != null)
- loadNumberConstant(symbol)
- else
- loadVariable(node)
- }
+ is TypedMst.Constant -> loadNumberConstant(
+ node.number ?: error("Object constants are not supported by pritimive ASM builder"),
+ )
- is MST.Numeric -> loadNumberConstant(algebra.number(node.value))
-
- is MST.Unary -> if (node.value is MST.Numeric)
- loadNumberConstant(
- algebra.unaryOperationFunction(node.operation)(algebra.number((node.value as MST.Numeric).value)),
- )
- else
- visitUnary(node)
-
- is MST.Binary -> when {
- node.left is MST.Numeric && node.right is MST.Numeric -> loadNumberConstant(
- algebra.binaryOperationFunction(node.operation)(
- algebra.number((node.left as MST.Numeric).value),
- algebra.number((node.right as MST.Numeric).value),
- ),
- )
-
- else -> visitBinary(node)
- }
+ is TypedMst.Unary -> visitUnary(node)
+ is TypedMst.Binary -> visitBinary(node)
}
- protected open fun visitUnary(node: MST.Unary) = visitExpression(node.value)
+ protected open fun visitUnary(node: TypedMst.Unary) = visitExpression(node.value)
- protected open fun visitBinary(node: MST.Binary) {
+ protected open fun visitBinary(node: TypedMst.Binary) {
visitExpression(node.left)
visitExpression(node.right)
}
@@ -404,14 +381,13 @@ internal sealed class PrimitiveAsmBuilder>(
}
@UnstableKMathAPI
-internal class DoubleAsmBuilder(target: MST) : PrimitiveAsmBuilder(
+internal class DoubleAsmBuilder(target: TypedMst) : PrimitiveAsmBuilder(
DoubleField,
java.lang.Double::class.java,
java.lang.Double.TYPE,
DoubleExpression::class.java,
target,
) {
-
private fun buildUnaryJavaMathCall(name: String) = invokeMethodVisitor.invokestatic(
MATH_TYPE.internalName,
name,
@@ -434,7 +410,7 @@ internal class DoubleAsmBuilder(target: MST) : PrimitiveAsmBuilder) {
super.visitUnary(node)
when (node.operation) {
@@ -459,7 +435,7 @@ internal class DoubleAsmBuilder(target: MST) : PrimitiveAsmBuilder) {
super.visitBinary(node)
when (node.operation) {
@@ -479,7 +455,7 @@ internal class DoubleAsmBuilder(target: MST) : PrimitiveAsmBuilder) :
PrimitiveAsmBuilder(
IntRing,
Integer::class.java,
@@ -487,7 +463,7 @@ internal class IntAsmBuilder(target: MST) :
IntExpression::class.java,
target
) {
- override fun visitUnary(node: MST.Unary) {
+ override fun visitUnary(node: TypedMst.Unary) {
super.visitUnary(node)
when (node.operation) {
@@ -497,7 +473,7 @@ internal class IntAsmBuilder(target: MST) :
}
}
- override fun visitBinary(node: MST.Binary) {
+ override fun visitBinary(node: TypedMst.Binary) {
super.visitBinary(node)
when (node.operation) {
@@ -510,14 +486,14 @@ internal class IntAsmBuilder(target: MST) :
}
@UnstableKMathAPI
-internal class LongAsmBuilder(target: MST) : PrimitiveAsmBuilder(
+internal class LongAsmBuilder(target: TypedMst) : PrimitiveAsmBuilder(
LongRing,
java.lang.Long::class.java,
java.lang.Long.TYPE,
LongExpression::class.java,
target,
) {
- override fun visitUnary(node: MST.Unary) {
+ override fun visitUnary(node: TypedMst.Unary) {
super.visitUnary(node)
when (node.operation) {
@@ -527,7 +503,7 @@ internal class LongAsmBuilder(target: MST) : PrimitiveAsmBuilder) {
super.visitBinary(node)
when (node.operation) {
diff --git a/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/codegenUtils.kt b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/codegenUtils.kt
index 06e040e93..9e880f4fc 100644
--- a/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/codegenUtils.kt
+++ b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/codegenUtils.kt
@@ -55,15 +55,15 @@ internal inline fun MethodVisitor.instructionAdapter(block: InstructionAdapter.(
internal fun MethodVisitor.label(): Label = Label().also(::visitLabel)
/**
- * Creates a class name for [Expression] subclassed to implement [mst] provided.
+ * Creates a class name for [Expression] based with appending [marker] to reduce collisions.
*
* These methods help to avoid collisions of class name to prevent loading several classes with the same name. If there
* is a colliding class, change [collision] parameter or leave it `0` to check existing classes recursively.
*
* @author Iaroslav Postovalov
*/
-internal tailrec fun buildName(mst: MST, collision: Int = 0): String {
- val name = "space.kscience.kmath.asm.generated.CompiledExpression_${mst.hashCode()}_$collision"
+internal tailrec fun buildName(marker: String, collision: Int = 0): String {
+ val name = "space.kscience.kmath.asm.generated.CompiledExpression_${marker}_$collision"
try {
Class.forName(name)
@@ -71,7 +71,7 @@ internal tailrec fun buildName(mst: MST, collision: Int = 0): String {
return name
}
- return buildName(mst, collision + 1)
+ return buildName(marker, collision + 1)
}
@Suppress("FunctionName")
diff --git a/kmath-commons/README.md b/kmath-commons/README.md
new file mode 100644
index 000000000..7195e6fb1
--- /dev/null
+++ b/kmath-commons/README.md
@@ -0,0 +1,32 @@
+# Module kmath-commons
+
+Commons math binding for kmath
+
+## Usage
+
+## Artifact:
+
+The Maven coordinates of this project are `space.kscience:kmath-commons:0.3.0`.
+
+**Gradle Groovy:**
+```groovy
+repositories {
+ maven { url 'https://repo.kotlin.link' }
+ mavenCentral()
+}
+
+dependencies {
+ implementation 'space.kscience:kmath-commons:0.3.0'
+}
+```
+**Gradle Kotlin DSL:**
+```kotlin
+repositories {
+ maven("https://repo.kotlin.link")
+ mavenCentral()
+}
+
+dependencies {
+ implementation("space.kscience:kmath-commons:0.3.0")
+}
+```
diff --git a/kmath-complex/README.md b/kmath-complex/README.md
index 92f2435ba..4646c6a80 100644
--- a/kmath-complex/README.md
+++ b/kmath-complex/README.md
@@ -8,17 +8,17 @@ Complex and hypercomplex number systems in KMath.
## Artifact:
-The Maven coordinates of this project are `space.kscience:kmath-complex:0.3.0-dev-17`.
+The Maven coordinates of this project are `space.kscience:kmath-complex:0.3.0`.
-**Gradle:**
-```gradle
+**Gradle Groovy:**
+```groovy
repositories {
maven { url 'https://repo.kotlin.link' }
mavenCentral()
}
dependencies {
- implementation 'space.kscience:kmath-complex:0.3.0-dev-17'
+ implementation 'space.kscience:kmath-complex:0.3.0'
}
```
**Gradle Kotlin DSL:**
@@ -29,6 +29,6 @@ repositories {
}
dependencies {
- implementation("space.kscience:kmath-complex:0.3.0-dev-17")
+ implementation("space.kscience:kmath-complex:0.3.0")
}
```
diff --git a/kmath-complex/build.gradle.kts b/kmath-complex/build.gradle.kts
index ea74df646..f0ce631a5 100644
--- a/kmath-complex/build.gradle.kts
+++ b/kmath-complex/build.gradle.kts
@@ -19,13 +19,15 @@ readme {
feature(
id = "complex",
- description = "Complex Numbers",
ref = "src/commonMain/kotlin/space/kscience/kmath/complex/Complex.kt"
- )
+ ){
+ "Complex numbers operations"
+ }
feature(
id = "quaternion",
- description = "Quaternions",
ref = "src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt"
- )
+ ){
+ "Quaternions and their composition"
+ }
}
diff --git a/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt b/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt
index 3ef3428c6..0305bfc88 100644
--- a/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt
+++ b/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt
@@ -16,52 +16,132 @@ import space.kscience.kmath.structures.MutableBuffer
import space.kscience.kmath.structures.MutableMemoryBuffer
import kotlin.math.*
+/**
+ * Represents `double`-based quaternion.
+ *
+ * @property w The first component.
+ * @property x The second component.
+ * @property y The third component.
+ * @property z The fourth component.
+ */
+public class Quaternion(
+ public val w: Double,
+ public val x: Double,
+ public val y: Double,
+ public val z: Double,
+) : Buffer {
+ init {
+ require(!w.isNaN()) { "w-component of quaternion is not-a-number" }
+ require(!x.isNaN()) { "x-component of quaternion is not-a-number" }
+ require(!y.isNaN()) { "y-component of quaternion is not-a-number" }
+ require(!z.isNaN()) { "z-component of quaternion is not-a-number" }
+ }
+
+ /**
+ * Returns a string representation of this quaternion.
+ */
+ override fun toString(): String = "($w + $x * i + $y * j + $z * k)"
+
+ override val size: Int get() = 4
+
+ override fun get(index: Int): Double = when (index) {
+ 0 -> w
+ 1 -> x
+ 2 -> y
+ 3 -> z
+ else -> error("Index $index out of bounds [0,3]")
+ }
+
+ override fun iterator(): Iterator = listOf(w, x, y, z).iterator()
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other == null || this::class != other::class) return false
+
+ other as Quaternion
+
+ if (w != other.w) return false
+ if (x != other.x) return false
+ if (y != other.y) return false
+ if (z != other.z) return false
+
+ return true
+ }
+
+ override fun hashCode(): Int {
+ var result = w.hashCode()
+ result = 31 * result + x.hashCode()
+ result = 31 * result + y.hashCode()
+ result = 31 * result + z.hashCode()
+ return result
+ }
+
+ public companion object : MemorySpec {
+ override val objectSize: Int get() = 32
+
+ override fun MemoryReader.read(offset: Int): Quaternion = Quaternion(
+ readDouble(offset),
+ readDouble(offset + 8),
+ readDouble(offset + 16),
+ readDouble(offset + 24)
+ )
+
+ override fun MemoryWriter.write(offset: Int, value: Quaternion) {
+ writeDouble(offset, value.w)
+ writeDouble(offset + 8, value.x)
+ writeDouble(offset + 16, value.y)
+ writeDouble(offset + 24, value.z)
+ }
+ }
+}
+
+public fun Quaternion(w: Number, x: Number = 0.0, y: Number = 0.0, z: Number = 0.0): Quaternion = Quaternion(
+ w.toDouble(),
+ x.toDouble(),
+ y.toDouble(),
+ z.toDouble(),
+)
+
/**
* This quaternion's conjugate.
*/
public val Quaternion.conjugate: Quaternion
- get() = QuaternionField { z - x * i - y * j - z * k }
+ get() = Quaternion(w, -x, -y, -z)
/**
* This quaternion's reciprocal.
*/
public val Quaternion.reciprocal: Quaternion
get() {
- QuaternionField {
- val n = norm(this@reciprocal)
- return conjugate / (n * n)
- }
+ val norm2 = (w * w + x * x + y * y + z * z)
+ return Quaternion(w / norm2, -x / norm2, -y / norm2, -z / norm2)
}
-/**
- * Absolute value of the quaternion.
- */
-public val Quaternion.r: Double
- get() = sqrt(w * w + x * x + y * y + z * z)
+public fun Quaternion.normalized(): Quaternion = with(QuaternionField){ this@normalized / norm(this@normalized) }
/**
* A field of [Quaternion].
*/
@OptIn(UnstableKMathAPI::class)
-public object QuaternionField : Field, Norm, PowerOperations,
+public object QuaternionField : Field, Norm, PowerOperations,
ExponentialOperations, NumbersAddOps, ScaleOperations {
- override val zero: Quaternion = 0.toQuaternion()
- override val one: Quaternion = 1.toQuaternion()
+ override val zero: Quaternion = Quaternion(0.0)
+ override val one: Quaternion = Quaternion(1.0)
/**
* The `i` quaternion unit.
*/
- public val i: Quaternion = Quaternion(0, 1)
+ public val i: Quaternion = Quaternion(0.0, 1.0, 0.0, 0.0)
/**
* The `j` quaternion unit.
*/
- public val j: Quaternion = Quaternion(0, 0, 1)
+ public val j: Quaternion = Quaternion(0.0, 0.0, 1.0, 0.0)
/**
* The `k` quaternion unit.
*/
- public val k: Quaternion = Quaternion(0, 0, 0, 1)
+ public val k: Quaternion = Quaternion(0.0, 0.0, 0.0, 1.0)
override fun add(left: Quaternion, right: Quaternion): Quaternion =
Quaternion(left.w + right.w, left.x + right.x, left.y + right.y, left.z + right.z)
@@ -133,7 +213,7 @@ public object QuaternionField : Field, Norm,
override fun exp(arg: Quaternion): Quaternion {
val un = arg.x * arg.x + arg.y * arg.y + arg.z * arg.z
- if (un == 0.0) return exp(arg.w).toQuaternion()
+ if (un == 0.0) return Quaternion(exp(arg.w))
val n1 = sqrt(un)
val ea = exp(arg.w)
val n2 = ea * sin(n1) / n1
@@ -158,7 +238,8 @@ public object QuaternionField : Field, Norm,
return Quaternion(ln(n), th * arg.x, th * arg.y, th * arg.z)
}
- override operator fun Number.plus(other: Quaternion): Quaternion = Quaternion(toDouble() + other.w, other.x, other.y, other.z)
+ override operator fun Number.plus(other: Quaternion): Quaternion =
+ Quaternion(toDouble() + other.w, other.x, other.y, other.z)
override operator fun Number.minus(other: Quaternion): Quaternion =
Quaternion(toDouble() - other.w, -other.x, -other.y, -other.z)
@@ -170,7 +251,12 @@ public object QuaternionField : Field, Norm,
Quaternion(toDouble() * arg.w, toDouble() * arg.x, toDouble() * arg.y, toDouble() * arg.z)
override fun Quaternion.unaryMinus(): Quaternion = Quaternion(-w, -x, -y, -z)
- override fun norm(arg: Quaternion): Quaternion = sqrt(arg.conjugate * arg)
+ override fun norm(arg: Quaternion): Double = sqrt(
+ arg.w.pow(2) +
+ arg.x.pow(2) +
+ arg.y.pow(2) +
+ arg.z.pow(2)
+ )
override fun bindSymbolOrNull(value: String): Quaternion? = when (value) {
"i" -> i
@@ -179,7 +265,7 @@ public object QuaternionField : Field, Norm,
else -> null
}
- override fun number(value: Number): Quaternion = value.toQuaternion()
+ override fun number(value: Number): Quaternion = Quaternion(value)
override fun sinh(arg: Quaternion): Quaternion = (exp(arg) - exp(-arg)) / 2.0
override fun cosh(arg: Quaternion): Quaternion = (exp(arg) + exp(-arg)) / 2.0
@@ -189,76 +275,6 @@ public object QuaternionField : Field, Norm,
override fun atanh(arg: Quaternion): Quaternion = (ln(arg + one) - ln(one - arg)) / 2.0
}
-/**
- * Represents `double`-based quaternion.
- *
- * @property w The first component.
- * @property x The second component.
- * @property y The third component.
- * @property z The fourth component.
- */
-@OptIn(UnstableKMathAPI::class)
-public data class Quaternion(
- val w: Double, val x: Double, val y: Double, val z: Double,
-) {
- public constructor(w: Number, x: Number, y: Number, z: Number) : this(
- w.toDouble(),
- x.toDouble(),
- y.toDouble(),
- z.toDouble(),
- )
-
- public constructor(w: Number, x: Number, y: Number) : this(w.toDouble(), x.toDouble(), y.toDouble(), 0.0)
- public constructor(w: Number, x: Number) : this(w.toDouble(), x.toDouble(), 0.0, 0.0)
- public constructor(w: Number) : this(w.toDouble(), 0.0, 0.0, 0.0)
- public constructor(wx: Complex, yz: Complex) : this(wx.re, wx.im, yz.re, yz.im)
- public constructor(wx: Complex) : this(wx.re, wx.im, 0, 0)
-
- init {
- require(!w.isNaN()) { "w-component of quaternion is not-a-number" }
- require(!x.isNaN()) { "x-component of quaternion is not-a-number" }
- require(!y.isNaN()) { "x-component of quaternion is not-a-number" }
- require(!z.isNaN()) { "x-component of quaternion is not-a-number" }
- }
-
- /**
- * Returns a string representation of this quaternion.
- */
- override fun toString(): String = "($w + $x * i + $y * j + $z * k)"
-
- public companion object : MemorySpec {
- override val objectSize: Int
- get() = 32
-
- override fun MemoryReader.read(offset: Int): Quaternion =
- Quaternion(readDouble(offset), readDouble(offset + 8), readDouble(offset + 16), readDouble(offset + 24))
-
- override fun MemoryWriter.write(offset: Int, value: Quaternion) {
- writeDouble(offset, value.w)
- writeDouble(offset + 8, value.x)
- writeDouble(offset + 16, value.y)
- writeDouble(offset + 24, value.z)
- }
- }
-}
-
-/**
- * Creates a quaternion with real part equal to this real.
- *
- * @receiver the real part.
- * @return a new quaternion.
- */
-public fun Number.toQuaternion(): Quaternion = Quaternion(this)
-
-/**
- * Creates a quaternion with `w`-component equal to `re`-component of given complex and `x`-component equal to
- * `im`-component of given complex.
- *
- * @receiver the complex number.
- * @return a new quaternion.
- */
-public fun Complex.toQuaternion(): Quaternion = Quaternion(this)
-
/**
* Creates a new buffer of quaternions with the specified [size], where each element is calculated by calling the
* specified [init] function.
diff --git a/kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/QuaternionFieldTest.kt b/kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/QuaternionTest.kt
similarity index 84%
rename from kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/QuaternionFieldTest.kt
rename to kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/QuaternionTest.kt
index 6784f3516..fd4df736c 100644
--- a/kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/QuaternionFieldTest.kt
+++ b/kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/QuaternionTest.kt
@@ -6,10 +6,23 @@
package space.kscience.kmath.complex
import space.kscience.kmath.operations.invoke
+import space.kscience.kmath.testutils.assertBufferEquals
import kotlin.test.Test
import kotlin.test.assertEquals
-internal class QuaternionFieldTest {
+internal class QuaternionTest {
+
+ @Test
+ fun testNorm() {
+ assertEquals(2.0, QuaternionField.norm(Quaternion(1.0, 1.0, 1.0, 1.0)))
+ }
+
+ @Test
+ fun testInverse() = QuaternionField {
+ val q = Quaternion(1.0, 2.0, -3.0, 4.0)
+ assertBufferEquals(one, q * q.reciprocal, 1e-4)
+ }
+
@Test
fun testAddition() {
assertEquals(Quaternion(42, 42), QuaternionField { Quaternion(16, 16) + Quaternion(26, 26) })
diff --git a/kmath-core/README.md b/kmath-core/README.md
index e765ad50c..4fddd327c 100644
--- a/kmath-core/README.md
+++ b/kmath-core/README.md
@@ -15,17 +15,17 @@ performance calculations to code generation.
## Artifact:
-The Maven coordinates of this project are `space.kscience:kmath-core:0.3.0-dev-17`.
+The Maven coordinates of this project are `space.kscience:kmath-core:0.3.0`.
-**Gradle:**
-```gradle
+**Gradle Groovy:**
+```groovy
repositories {
maven { url 'https://repo.kotlin.link' }
mavenCentral()
}
dependencies {
- implementation 'space.kscience:kmath-core:0.3.0-dev-17'
+ implementation 'space.kscience:kmath-core:0.3.0'
}
```
**Gradle Kotlin DSL:**
@@ -36,6 +36,6 @@ repositories {
}
dependencies {
- implementation("space.kscience:kmath-core:0.3.0-dev-17")
+ implementation("space.kscience:kmath-core:0.3.0")
}
```
diff --git a/kmath-core/api/kmath-core.api b/kmath-core/api/kmath-core.api
index b424b59ff..737d33f1c 100644
--- a/kmath-core/api/kmath-core.api
+++ b/kmath-core/api/kmath-core.api
@@ -1,17 +1,29 @@
public final class space/kscience/kmath/data/ColumnarDataKt {
+ public static final fun getIndices (Lspace/kscience/kmath/data/ColumnarData;)Lkotlin/ranges/IntRange;
+}
+
+public final class space/kscience/kmath/data/XYColumnarData$Companion {
}
public final class space/kscience/kmath/data/XYColumnarDataKt {
public static synthetic fun asXYData$default (Lspace/kscience/kmath/nd/Structure2D;IIILjava/lang/Object;)Lspace/kscience/kmath/data/XYColumnarData;
}
+public final class space/kscience/kmath/data/XYErrorColumnarData$Companion {
+ public final fun of (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/data/XYErrorColumnarData;
+}
+
public abstract interface class space/kscience/kmath/domains/Domain {
public abstract fun contains (Lspace/kscience/kmath/structures/Buffer;)Z
public abstract fun getDimension ()I
}
+public final class space/kscience/kmath/domains/Domain1DKt {
+ public static final fun getCenter (Lspace/kscience/kmath/domains/Domain1D;)D
+}
+
public abstract interface class space/kscience/kmath/expressions/AutoDiffProcessor {
- public abstract fun process (Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/DifferentiableExpression;
+ public abstract fun differentiate (Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/DifferentiableExpression;
}
public class space/kscience/kmath/expressions/AutoDiffValue {
@@ -35,6 +47,9 @@ public final class space/kscience/kmath/expressions/DifferentiableExpressionKt {
public static final fun derivative (Lspace/kscience/kmath/expressions/DifferentiableExpression;Ljava/lang/String;)Lspace/kscience/kmath/expressions/Expression;
public static final fun derivative (Lspace/kscience/kmath/expressions/DifferentiableExpression;Ljava/util/List;)Lspace/kscience/kmath/expressions/Expression;
public static final fun derivative (Lspace/kscience/kmath/expressions/DifferentiableExpression;[Lspace/kscience/kmath/expressions/Symbol;)Lspace/kscience/kmath/expressions/Expression;
+ public static final fun derivative (Lspace/kscience/kmath/expressions/SpecialDifferentiableExpression;Ljava/lang/String;)Lspace/kscience/kmath/expressions/Expression;
+ public static final fun derivative (Lspace/kscience/kmath/expressions/SpecialDifferentiableExpression;Ljava/util/List;)Lspace/kscience/kmath/expressions/Expression;
+ public static final fun derivative (Lspace/kscience/kmath/expressions/SpecialDifferentiableExpression;[Lspace/kscience/kmath/expressions/Symbol;)Lspace/kscience/kmath/expressions/Expression;
}
public abstract interface class space/kscience/kmath/expressions/Expression {
@@ -46,9 +61,9 @@ public abstract interface class space/kscience/kmath/expressions/ExpressionAlgeb
}
public final class space/kscience/kmath/expressions/ExpressionKt {
- public static final fun binding (Lspace/kscience/kmath/expressions/ExpressionAlgebra;)Lkotlin/properties/ReadOnlyProperty;
public static final fun callByString (Lspace/kscience/kmath/expressions/Expression;[Lkotlin/Pair;)Ljava/lang/Object;
public static final fun callBySymbol (Lspace/kscience/kmath/expressions/Expression;[Lkotlin/Pair;)Ljava/lang/Object;
+ public static final fun getBinding (Lspace/kscience/kmath/expressions/ExpressionAlgebra;)Lkotlin/properties/ReadOnlyProperty;
public static final fun invoke (Lspace/kscience/kmath/expressions/Expression;)Ljava/lang/Object;
}
@@ -70,10 +85,11 @@ public abstract class space/kscience/kmath/expressions/FunctionalExpressionAlgeb
}
public final class space/kscience/kmath/expressions/FunctionalExpressionAlgebraKt {
+ public static final fun expression (Lspace/kscience/kmath/operations/DoubleField;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression;
public static final fun expressionInExtendedField (Lspace/kscience/kmath/operations/ExtendedField;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression;
public static final fun expressionInField (Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression;
+ public static final fun expressionInGroup (Lspace/kscience/kmath/operations/Group;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression;
public static final fun expressionInRing (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression;
- public static final fun expressionInSpace (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression;
}
public class space/kscience/kmath/expressions/FunctionalExpressionExtendedField : space/kscience/kmath/expressions/FunctionalExpressionField, space/kscience/kmath/operations/ExtendedField {
@@ -85,8 +101,6 @@ public class space/kscience/kmath/expressions/FunctionalExpressionExtendedField
public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object;
public fun atan (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression;
public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2;
- public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object;
- public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/expressions/Expression;
public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object;
public fun cos (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression;
public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object;
@@ -189,7 +203,6 @@ public final class space/kscience/kmath/expressions/MST$Unary : space/kscience/k
}
public final class space/kscience/kmath/expressions/MSTKt {
- public static final fun evaluate (Lspace/kscience/kmath/operations/Algebra;Lspace/kscience/kmath/expressions/MST;)Ljava/lang/Object;
public static final fun interpret (Lspace/kscience/kmath/expressions/MST;Lspace/kscience/kmath/operations/Algebra;Ljava/util/Map;)Ljava/lang/Object;
public static final fun interpret (Lspace/kscience/kmath/expressions/MST;Lspace/kscience/kmath/operations/Algebra;[Lkotlin/Pair;)Ljava/lang/Object;
public static final fun toExpression (Lspace/kscience/kmath/expressions/MST;Lspace/kscience/kmath/operations/Algebra;)Lspace/kscience/kmath/expressions/Expression;
@@ -255,7 +268,7 @@ public final class space/kscience/kmath/expressions/MstExtendedField : space/ksc
public fun unaryPlus (Lspace/kscience/kmath/expressions/MST;)Lspace/kscience/kmath/expressions/MST$Unary;
}
-public final class space/kscience/kmath/expressions/MstField : space/kscience/kmath/operations/Field, space/kscience/kmath/operations/NumbersAddOperations, space/kscience/kmath/operations/ScaleOperations {
+public final class space/kscience/kmath/expressions/MstField : space/kscience/kmath/operations/Field, space/kscience/kmath/operations/NumbersAddOps, space/kscience/kmath/operations/ScaleOperations {
public static final field INSTANCE Lspace/kscience/kmath/expressions/MstField;
public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
public fun add (Lspace/kscience/kmath/expressions/MST;Lspace/kscience/kmath/expressions/MST;)Lspace/kscience/kmath/expressions/MST$Binary;
@@ -317,7 +330,7 @@ public final class space/kscience/kmath/expressions/MstNumericAlgebra : space/ks
public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1;
}
-public final class space/kscience/kmath/expressions/MstRing : space/kscience/kmath/operations/NumbersAddOperations, space/kscience/kmath/operations/Ring, space/kscience/kmath/operations/ScaleOperations {
+public final class space/kscience/kmath/expressions/MstRing : space/kscience/kmath/operations/NumbersAddOps, space/kscience/kmath/operations/Ring, space/kscience/kmath/operations/ScaleOperations {
public static final field INSTANCE Lspace/kscience/kmath/expressions/MstRing;
public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
public fun add (Lspace/kscience/kmath/expressions/MST;Lspace/kscience/kmath/expressions/MST;)Lspace/kscience/kmath/expressions/MST$Binary;
@@ -365,8 +378,6 @@ public final class space/kscience/kmath/expressions/SimpleAutoDiffExtendedField
public fun atan (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue;
public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object;
public fun atanh (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue;
- public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object;
- public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/expressions/AutoDiffValue;
public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object;
public fun cos (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue;
public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object;
@@ -395,7 +406,7 @@ public final class space/kscience/kmath/expressions/SimpleAutoDiffExtendedField
public fun tanh (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue;
}
-public class space/kscience/kmath/expressions/SimpleAutoDiffField : space/kscience/kmath/expressions/ExpressionAlgebra, space/kscience/kmath/operations/Field, space/kscience/kmath/operations/NumbersAddOperations {
+public class space/kscience/kmath/expressions/SimpleAutoDiffField : space/kscience/kmath/expressions/ExpressionAlgebra, space/kscience/kmath/operations/Field, space/kscience/kmath/operations/NumbersAddOps {
public fun (Lspace/kscience/kmath/operations/Field;Ljava/util/Map;)V
public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
public fun add (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue;
@@ -403,7 +414,6 @@ public class space/kscience/kmath/expressions/SimpleAutoDiffField : space/kscien
public fun bindSymbolOrNull (Ljava/lang/String;)Lspace/kscience/kmath/expressions/AutoDiffValue;
public synthetic fun const (Ljava/lang/Object;)Ljava/lang/Object;
public fun const (Ljava/lang/Object;)Lspace/kscience/kmath/expressions/AutoDiffValue;
- public final fun const (Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/AutoDiffValue;
public final fun derive (Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object;
public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
public fun divide (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue;
@@ -431,6 +441,7 @@ public final class space/kscience/kmath/expressions/SimpleAutoDiffKt {
public static final fun asinh (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue;
public static final fun atan (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue;
public static final fun atanh (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue;
+ public static final fun const (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/AutoDiffValue;
public static final fun cos (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue;
public static final fun cosh (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue;
public static final fun exp (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue;
@@ -450,18 +461,13 @@ public final class space/kscience/kmath/expressions/SimpleAutoDiffKt {
public static final fun tanh (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue;
}
-public final class space/kscience/kmath/expressions/StringSymbol : space/kscience/kmath/expressions/Symbol {
- public static final synthetic fun box-impl (Ljava/lang/String;)Lspace/kscience/kmath/expressions/StringSymbol;
- public static fun constructor-impl (Ljava/lang/String;)Ljava/lang/String;
- public fun equals (Ljava/lang/Object;)Z
- public static fun equals-impl (Ljava/lang/String;Ljava/lang/Object;)Z
- public static final fun equals-impl0 (Ljava/lang/String;Ljava/lang/String;)Z
- public fun getIdentity ()Ljava/lang/String;
- public fun hashCode ()I
- public static fun hashCode-impl (Ljava/lang/String;)I
- public fun toString ()Ljava/lang/String;
- public static fun toString-impl (Ljava/lang/String;)Ljava/lang/String;
- public final synthetic fun unbox-impl ()Ljava/lang/String;
+public abstract interface class space/kscience/kmath/expressions/SpecialDifferentiableExpression : space/kscience/kmath/expressions/DifferentiableExpression {
+ public abstract fun derivativeOrNull (Ljava/util/List;)Lspace/kscience/kmath/expressions/Expression;
+}
+
+public final class space/kscience/kmath/expressions/SpecialExpressionsKt {
+ public static final fun chiSquaredExpression (Lspace/kscience/kmath/expressions/AutoDiffProcessor;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/expressions/DifferentiableExpression;
+ public static final fun genericChiSquaredExpression (Lspace/kscience/kmath/expressions/AutoDiffProcessor;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/expressions/DifferentiableExpression;
}
public abstract interface class space/kscience/kmath/expressions/Symbol : space/kscience/kmath/expressions/MST {
@@ -470,15 +476,19 @@ public abstract interface class space/kscience/kmath/expressions/Symbol : space/
}
public final class space/kscience/kmath/expressions/Symbol$Companion {
- public final fun getX-uKgCeAI ()Ljava/lang/String;
- public final fun getY-uKgCeAI ()Ljava/lang/String;
- public final fun getZ-uKgCeAI ()Ljava/lang/String;
+ public final fun getX ()Lspace/kscience/kmath/expressions/Symbol;
+ public final fun getXError ()Lspace/kscience/kmath/expressions/Symbol;
+ public final fun getY ()Lspace/kscience/kmath/expressions/Symbol;
+ public final fun getYError ()Lspace/kscience/kmath/expressions/Symbol;
+ public final fun getZ ()Lspace/kscience/kmath/expressions/Symbol;
+ public final fun getZError ()Lspace/kscience/kmath/expressions/Symbol;
}
public final class space/kscience/kmath/expressions/SymbolIndexerKt {
}
public final class space/kscience/kmath/expressions/SymbolKt {
+ public static final fun Symbol (Ljava/lang/String;)Lspace/kscience/kmath/expressions/Symbol;
public static final fun get (Ljava/util/Map;Ljava/lang/String;)Ljava/lang/Object;
public static final fun get (Ljava/util/Map;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object;
public static final fun getSymbol ()Lkotlin/properties/ReadOnlyProperty;
@@ -487,7 +497,7 @@ public final class space/kscience/kmath/expressions/SymbolKt {
}
public final class space/kscience/kmath/linear/BufferedLinearSpace : space/kscience/kmath/linear/LinearSpace {
- public fun (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)V
+ public fun (Lspace/kscience/kmath/operations/BufferAlgebra;)V
public fun buildMatrix (IILkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/Structure2D;
public fun buildVector (ILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer;
public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D;
@@ -499,6 +509,10 @@ public final class space/kscience/kmath/linear/BufferedLinearSpace : space/kscie
public fun unaryMinus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D;
}
+public final class space/kscience/kmath/linear/BufferedLinearSpaceKt {
+ public static final fun linearSpace (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/BufferedLinearSpace;
+}
+
public abstract interface class space/kscience/kmath/linear/CholeskyDecompositionFeature : space/kscience/kmath/linear/MatrixFeature {
public abstract fun getL ()Lspace/kscience/kmath/nd/Structure2D;
}
@@ -514,6 +528,36 @@ public abstract interface class space/kscience/kmath/linear/DiagonalFeature : sp
public final class space/kscience/kmath/linear/DiagonalFeature$Companion : space/kscience/kmath/linear/DiagonalFeature {
}
+public final class space/kscience/kmath/linear/DoubleLinearSpace : space/kscience/kmath/linear/LinearSpace {
+ public static final field INSTANCE Lspace/kscience/kmath/linear/DoubleLinearSpace;
+ public fun buildMatrix (IILkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/Structure2D;
+ public synthetic fun buildVector (ILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer;
+ public fun buildVector-CZ9oacQ (ILkotlin/jvm/functions/Function2;)[D
+ public final fun div-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;D)[D
+ public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D;
+ public synthetic fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
+ public fun dot-CZ9oacQ (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)[D
+ public fun getElementAlgebra ()Lspace/kscience/kmath/operations/DoubleField;
+ public synthetic fun getElementAlgebra ()Lspace/kscience/kmath/operations/Ring;
+ public fun minus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D;
+ public synthetic fun minus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
+ public fun minus-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D
+ public fun plus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D;
+ public synthetic fun plus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
+ public fun plus-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D
+ public synthetic fun times (Ljava/lang/Object;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
+ public fun times (Lspace/kscience/kmath/nd/Structure2D;D)Lspace/kscience/kmath/nd/Structure2D;
+ public synthetic fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D;
+ public synthetic fun times (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Object;)Lspace/kscience/kmath/structures/Buffer;
+ public fun times-CZ9oacQ (DLspace/kscience/kmath/structures/Buffer;)[D
+ public fun times-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;D)[D
+ public fun unaryMinus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D;
+}
+
+public final class space/kscience/kmath/linear/DoubleLinearSpaceKt {
+ public static final fun getLinearSpace (Lspace/kscience/kmath/operations/DoubleField;)Lspace/kscience/kmath/linear/DoubleLinearSpace;
+}
+
public abstract interface class space/kscience/kmath/linear/InverseMatrixFeature : space/kscience/kmath/linear/MatrixFeature {
public abstract fun getInverse ()Lspace/kscience/kmath/nd/Structure2D;
}
@@ -533,11 +577,6 @@ public abstract interface class space/kscience/kmath/linear/LinearSolver {
public fun solve (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
}
-public final class space/kscience/kmath/linear/LinearSolverKt {
- public static final fun asMatrix (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/linear/VirtualMatrix;
- public static final fun asVector (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/structures/Buffer;
-}
-
public abstract interface class space/kscience/kmath/linear/LinearSpace {
public static final field Companion Lspace/kscience/kmath/linear/LinearSpace$Companion;
public abstract fun buildMatrix (IILkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/Structure2D;
@@ -560,10 +599,12 @@ public abstract interface class space/kscience/kmath/linear/LinearSpace {
public final class space/kscience/kmath/linear/LinearSpace$Companion {
public final fun buffered (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/LinearSpace;
public static synthetic fun buffered$default (Lspace/kscience/kmath/linear/LinearSpace$Companion;Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lspace/kscience/kmath/linear/LinearSpace;
- public final fun getReal ()Lspace/kscience/kmath/linear/LinearSpace;
+ public final fun getDouble ()Lspace/kscience/kmath/linear/LinearSpace;
}
public final class space/kscience/kmath/linear/LinearSpaceKt {
+ public static final fun asMatrix (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/linear/VirtualMatrix;
+ public static final fun asVector (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/structures/Buffer;
public static final fun invoke (Lspace/kscience/kmath/linear/LinearSpace;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
}
@@ -587,11 +628,12 @@ public abstract interface class space/kscience/kmath/linear/LupDecompositionFeat
public final class space/kscience/kmath/linear/LupDecompositionKt {
public static final fun abs (Lspace/kscience/kmath/linear/LinearSpace;Ljava/lang/Comparable;)Ljava/lang/Comparable;
- public static final fun inverseWithLup (Lspace/kscience/kmath/linear/LinearSpace;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D;
public static final fun lup (Lspace/kscience/kmath/linear/LinearSpace;Lkotlin/jvm/functions/Function2;Lspace/kscience/kmath/nd/Structure2D;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/linear/LupDecomposition;
- public static final fun lup (Lspace/kscience/kmath/linear/LinearSpace;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/LupDecomposition;
- public static final fun solveWithLup (Lspace/kscience/kmath/linear/LinearSpace;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D;
- public static final fun solveWithLup (Lspace/kscience/kmath/linear/LupDecomposition;Lkotlin/jvm/functions/Function2;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D;
+ public static final fun lup (Lspace/kscience/kmath/linear/LinearSpace;Lspace/kscience/kmath/nd/Structure2D;D)Lspace/kscience/kmath/linear/LupDecomposition;
+ public static synthetic fun lup$default (Lspace/kscience/kmath/linear/LinearSpace;Lspace/kscience/kmath/nd/Structure2D;DILjava/lang/Object;)Lspace/kscience/kmath/linear/LupDecomposition;
+ public static final fun lupSolver (Lspace/kscience/kmath/linear/LinearSpace;D)Lspace/kscience/kmath/linear/LinearSolver;
+ public static final fun lupSolver (Lspace/kscience/kmath/linear/LinearSpace;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/linear/LinearSolver;
+ public static synthetic fun lupSolver$default (Lspace/kscience/kmath/linear/LinearSpace;DILjava/lang/Object;)Lspace/kscience/kmath/linear/LinearSolver;
}
public final class space/kscience/kmath/linear/MatrixBuilder {
@@ -607,6 +649,7 @@ public final class space/kscience/kmath/linear/MatrixBuilderKt {
public static final fun column (Lspace/kscience/kmath/linear/LinearSpace;[Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D;
public static final fun row (Lspace/kscience/kmath/linear/LinearSpace;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/Structure2D;
public static final fun row (Lspace/kscience/kmath/linear/LinearSpace;[Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D;
+ public static final fun symmetric (Lspace/kscience/kmath/linear/MatrixBuilder;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/Structure2D;
}
public abstract interface class space/kscience/kmath/linear/MatrixFeature : space/kscience/kmath/nd/StructureFeature {
@@ -623,7 +666,10 @@ public final class space/kscience/kmath/linear/MatrixWrapper : space/kscience/km
public fun getColNum ()I
public fun getColumns ()Ljava/util/List;
public fun getDimension ()I
- public final fun getFeatures ()Ljava/util/Set;
+ public synthetic fun getFeature (Lkotlin/reflect/KClass;)Ljava/lang/Object;
+ public fun getFeature (Lkotlin/reflect/KClass;)Lspace/kscience/kmath/nd/StructureFeature;
+ public final fun getFeatures-En6fw3w ()Ljava/util/Map;
+ public fun getIndices ()Lspace/kscience/kmath/nd/ShapeIndexer;
public final fun getOrigin ()Lspace/kscience/kmath/nd/Structure2D;
public fun getRowNum ()I
public fun getRows ()Ljava/util/List;
@@ -634,9 +680,10 @@ public final class space/kscience/kmath/linear/MatrixWrapper : space/kscience/km
public final class space/kscience/kmath/linear/MatrixWrapperKt {
public static final fun getOrigin (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D;
public static final fun one (Lspace/kscience/kmath/linear/LinearSpace;II)Lspace/kscience/kmath/nd/Structure2D;
- public static final fun plus (Lspace/kscience/kmath/nd/Structure2D;Ljava/util/Collection;)Lspace/kscience/kmath/linear/MatrixWrapper;
public static final fun plus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/linear/MatrixFeature;)Lspace/kscience/kmath/linear/MatrixWrapper;
public static final fun transpose (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D;
+ public static final fun withFeature (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/linear/MatrixFeature;)Lspace/kscience/kmath/linear/MatrixWrapper;
+ public static final fun withFeatures (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Iterable;)Lspace/kscience/kmath/linear/MatrixWrapper;
public static final fun zero (Lspace/kscience/kmath/linear/LinearSpace;II)Lspace/kscience/kmath/nd/Structure2D;
}
@@ -656,6 +703,10 @@ public abstract interface class space/kscience/kmath/linear/SingularValueDecompo
public abstract fun getV ()Lspace/kscience/kmath/nd/Structure2D;
}
+public final class space/kscience/kmath/linear/SymmetricMatrixFeature : space/kscience/kmath/linear/MatrixFeature {
+ public static final field INSTANCE Lspace/kscience/kmath/linear/SymmetricMatrixFeature;
+}
+
public final class space/kscience/kmath/linear/TransposedFeature : space/kscience/kmath/linear/MatrixFeature {
public fun (Lspace/kscience/kmath/nd/Structure2D;)V
public final fun getOriginal ()Lspace/kscience/kmath/nd/Structure2D;
@@ -678,6 +729,10 @@ public final class space/kscience/kmath/linear/VirtualMatrix : space/kscience/km
public fun getShape ()[I
}
+public final class space/kscience/kmath/linear/VirtualMatrixKt {
+ public static final fun virtual (Lspace/kscience/kmath/linear/MatrixBuilder;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/VirtualMatrix;
+}
+
public final class space/kscience/kmath/linear/ZeroFeature : space/kscience/kmath/linear/DiagonalFeature {
public static final field INSTANCE Lspace/kscience/kmath/linear/ZeroFeature;
}
@@ -701,82 +756,164 @@ public final class space/kscience/kmath/misc/CumulativeKt {
public static final fun cumulativeSumOfLong (Lkotlin/sequences/Sequence;)Lkotlin/sequences/Sequence;
}
+public abstract interface class space/kscience/kmath/misc/Feature {
+ public fun getKey ()Lkotlin/reflect/KClass;
+}
+
+public final class space/kscience/kmath/misc/FeatureSet : space/kscience/kmath/misc/Featured {
+ public static final field Companion Lspace/kscience/kmath/misc/FeatureSet$Companion;
+ public static final synthetic fun box-impl (Ljava/util/Map;)Lspace/kscience/kmath/misc/FeatureSet;
+ public fun equals (Ljava/lang/Object;)Z
+ public static fun equals-impl (Ljava/util/Map;Ljava/lang/Object;)Z
+ public static final fun equals-impl0 (Ljava/util/Map;Ljava/util/Map;)Z
+ public synthetic fun getFeature (Lkotlin/reflect/KClass;)Ljava/lang/Object;
+ public fun getFeature (Lkotlin/reflect/KClass;)Lspace/kscience/kmath/misc/Feature;
+ public static fun getFeature-impl (Ljava/util/Map;Lkotlin/reflect/KClass;)Lspace/kscience/kmath/misc/Feature;
+ public final fun getFeatures ()Ljava/util/Map;
+ public fun hashCode ()I
+ public static fun hashCode-impl (Ljava/util/Map;)I
+ public static final fun iterator-impl (Ljava/util/Map;)Ljava/util/Iterator;
+ public fun toString ()Ljava/lang/String;
+ public static fun toString-impl (Ljava/util/Map;)Ljava/lang/String;
+ public final synthetic fun unbox-impl ()Ljava/util/Map;
+ public static final fun with-JVE9-Rk (Ljava/util/Map;Ljava/lang/Iterable;)Ljava/util/Map;
+ public static final fun with-JVE9-Rk (Ljava/util/Map;[Lspace/kscience/kmath/misc/Feature;)Ljava/util/Map;
+ public static final fun with-YU1a0hQ (Ljava/util/Map;Ljava/util/Map;)Ljava/util/Map;
+ public static final fun with-h58Sd8I (Ljava/util/Map;Lspace/kscience/kmath/misc/Feature;Lkotlin/reflect/KClass;)Ljava/util/Map;
+ public static synthetic fun with-h58Sd8I$default (Ljava/util/Map;Lspace/kscience/kmath/misc/Feature;Lkotlin/reflect/KClass;ILjava/lang/Object;)Ljava/util/Map;
+}
+
+public final class space/kscience/kmath/misc/FeatureSet$Companion {
+ public final fun of-JVE9-Rk (Ljava/lang/Iterable;)Ljava/util/Map;
+ public final fun of-JVE9-Rk ([Lspace/kscience/kmath/misc/Feature;)Ljava/util/Map;
+}
+
+public abstract interface class space/kscience/kmath/misc/Featured {
+ public abstract fun getFeature (Lkotlin/reflect/KClass;)Ljava/lang/Object;
+}
+
+public abstract interface class space/kscience/kmath/misc/Loggable {
+ public static final field Companion Lspace/kscience/kmath/misc/Loggable$Companion;
+ public static final field INFO Ljava/lang/String;
+ public abstract fun log (Ljava/lang/String;Lkotlin/jvm/functions/Function0;)V
+}
+
+public final class space/kscience/kmath/misc/Loggable$Companion {
+ public static final field INFO Ljava/lang/String;
+ public final fun getConsole ()Lspace/kscience/kmath/misc/Loggable;
+}
+
+public final class space/kscience/kmath/misc/LoggingKt {
+ public static final fun log (Lspace/kscience/kmath/misc/Loggable;Lkotlin/jvm/functions/Function0;)V
+}
+
+public final class space/kscience/kmath/misc/NumbersJVMKt {
+ public static final fun toIntExact (J)I
+}
+
public abstract interface annotation class space/kscience/kmath/misc/PerformancePitfall : java/lang/annotation/Annotation {
+ public abstract fun message ()Ljava/lang/String;
+}
+
+public final class space/kscience/kmath/misc/SortingKt {
+ public static final fun requireSorted (Lspace/kscience/kmath/structures/Buffer;)V
+ public static final fun sorted (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
+ public static final fun sortedBy (Lspace/kscience/kmath/structures/Buffer;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer;
+ public static final fun sortedByDescending (Lspace/kscience/kmath/structures/Buffer;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer;
+ public static final fun sortedDescending (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
}
public abstract interface annotation class space/kscience/kmath/misc/UnstableKMathAPI : java/lang/annotation/Annotation {
}
-public abstract interface class space/kscience/kmath/nd/AlgebraND {
+public abstract interface class space/kscience/kmath/nd/AlgebraND : space/kscience/kmath/operations/Algebra {
public static final field Companion Lspace/kscience/kmath/nd/AlgebraND$Companion;
- public abstract fun combine (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND;
- public abstract fun getElementContext ()Lspace/kscience/kmath/operations/Algebra;
- public abstract fun getShape ()[I
+ public abstract fun getElementAlgebra ()Lspace/kscience/kmath/operations/Algebra;
public fun invoke (Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND;
- public abstract fun map (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND;
- public abstract fun mapIndexed (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND;
- public abstract fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND;
+ public fun map (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND;
+ public fun mapIndexed (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND;
+ public abstract fun structureND ([ILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND;
+ public fun zip (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND;
}
public final class space/kscience/kmath/nd/AlgebraND$Companion {
}
+public final class space/kscience/kmath/nd/AlgebraNDExtentionsKt {
+ public static final fun one (Lspace/kscience/kmath/nd/AlgebraND;[I)Lspace/kscience/kmath/nd/StructureND;
+ public static final fun oneVarArg (Lspace/kscience/kmath/nd/AlgebraND;I[I)Lspace/kscience/kmath/nd/StructureND;
+ public static final fun structureND (Lspace/kscience/kmath/nd/AlgebraND;I[ILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND;
+ public static final fun zero (Lspace/kscience/kmath/nd/AlgebraND;[I)Lspace/kscience/kmath/nd/StructureND;
+ public static final fun zeroVarArg (Lspace/kscience/kmath/nd/AlgebraND;I[I)Lspace/kscience/kmath/nd/StructureND;
+}
+
+public final class space/kscience/kmath/nd/AlgebraNDKt {
+ public static final fun Shape (I[I)[I
+}
+
public abstract interface class space/kscience/kmath/nd/BufferAlgebraND : space/kscience/kmath/nd/AlgebraND {
- public fun combine (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/BufferND;
- public synthetic fun combine (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND;
- public fun getBuffer (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/structures/Buffer;
- public abstract fun getBufferFactory ()Lkotlin/jvm/functions/Function2;
- public abstract fun getStrides ()Lspace/kscience/kmath/nd/Strides;
+ public static final field Companion Lspace/kscience/kmath/nd/BufferAlgebraND$Companion;
+ public abstract fun getBufferAlgebra ()Lspace/kscience/kmath/operations/BufferAlgebra;
+ public fun getElementAlgebra ()Lspace/kscience/kmath/operations/Algebra;
+ public abstract fun getIndexerBuilder ()Lkotlin/jvm/functions/Function1;
public fun map (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/BufferND;
public synthetic fun map (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND;
public fun mapIndexed (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/BufferND;
public synthetic fun mapIndexed (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND;
- public fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/BufferND;
- public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND;
+ public fun structureND ([ILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/BufferND;
+ public synthetic fun structureND ([ILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND;
+ public fun toBufferND (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND;
+ public fun zip (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/BufferND;
+ public synthetic fun zip (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND;
+}
+
+public final class space/kscience/kmath/nd/BufferAlgebraND$Companion {
+ public final fun getDefaultIndexerBuilder ()Lkotlin/jvm/functions/Function1;
}
public final class space/kscience/kmath/nd/BufferAlgebraNDKt {
- public static final fun field (Lspace/kscience/kmath/nd/AlgebraND$Companion;Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedFieldND;
- public static final fun group (Lspace/kscience/kmath/nd/AlgebraND$Companion;Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedGroupND;
- public static final fun ndField (Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object;
- public static final fun ndGroup (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object;
- public static final fun ndRing (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object;
- public static final fun ring (Lspace/kscience/kmath/nd/AlgebraND$Companion;Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedRingND;
+ public static final fun getNd (Lspace/kscience/kmath/operations/BufferAlgebra;)Lspace/kscience/kmath/nd/BufferedFieldOpsND;
+ public static final fun getNd (Lspace/kscience/kmath/operations/BufferAlgebra;)Lspace/kscience/kmath/nd/BufferedGroupNDOps;
+ public static final fun getNd (Lspace/kscience/kmath/operations/BufferAlgebra;)Lspace/kscience/kmath/nd/BufferedRingOpsND;
+ public static final fun mapInline (Lspace/kscience/kmath/nd/BufferAlgebraND;Lspace/kscience/kmath/nd/BufferND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/BufferND;
+ public static final fun structureND (Lspace/kscience/kmath/nd/BufferAlgebraND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/BufferND;
+ public static final fun structureND (Lspace/kscience/kmath/nd/BufferAlgebraND;[ILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/BufferND;
}
public class space/kscience/kmath/nd/BufferND : space/kscience/kmath/nd/StructureND {
- public fun (Lspace/kscience/kmath/nd/Strides;Lspace/kscience/kmath/structures/Buffer;)V
- public fun elements ()Lkotlin/sequences/Sequence;
+ public fun (Lspace/kscience/kmath/nd/ShapeIndexer;Lspace/kscience/kmath/structures/Buffer;)V
public fun get ([I)Ljava/lang/Object;
- public final fun getBuffer ()Lspace/kscience/kmath/structures/Buffer;
+ public fun getBuffer ()Lspace/kscience/kmath/structures/Buffer;
+ public fun getIndices ()Lspace/kscience/kmath/nd/ShapeIndexer;
public fun getShape ()[I
- public final fun getStrides ()Lspace/kscience/kmath/nd/Strides;
public fun toString ()Ljava/lang/String;
}
-public class space/kscience/kmath/nd/BufferedFieldND : space/kscience/kmath/nd/BufferedRingND, space/kscience/kmath/nd/FieldND {
- public fun ([ILspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;)V
+public final class space/kscience/kmath/nd/BufferNDKt {
+ public static final fun mapToBuffer (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/BufferND;
+}
+
+public class space/kscience/kmath/nd/BufferedFieldOpsND : space/kscience/kmath/nd/BufferedRingOpsND, space/kscience/kmath/nd/FieldOpsND {
+ public fun (Lspace/kscience/kmath/operations/BufferAlgebra;Lkotlin/jvm/functions/Function1;)V
+ public synthetic fun (Lspace/kscience/kmath/operations/BufferAlgebra;Lkotlin/jvm/functions/Function1;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
+ public fun (Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)V
+ public synthetic fun (Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object;
public fun scale (Lspace/kscience/kmath/nd/StructureND;D)Lspace/kscience/kmath/nd/StructureND;
}
-public class space/kscience/kmath/nd/BufferedGroupND : space/kscience/kmath/nd/BufferAlgebraND, space/kscience/kmath/nd/GroupND {
- public fun ([ILspace/kscience/kmath/operations/Group;Lkotlin/jvm/functions/Function2;)V
- public final fun getBufferFactory ()Lkotlin/jvm/functions/Function2;
- public synthetic fun getElementContext ()Lspace/kscience/kmath/operations/Algebra;
- public final fun getElementContext ()Lspace/kscience/kmath/operations/Group;
- public final fun getShape ()[I
- public fun getStrides ()Lspace/kscience/kmath/nd/Strides;
- public synthetic fun getZero ()Ljava/lang/Object;
- public fun getZero ()Lspace/kscience/kmath/nd/BufferND;
+public class space/kscience/kmath/nd/BufferedGroupNDOps : space/kscience/kmath/nd/BufferAlgebraND, space/kscience/kmath/nd/GroupOpsND {
+ public fun (Lspace/kscience/kmath/operations/BufferAlgebra;Lkotlin/jvm/functions/Function1;)V
+ public synthetic fun (Lspace/kscience/kmath/operations/BufferAlgebra;Lkotlin/jvm/functions/Function1;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
+ public fun getBufferAlgebra ()Lspace/kscience/kmath/operations/BufferAlgebra;
+ public fun getIndexerBuilder ()Lkotlin/jvm/functions/Function1;
public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object;
public fun unaryMinus (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND;
}
-public class space/kscience/kmath/nd/BufferedRingND : space/kscience/kmath/nd/BufferedGroupND, space/kscience/kmath/nd/RingND {
- public fun ([ILspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)V
- public synthetic fun getOne ()Ljava/lang/Object;
- public fun getOne ()Lspace/kscience/kmath/nd/BufferND;
+public class space/kscience/kmath/nd/BufferedRingOpsND : space/kscience/kmath/nd/BufferedGroupNDOps, space/kscience/kmath/nd/RingOpsND {
+ public fun (Lspace/kscience/kmath/operations/BufferAlgebra;Lkotlin/jvm/functions/Function1;)V
+ public synthetic fun (Lspace/kscience/kmath/operations/BufferAlgebra;Lkotlin/jvm/functions/Function1;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
}
public final class space/kscience/kmath/nd/DefaultStrides : space/kscience/kmath/nd/Strides {
@@ -794,72 +931,151 @@ public final class space/kscience/kmath/nd/DefaultStrides$Companion {
public final fun invoke ([I)Lspace/kscience/kmath/nd/Strides;
}
-public final class space/kscience/kmath/nd/DoubleFieldND : space/kscience/kmath/nd/BufferedFieldND, space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/NumbersAddOperations, space/kscience/kmath/operations/ScaleOperations {
+public final class space/kscience/kmath/nd/DoubleBufferND : space/kscience/kmath/nd/BufferND {
+ public synthetic fun (Lspace/kscience/kmath/nd/ShapeIndexer;[DLkotlin/jvm/internal/DefaultConstructorMarker;)V
+ public synthetic fun getBuffer ()Lspace/kscience/kmath/structures/Buffer;
+ public fun getBuffer-Dv3HvWU ()[D
+}
+
+public final class space/kscience/kmath/nd/DoubleFieldND : space/kscience/kmath/nd/DoubleFieldOpsND, space/kscience/kmath/nd/FieldND, space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/NumbersAddOps {
public fun ([I)V
- public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object;
- public fun acos (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND;
public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object;
- public fun acosh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND;
- public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object;
- public fun asin (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND;
+ public fun acosh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object;
- public fun asinh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND;
- public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object;
- public fun atan (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND;
+ public fun asinh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object;
- public fun atanh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND;
- public fun combine (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/BufferND;
- public synthetic fun combine (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND;
- public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object;
- public fun cos (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND;
+ public fun atanh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object;
- public fun cosh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND;
- public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object;
- public fun exp (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND;
- public synthetic fun getBuffer (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/structures/Buffer;
- public fun getBuffer-Udx-57Q (Lspace/kscience/kmath/nd/StructureND;)[D
- public synthetic fun getOne ()Ljava/lang/Object;
- public fun getOne ()Lspace/kscience/kmath/nd/BufferND;
- public synthetic fun getZero ()Ljava/lang/Object;
- public fun getZero ()Lspace/kscience/kmath/nd/BufferND;
- public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object;
- public fun ln (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND;
- public fun map (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/BufferND;
- public synthetic fun map (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND;
- public fun mapIndexed (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/BufferND;
- public synthetic fun mapIndexed (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND;
+ public fun cosh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public fun getShape ()[I
public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object;
- public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/nd/BufferND;
+ public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun power (Ljava/lang/Object;I)Ljava/lang/Object;
public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object;
- public fun power (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/BufferND;
- public fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/BufferND;
- public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND;
- public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object;
- public fun scale (Lspace/kscience/kmath/nd/StructureND;D)Lspace/kscience/kmath/nd/StructureND;
- public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object;
- public fun sin (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND;
+ public fun power (Lspace/kscience/kmath/nd/StructureND;I)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public fun power (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun power-Qn1smSk (Ljava/lang/Object;I)Ljava/lang/Object;
+ public fun power-Qn1smSk (Lspace/kscience/kmath/nd/StructureND;I)Lspace/kscience/kmath/nd/DoubleBufferND;
public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object;
- public fun sinh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND;
- public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object;
- public fun tan (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND;
+ public fun sinh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object;
- public fun tanh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND;
+ public fun tanh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
}
public final class space/kscience/kmath/nd/DoubleFieldNDKt {
- public static final fun nd (Lspace/kscience/kmath/operations/DoubleField;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object;
- public static final fun real (Lspace/kscience/kmath/nd/AlgebraND$Companion;[I)Lspace/kscience/kmath/nd/DoubleFieldND;
+ public static final fun getNdAlgebra (Lspace/kscience/kmath/operations/DoubleField;)Lspace/kscience/kmath/nd/DoubleFieldOpsND;
+ public static final fun ndAlgebra (Lspace/kscience/kmath/operations/DoubleField;[I)Lspace/kscience/kmath/nd/DoubleFieldND;
}
-public abstract interface class space/kscience/kmath/nd/FieldND : space/kscience/kmath/nd/RingND, space/kscience/kmath/operations/Field, space/kscience/kmath/operations/ScaleOperations {
+public abstract class space/kscience/kmath/nd/DoubleFieldOpsND : space/kscience/kmath/nd/BufferedFieldOpsND, space/kscience/kmath/operations/ExtendedFieldOps, space/kscience/kmath/operations/ScaleOperations {
+ public static final field Companion Lspace/kscience/kmath/nd/DoubleFieldOpsND$Companion;
+ public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun acos (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun acosh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
+ public fun add (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun add (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND;
+ public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun asin (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun asinh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun atan (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun atanh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun cos (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun cosh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public fun div (DLspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object;
+ public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
+ public synthetic fun div (Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND;
+ public fun div (Lspace/kscience/kmath/nd/StructureND;D)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public fun div (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun div (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND;
+ public fun div (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
+ public fun divide (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun divide (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND;
+ public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun exp (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun ln (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public fun map (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/BufferND;
+ public synthetic fun map (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND;
+ protected final fun mapInline (Lspace/kscience/kmath/nd/DoubleBufferND;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public fun minus (DLspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND;
+ public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
+ public synthetic fun minus (Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND;
+ public fun minus (Lspace/kscience/kmath/nd/StructureND;D)Lspace/kscience/kmath/nd/StructureND;
+ public synthetic fun minus (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND;
+ public fun minus (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
+ public fun multiply (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun multiply (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND;
+ public fun plus (DLspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND;
+ public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
+ public synthetic fun plus (Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND;
+ public fun plus (Lspace/kscience/kmath/nd/StructureND;D)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun plus (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND;
+ public fun plus (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object;
+ public fun scale (Lspace/kscience/kmath/nd/StructureND;D)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun scale (Lspace/kscience/kmath/nd/StructureND;D)Lspace/kscience/kmath/nd/StructureND;
+ public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun sin (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun sinh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun structureND ([ILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/BufferND;
+ public fun structureND ([ILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun structureND ([ILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND;
+ public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun tan (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun tanh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object;
+ public fun times (Ljava/lang/Number;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object;
+ public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
+ public fun times (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public fun times (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun toBufferND (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND;
+ public fun toBufferND (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun unaryMinus (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public synthetic fun unaryMinus (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND;
+ public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun unaryPlus (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/DoubleBufferND;
+ public fun zip (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/BufferND;
+ public synthetic fun zip (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND;
+}
+
+public final class space/kscience/kmath/nd/DoubleFieldOpsND$Companion : space/kscience/kmath/nd/DoubleFieldOpsND {
+}
+
+public abstract interface class space/kscience/kmath/nd/FieldND : space/kscience/kmath/nd/FieldOpsND, space/kscience/kmath/nd/RingND, space/kscience/kmath/nd/WithShape, space/kscience/kmath/operations/Field {
+ public synthetic fun getOne ()Ljava/lang/Object;
+ public fun getOne ()Lspace/kscience/kmath/nd/StructureND;
+}
+
+public abstract interface class space/kscience/kmath/nd/FieldOpsND : space/kscience/kmath/nd/RingOpsND, space/kscience/kmath/operations/FieldOps, space/kscience/kmath/operations/ScaleOperations {
public fun div (Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND;
public fun div (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND;
public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
public fun divide (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND;
+ public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object;
+ public fun scale (Lspace/kscience/kmath/nd/StructureND;D)Lspace/kscience/kmath/nd/StructureND;
}
-public abstract interface class space/kscience/kmath/nd/GroupND : space/kscience/kmath/nd/AlgebraND, space/kscience/kmath/operations/Group {
- public static final field Companion Lspace/kscience/kmath/nd/GroupND$Companion;
+public abstract interface class space/kscience/kmath/nd/GroupND : space/kscience/kmath/nd/GroupOpsND, space/kscience/kmath/nd/WithShape, space/kscience/kmath/operations/Group {
+ public synthetic fun getZero ()Ljava/lang/Object;
+ public fun getZero ()Lspace/kscience/kmath/nd/StructureND;
+}
+
+public abstract interface class space/kscience/kmath/nd/GroupOpsND : space/kscience/kmath/nd/AlgebraND, space/kscience/kmath/operations/GroupOps {
+ public static final field Companion Lspace/kscience/kmath/nd/GroupOpsND$Companion;
public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
public fun add (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND;
public fun minus (Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND;
@@ -868,12 +1084,13 @@ public abstract interface class space/kscience/kmath/nd/GroupND : space/kscience
public fun plus (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND;
}
-public final class space/kscience/kmath/nd/GroupND$Companion {
+public final class space/kscience/kmath/nd/GroupOpsND$Companion {
}
public final class space/kscience/kmath/nd/MutableBufferND : space/kscience/kmath/nd/BufferND, space/kscience/kmath/nd/MutableStructureND {
- public fun (Lspace/kscience/kmath/nd/Strides;Lspace/kscience/kmath/structures/MutableBuffer;)V
- public final fun getMutableBuffer ()Lspace/kscience/kmath/structures/MutableBuffer;
+ public fun (Lspace/kscience/kmath/nd/ShapeIndexer;Lspace/kscience/kmath/structures/MutableBuffer;)V
+ public synthetic fun getBuffer ()Lspace/kscience/kmath/structures/Buffer;
+ public fun getBuffer ()Lspace/kscience/kmath/structures/MutableBuffer;
public fun set ([ILjava/lang/Object;)V
}
@@ -891,15 +1108,31 @@ public abstract interface class space/kscience/kmath/nd/MutableStructureND : spa
public abstract fun set ([ILjava/lang/Object;)V
}
-public abstract interface class space/kscience/kmath/nd/RingND : space/kscience/kmath/nd/GroupND, space/kscience/kmath/operations/Ring {
- public static final field Companion Lspace/kscience/kmath/nd/RingND$Companion;
+public abstract interface class space/kscience/kmath/nd/RingND : space/kscience/kmath/nd/GroupND, space/kscience/kmath/nd/RingOpsND, space/kscience/kmath/nd/WithShape, space/kscience/kmath/operations/Ring {
+ public synthetic fun getOne ()Ljava/lang/Object;
+ public fun getOne ()Lspace/kscience/kmath/nd/StructureND;
+}
+
+public abstract interface class space/kscience/kmath/nd/RingOpsND : space/kscience/kmath/nd/GroupOpsND, space/kscience/kmath/operations/RingOps {
+ public static final field Companion Lspace/kscience/kmath/nd/RingOpsND$Companion;
public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
public fun multiply (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND;
public fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND;
public fun times (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND;
}
-public final class space/kscience/kmath/nd/RingND$Companion {
+public final class space/kscience/kmath/nd/RingOpsND$Companion {
+}
+
+public abstract interface class space/kscience/kmath/nd/ShapeIndexer : java/lang/Iterable, kotlin/jvm/internal/markers/KMappedMarker {
+ public abstract fun asSequence ()Lkotlin/sequences/Sequence;
+ public abstract fun equals (Ljava/lang/Object;)Z
+ public abstract fun getLinearSize ()I
+ public abstract fun getShape ()[I
+ public abstract fun hashCode ()I
+ public abstract fun index (I)[I
+ public fun iterator ()Ljava/util/Iterator;
+ public abstract fun offset ([I)I
}
public final class space/kscience/kmath/nd/ShapeMismatchException : java/lang/RuntimeException {
@@ -908,27 +1141,28 @@ public final class space/kscience/kmath/nd/ShapeMismatchException : java/lang/Ru
public final fun getExpected ()[I
}
-public final class space/kscience/kmath/nd/ShortRingND : space/kscience/kmath/nd/BufferedRingND, space/kscience/kmath/operations/NumbersAddOperations {
+public final class space/kscience/kmath/nd/ShortRingND : space/kscience/kmath/nd/ShortRingOpsND, space/kscience/kmath/nd/RingND, space/kscience/kmath/operations/NumbersAddOps {
public fun ([I)V
- public synthetic fun getOne ()Ljava/lang/Object;
- public fun getOne ()Lspace/kscience/kmath/nd/BufferND;
- public synthetic fun getZero ()Ljava/lang/Object;
- public fun getZero ()Lspace/kscience/kmath/nd/BufferND;
+ public fun getShape ()[I
public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object;
public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/nd/BufferND;
}
public final class space/kscience/kmath/nd/ShortRingNDKt {
- public static final fun nd (Lspace/kscience/kmath/operations/ShortRing;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object;
- public static final fun produceInline (Lspace/kscience/kmath/nd/BufferedRingND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/BufferND;
+ public static final fun withNdAlgebra (Lspace/kscience/kmath/operations/ShortRing;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object;
}
-public abstract interface class space/kscience/kmath/nd/Strides {
- public abstract fun getLinearSize ()I
- public abstract fun getShape ()[I
+public abstract class space/kscience/kmath/nd/ShortRingOpsND : space/kscience/kmath/nd/BufferedRingOpsND {
+ public static final field Companion Lspace/kscience/kmath/nd/ShortRingOpsND$Companion;
+}
+
+public final class space/kscience/kmath/nd/ShortRingOpsND$Companion : space/kscience/kmath/nd/ShortRingOpsND {
+}
+
+public abstract class space/kscience/kmath/nd/Strides : space/kscience/kmath/nd/ShapeIndexer {
+ public fun ()V
+ public fun asSequence ()Lkotlin/sequences/Sequence;
public abstract fun getStrides ()[I
- public abstract fun index (I)[I
- public fun indices ()Lkotlin/sequences/Sequence;
public fun offset ([I)I
}
@@ -968,14 +1202,16 @@ public final class space/kscience/kmath/nd/Structure2DKt {
public static final fun as2D (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/Structure2D;
}
-public abstract interface class space/kscience/kmath/nd/StructureFeature {
+public abstract interface class space/kscience/kmath/nd/StructureFeature : space/kscience/kmath/misc/Feature {
}
-public abstract interface class space/kscience/kmath/nd/StructureND {
+public abstract interface class space/kscience/kmath/nd/StructureND : space/kscience/kmath/misc/Featured, space/kscience/kmath/nd/WithShape {
public static final field Companion Lspace/kscience/kmath/nd/StructureND$Companion;
- public abstract fun elements ()Lkotlin/sequences/Sequence;
+ public fun elements ()Lkotlin/sequences/Sequence;
public abstract fun get ([I)Ljava/lang/Object;
public fun getDimension ()I
+ public synthetic fun getFeature (Lkotlin/reflect/KClass;)Ljava/lang/Object;
+ public fun getFeature (Lkotlin/reflect/KClass;)Lspace/kscience/kmath/nd/StructureFeature;
public abstract fun getShape ()[I
}
@@ -987,14 +1223,25 @@ public final class space/kscience/kmath/nd/StructureND$Companion {
public static synthetic fun buffered$default (Lspace/kscience/kmath/nd/StructureND$Companion;Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/kmath/nd/BufferND;
public static synthetic fun buffered$default (Lspace/kscience/kmath/nd/StructureND$Companion;[ILkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/kmath/nd/BufferND;
public final fun contentEquals (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Z
+ public final fun contentEquals (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;D)Z
+ public static synthetic fun contentEquals$default (Lspace/kscience/kmath/nd/StructureND$Companion;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;DILjava/lang/Object;)Z
public final fun toString (Lspace/kscience/kmath/nd/StructureND;)Ljava/lang/String;
}
public final class space/kscience/kmath/nd/StructureNDKt {
+ public static final fun contentEquals (Lspace/kscience/kmath/linear/LinearSpace;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Z
+ public static final fun contentEquals (Lspace/kscience/kmath/linear/LinearSpace;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Comparable;)Z
+ public static final fun contentEquals (Lspace/kscience/kmath/nd/AlgebraND;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Z
+ public static final fun contentEquals (Lspace/kscience/kmath/nd/GroupOpsND;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Comparable;)Z
public static final fun get (Lspace/kscience/kmath/nd/StructureND;[I)Ljava/lang/Object;
public static final fun mapInPlace (Lspace/kscience/kmath/nd/MutableStructureND;Lkotlin/jvm/functions/Function2;)V
}
+public abstract interface class space/kscience/kmath/nd/WithShape {
+ public fun getIndices ()Lspace/kscience/kmath/nd/ShapeIndexer;
+ public abstract fun getShape ()[I
+}
+
public abstract interface class space/kscience/kmath/operations/Algebra {
public fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2;
@@ -1004,21 +1251,16 @@ public abstract interface class space/kscience/kmath/operations/Algebra {
public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1;
}
-public final class space/kscience/kmath/operations/AlgebraElementsKt {
-}
-
public final class space/kscience/kmath/operations/AlgebraExtensionsKt {
- public static final fun abs (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Comparable;)Ljava/lang/Comparable;
- public static final fun average (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Iterable;)Ljava/lang/Object;
- public static final fun average (Lspace/kscience/kmath/operations/Ring;Lkotlin/sequences/Sequence;)Ljava/lang/Object;
- public static final fun averageWith (Ljava/lang/Iterable;Lspace/kscience/kmath/operations/Ring;)Ljava/lang/Object;
- public static final fun averageWith (Lkotlin/sequences/Sequence;Lspace/kscience/kmath/operations/Ring;)Ljava/lang/Object;
- public static final fun power (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;I)Ljava/lang/Object;
- public static final fun power-jXDDuk8 (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;I)Ljava/lang/Object;
- public static final fun sum (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Iterable;)Ljava/lang/Object;
- public static final fun sum (Lspace/kscience/kmath/operations/Ring;Lkotlin/sequences/Sequence;)Ljava/lang/Object;
- public static final fun sumWith (Ljava/lang/Iterable;Lspace/kscience/kmath/operations/Ring;)Ljava/lang/Object;
- public static final fun sumWith (Lkotlin/sequences/Sequence;Lspace/kscience/kmath/operations/Ring;)Ljava/lang/Object;
+ public static final fun abs (Lspace/kscience/kmath/operations/Group;Ljava/lang/Comparable;)Ljava/lang/Comparable;
+ public static final fun average (Lspace/kscience/kmath/operations/Group;Ljava/lang/Iterable;)Ljava/lang/Object;
+ public static final fun average (Lspace/kscience/kmath/operations/Group;Lkotlin/sequences/Sequence;)Ljava/lang/Object;
+ public static final fun averageWith (Ljava/lang/Iterable;Lspace/kscience/kmath/operations/Group;)Ljava/lang/Object;
+ public static final fun averageWith (Lkotlin/sequences/Sequence;Lspace/kscience/kmath/operations/Group;)Ljava/lang/Object;
+ public static final fun sum (Lspace/kscience/kmath/operations/Group;Ljava/lang/Iterable;)Ljava/lang/Object;
+ public static final fun sum (Lspace/kscience/kmath/operations/Group;Lkotlin/sequences/Sequence;)Ljava/lang/Object;
+ public static final fun sumWith (Ljava/lang/Iterable;Lspace/kscience/kmath/operations/Group;)Ljava/lang/Object;
+ public static final fun sumWith (Lkotlin/sequences/Sequence;Lspace/kscience/kmath/operations/Group;)Ljava/lang/Object;
}
public final class space/kscience/kmath/operations/AlgebraKt {
@@ -1061,7 +1303,7 @@ public final class space/kscience/kmath/operations/BigInt$Companion {
public final fun getZERO ()Lspace/kscience/kmath/operations/BigInt;
}
-public final class space/kscience/kmath/operations/BigIntField : space/kscience/kmath/operations/Field, space/kscience/kmath/operations/NumbersAddOperations, space/kscience/kmath/operations/ScaleOperations {
+public final class space/kscience/kmath/operations/BigIntField : space/kscience/kmath/operations/Field, space/kscience/kmath/operations/NumbersAddOps, space/kscience/kmath/operations/ScaleOperations {
public static final field INSTANCE Lspace/kscience/kmath/operations/BigIntField;
public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
public fun add (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt;
@@ -1085,9 +1327,12 @@ public final class space/kscience/kmath/operations/BigIntField : space/kscience/
public final class space/kscience/kmath/operations/BigIntKt {
public static final fun abs (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt;
- public static final fun bigInt (Lspace/kscience/kmath/nd/AlgebraND$Companion;[I)Lspace/kscience/kmath/nd/BufferedRingND;
public static final fun bigInt (Lspace/kscience/kmath/structures/Buffer$Companion;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer;
public static final fun bigInt (Lspace/kscience/kmath/structures/MutableBuffer$Companion;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/MutableBuffer;
+ public static final fun buffer (Lspace/kscience/kmath/operations/BigInt$Companion;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer;
+ public static final fun getAlgebra (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigIntField;
+ public static final fun getNd (Lspace/kscience/kmath/operations/BigIntField;)Lspace/kscience/kmath/nd/BufferedRingOpsND;
+ public static final fun mutableBuffer (Lspace/kscience/kmath/operations/BigInt;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer;
public static final fun parseBigInteger (Ljava/lang/String;)Lspace/kscience/kmath/operations/BigInt;
public static final fun toBigInt (I)Lspace/kscience/kmath/operations/BigInt;
public static final fun toBigInt (J)Lspace/kscience/kmath/operations/BigInt;
@@ -1096,6 +1341,85 @@ public final class space/kscience/kmath/operations/BigIntKt {
public static final fun toBigInt-WZ4Q5Ns (I)Lspace/kscience/kmath/operations/BigInt;
}
+public abstract interface class space/kscience/kmath/operations/BufferAlgebra : space/kscience/kmath/operations/Algebra {
+ public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2;
+ public fun buffer (I[Ljava/lang/Object;)Lspace/kscience/kmath/structures/Buffer;
+ public abstract fun getBufferFactory ()Lkotlin/jvm/functions/Function2;
+ public abstract fun getElementAlgebra ()Lspace/kscience/kmath/operations/Algebra;
+ public fun map (Lspace/kscience/kmath/structures/Buffer;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer;
+ public fun mapIndexed (Lspace/kscience/kmath/structures/Buffer;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/structures/Buffer;
+ public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1;
+ public fun zip (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/structures/Buffer;
+}
+
+public final class space/kscience/kmath/operations/BufferAlgebraKt {
+ public static final fun acos (Lspace/kscience/kmath/operations/BufferAlgebra;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
+ public static final fun acosh (Lspace/kscience/kmath/operations/BufferAlgebra;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
+ public static final fun asin (Lspace/kscience/kmath/operations/BufferAlgebra;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
+ public static final fun asinh (Lspace/kscience/kmath/operations/BufferAlgebra;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
+ public static final fun atan (Lspace/kscience/kmath/operations/BufferAlgebra;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
+ public static final fun atanh (Lspace/kscience/kmath/operations/BufferAlgebra;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
+ public static final fun buffer (Lspace/kscience/kmath/operations/BufferAlgebra;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer;
+ public static final fun buffer (Lspace/kscience/kmath/operations/BufferAlgebra;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer;
+ public static final fun buffer (Lspace/kscience/kmath/operations/BufferField;[Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer;
+ public static final fun bufferAlgebra (Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/operations/BufferFieldOps;
+ public static final fun cos (Lspace/kscience/kmath/operations/BufferAlgebra;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
+ public static final fun cosh (Lspace/kscience/kmath/operations/BufferAlgebra;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
+ public static final fun exp (Lspace/kscience/kmath/operations/BufferAlgebra;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
+ public static final fun getBufferAlgebra (Lspace/kscience/kmath/operations/DoubleField;)Lspace/kscience/kmath/operations/BufferFieldOps;
+ public static final fun getBufferAlgebra (Lspace/kscience/kmath/operations/ShortRing;)Lspace/kscience/kmath/operations/BufferRingOps;
+ public static final fun ln (Lspace/kscience/kmath/operations/BufferAlgebra;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
+ public static final fun pow (Lspace/kscience/kmath/operations/BufferAlgebra;Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer;
+ public static final fun sin (Lspace/kscience/kmath/operations/BufferAlgebra;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
+ public static final fun sinh (Lspace/kscience/kmath/operations/BufferAlgebra;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
+ public static final fun tan (Lspace/kscience/kmath/operations/BufferAlgebra;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
+ public static final fun tanh (Lspace/kscience/kmath/operations/BufferAlgebra;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
+ public static final fun withSize (Lspace/kscience/kmath/operations/BufferFieldOps;I)Lspace/kscience/kmath/operations/BufferField;
+}
+
+public final class space/kscience/kmath/operations/BufferField : space/kscience/kmath/operations/BufferFieldOps, space/kscience/kmath/operations/Field, space/kscience/kmath/operations/WithSize {
+ public fun (Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;I)V
+ public synthetic fun getOne ()Ljava/lang/Object;
+ public fun getOne ()Lspace/kscience/kmath/structures/Buffer;
+ public fun getSize ()I
+ public synthetic fun getZero ()Ljava/lang/Object;
+ public fun getZero ()Lspace/kscience/kmath/structures/Buffer;
+}
+
+public class space/kscience/kmath/operations/BufferFieldOps : space/kscience/kmath/operations/BufferRingOps, space/kscience/kmath/operations/BufferAlgebra, space/kscience/kmath/operations/FieldOps, space/kscience/kmath/operations/ScaleOperations {
+ public fun (Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;)V
+ public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2;
+ public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
+ public fun divide (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
+ public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object;
+ public fun scale (Lspace/kscience/kmath/structures/Buffer;D)Lspace/kscience/kmath/structures/Buffer;
+ public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun unaryMinus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
+}
+
+public final class space/kscience/kmath/operations/BufferOperationKt {
+ public static final fun asIterable (Lspace/kscience/kmath/structures/Buffer;)Ljava/lang/Iterable;
+ public static final fun asSequence (Lspace/kscience/kmath/structures/Buffer;)Lkotlin/sequences/Sequence;
+ public static final fun fold (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object;
+ public static final fun map (Lspace/kscience/kmath/structures/Buffer;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer;
+ public static final fun toList (Lspace/kscience/kmath/structures/Buffer;)Ljava/util/List;
+}
+
+public class space/kscience/kmath/operations/BufferRingOps : space/kscience/kmath/operations/BufferAlgebra, space/kscience/kmath/operations/RingOps {
+ public fun (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)V
+ public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
+ public fun add (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
+ public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2;
+ public fun getBufferFactory ()Lkotlin/jvm/functions/Function2;
+ public synthetic fun getElementAlgebra ()Lspace/kscience/kmath/operations/Algebra;
+ public fun getElementAlgebra ()Lspace/kscience/kmath/operations/Ring;
+ public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
+ public fun multiply (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
+ public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun unaryMinus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
+ public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1;
+}
+
public final class space/kscience/kmath/operations/ByteRing : space/kscience/kmath/operations/Norm, space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/Ring {
public static final field INSTANCE Lspace/kscience/kmath/operations/ByteRing;
public fun add (BB)Ljava/lang/Byte;
@@ -1120,6 +1444,90 @@ public final class space/kscience/kmath/operations/ByteRing : space/kscience/kma
public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object;
}
+public final class space/kscience/kmath/operations/DoubleBufferField : space/kscience/kmath/operations/DoubleBufferOps, space/kscience/kmath/operations/ExtendedField {
+ public fun (I)V
+ public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun acosh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
+ public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun asinh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
+ public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun atanh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
+ public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun cosh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
+ public synthetic fun getOne ()Ljava/lang/Object;
+ public fun getOne ()Lspace/kscience/kmath/structures/Buffer;
+ public final fun getSize ()I
+ public synthetic fun getZero ()Ljava/lang/Object;
+ public fun getZero ()Lspace/kscience/kmath/structures/Buffer;
+ public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object;
+ public fun power-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)[D
+ public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun sinh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
+ public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun tanh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
+ public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1;
+}
+
+public abstract class space/kscience/kmath/operations/DoubleBufferOps : space/kscience/kmath/operations/BufferAlgebra, space/kscience/kmath/operations/ExtendedFieldOps, space/kscience/kmath/operations/Norm {
+ public static final field Companion Lspace/kscience/kmath/operations/DoubleBufferOps$Companion;
+ public fun ()V
+ public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun acos-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
+ public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun acosh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
+ public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
+ public fun add-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D
+ public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun asin-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
+ public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun asinh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
+ public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun atan-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
+ public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun atanh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
+ public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2;
+ public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun cos-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
+ public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun cosh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
+ public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
+ public fun divide-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D
+ public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun exp-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
+ public fun getBufferFactory ()Lkotlin/jvm/functions/Function2;
+ public synthetic fun getElementAlgebra ()Lspace/kscience/kmath/operations/Algebra;
+ public fun getElementAlgebra ()Lspace/kscience/kmath/operations/DoubleField;
+ public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun ln-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
+ public synthetic fun map (Lspace/kscience/kmath/structures/Buffer;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer;
+ public fun map-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;Lkotlin/jvm/functions/Function2;)[D
+ public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
+ public fun minus-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D
+ public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
+ public fun multiply-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D
+ public synthetic fun norm (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun norm (Lspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double;
+ public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
+ public fun plus-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D
+ public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object;
+ public fun scale-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;D)[D
+ public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun sin-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
+ public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun sinh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
+ public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun tan-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
+ public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun tanh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
+ public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun unaryMinus-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
+ public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1;
+}
+
+public final class space/kscience/kmath/operations/DoubleBufferOps$Companion : space/kscience/kmath/operations/DoubleBufferOps {
+ public final fun mapInline-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;Lkotlin/jvm/functions/Function1;)[D
+}
+
public final class space/kscience/kmath/operations/DoubleField : space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/Norm, space/kscience/kmath/operations/ScaleOperations {
public static final field INSTANCE Lspace/kscience/kmath/operations/DoubleField;
public fun acos (D)Ljava/lang/Double;
@@ -1171,6 +1579,8 @@ public final class space/kscience/kmath/operations/DoubleField : space/kscience/
public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object;
public fun sinh (D)Ljava/lang/Double;
public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun sqrt (D)Ljava/lang/Double;
+ public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object;
public fun tan (D)Ljava/lang/Double;
public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object;
public fun tanh (D)Ljava/lang/Double;
@@ -1181,6 +1591,12 @@ public final class space/kscience/kmath/operations/DoubleField : space/kscience/
public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object;
}
+public final class space/kscience/kmath/operations/DoubleL2Norm : space/kscience/kmath/operations/Norm {
+ public static final field INSTANCE Lspace/kscience/kmath/operations/DoubleL2Norm;
+ public synthetic fun norm (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun norm (Lspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double;
+}
+
public abstract interface class space/kscience/kmath/operations/ExponentialOperations : space/kscience/kmath/operations/Algebra {
public static final field ACOSH_OPERATION Ljava/lang/String;
public static final field ASINH_OPERATION Ljava/lang/String;
@@ -1212,7 +1628,7 @@ public final class space/kscience/kmath/operations/ExponentialOperations$Compani
public static final field TANH_OPERATION Ljava/lang/String;
}
-public abstract interface class space/kscience/kmath/operations/ExtendedField : space/kscience/kmath/operations/ExtendedFieldOperations, space/kscience/kmath/operations/Field, space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/ScaleOperations {
+public abstract interface class space/kscience/kmath/operations/ExtendedField : space/kscience/kmath/operations/ExtendedFieldOps, space/kscience/kmath/operations/Field, space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/PowerOperations {
public fun acosh (Ljava/lang/Object;)Ljava/lang/Object;
public fun asinh (Ljava/lang/Object;)Ljava/lang/Object;
public fun atanh (Ljava/lang/Object;)Ljava/lang/Object;
@@ -1220,27 +1636,33 @@ public abstract interface class space/kscience/kmath/operations/ExtendedField :
public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2;
public fun sinh (Ljava/lang/Object;)Ljava/lang/Object;
public fun tanh (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1;
}
-public abstract interface class space/kscience/kmath/operations/ExtendedFieldOperations : space/kscience/kmath/operations/ExponentialOperations, space/kscience/kmath/operations/FieldOperations, space/kscience/kmath/operations/PowerOperations, space/kscience/kmath/operations/TrigonometricOperations {
+public abstract interface class space/kscience/kmath/operations/ExtendedFieldOps : space/kscience/kmath/operations/ExponentialOperations, space/kscience/kmath/operations/FieldOps, space/kscience/kmath/operations/ScaleOperations, space/kscience/kmath/operations/TrigonometricOperations {
public fun tan (Ljava/lang/Object;)Ljava/lang/Object;
public fun tanh (Ljava/lang/Object;)Ljava/lang/Object;
public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1;
}
-public abstract interface class space/kscience/kmath/operations/Field : space/kscience/kmath/operations/FieldOperations, space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/Ring, space/kscience/kmath/operations/ScaleOperations {
+public abstract interface class space/kscience/kmath/operations/Field : space/kscience/kmath/operations/FieldOps, space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/Ring, space/kscience/kmath/operations/ScaleOperations {
+ public static final field Companion Lspace/kscience/kmath/operations/Field$Companion;
public fun number (Ljava/lang/Number;)Ljava/lang/Object;
+ public fun power (Ljava/lang/Object;I)Ljava/lang/Object;
}
-public abstract interface class space/kscience/kmath/operations/FieldOperations : space/kscience/kmath/operations/RingOperations {
- public static final field Companion Lspace/kscience/kmath/operations/FieldOperations$Companion;
+public final class space/kscience/kmath/operations/Field$Companion {
+}
+
+public abstract interface class space/kscience/kmath/operations/FieldOps : space/kscience/kmath/operations/RingOps {
+ public static final field Companion Lspace/kscience/kmath/operations/FieldOps$Companion;
public static final field DIV_OPERATION Ljava/lang/String;
public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2;
public fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
public abstract fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
}
-public final class space/kscience/kmath/operations/FieldOperations$Companion {
+public final class space/kscience/kmath/operations/FieldOps$Companion {
public static final field DIV_OPERATION Ljava/lang/String;
}
@@ -1295,6 +1717,8 @@ public final class space/kscience/kmath/operations/FloatField : space/kscience/k
public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object;
public fun sinh (F)Ljava/lang/Float;
public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun sqrt (F)Ljava/lang/Float;
+ public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object;
public fun tan (F)Ljava/lang/Float;
public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object;
public fun tanh (F)Ljava/lang/Float;
@@ -1305,12 +1729,12 @@ public final class space/kscience/kmath/operations/FloatField : space/kscience/k
public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object;
}
-public abstract interface class space/kscience/kmath/operations/Group : space/kscience/kmath/operations/GroupOperations {
+public abstract interface class space/kscience/kmath/operations/Group : space/kscience/kmath/operations/GroupOps {
public abstract fun getZero ()Ljava/lang/Object;
}
-public abstract interface class space/kscience/kmath/operations/GroupOperations : space/kscience/kmath/operations/Algebra {
- public static final field Companion Lspace/kscience/kmath/operations/GroupOperations$Companion;
+public abstract interface class space/kscience/kmath/operations/GroupOps : space/kscience/kmath/operations/Algebra {
+ public static final field Companion Lspace/kscience/kmath/operations/GroupOps$Companion;
public static final field MINUS_OPERATION Ljava/lang/String;
public static final field PLUS_OPERATION Ljava/lang/String;
public abstract fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
@@ -1322,7 +1746,7 @@ public abstract interface class space/kscience/kmath/operations/GroupOperations
public fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object;
}
-public final class space/kscience/kmath/operations/GroupOperations$Companion {
+public final class space/kscience/kmath/operations/GroupOps$Companion {
public static final field MINUS_OPERATION Ljava/lang/String;
public static final field PLUS_OPERATION Ljava/lang/String;
}
@@ -1351,6 +1775,10 @@ public final class space/kscience/kmath/operations/IntRing : space/kscience/kmat
public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object;
}
+public final class space/kscience/kmath/operations/IsIntegerKt {
+ public static final fun isInteger (Ljava/lang/Number;)Z
+}
+
public final class space/kscience/kmath/operations/JBigDecimalField : space/kscience/kmath/operations/JBigDecimalFieldBase {
public static final field Companion Lspace/kscience/kmath/operations/JBigDecimalField$Companion;
public fun ()V
@@ -1441,6 +1869,15 @@ public abstract interface class space/kscience/kmath/operations/Norm {
public abstract fun norm (Ljava/lang/Object;)Ljava/lang/Object;
}
+public final class space/kscience/kmath/operations/NumbersKt {
+ public static final fun getAlgebra (Lkotlin/jvm/internal/ByteCompanionObject;)Lspace/kscience/kmath/operations/ByteRing;
+ public static final fun getAlgebra (Lkotlin/jvm/internal/DoubleCompanionObject;)Lspace/kscience/kmath/operations/DoubleField;
+ public static final fun getAlgebra (Lkotlin/jvm/internal/FloatCompanionObject;)Lspace/kscience/kmath/operations/FloatField;
+ public static final fun getAlgebra (Lkotlin/jvm/internal/IntCompanionObject;)Lspace/kscience/kmath/operations/IntRing;
+ public static final fun getAlgebra (Lkotlin/jvm/internal/LongCompanionObject;)Lspace/kscience/kmath/operations/LongRing;
+ public static final fun getAlgebra (Lkotlin/jvm/internal/ShortCompanionObject;)Lspace/kscience/kmath/operations/ShortRing;
+}
+
public abstract interface class space/kscience/kmath/operations/NumericAlgebra : space/kscience/kmath/operations/Algebra {
public fun bindSymbolOrNull (Ljava/lang/String;)Ljava/lang/Object;
public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object;
@@ -1455,10 +1892,7 @@ public final class space/kscience/kmath/operations/NumericAlgebraKt {
public static final fun getPi (Lspace/kscience/kmath/operations/NumericAlgebra;)Ljava/lang/Object;
}
-public final class space/kscience/kmath/operations/OptionalOperationsKt {
-}
-
-public abstract interface class space/kscience/kmath/operations/PowerOperations : space/kscience/kmath/operations/Algebra {
+public abstract interface class space/kscience/kmath/operations/PowerOperations : space/kscience/kmath/operations/FieldOps {
public static final field Companion Lspace/kscience/kmath/operations/PowerOperations$Companion;
public static final field POW_OPERATION Ljava/lang/String;
public static final field SQRT_OPERATION Ljava/lang/String;
@@ -1472,19 +1906,24 @@ public final class space/kscience/kmath/operations/PowerOperations$Companion {
public static final field SQRT_OPERATION Ljava/lang/String;
}
-public abstract interface class space/kscience/kmath/operations/Ring : space/kscience/kmath/operations/Group, space/kscience/kmath/operations/RingOperations {
+public abstract interface class space/kscience/kmath/operations/Ring : space/kscience/kmath/operations/Group, space/kscience/kmath/operations/RingOps {
+ public static final field Companion Lspace/kscience/kmath/operations/Ring$Companion;
public abstract fun getOne ()Ljava/lang/Object;
+ public fun power-Qn1smSk (Ljava/lang/Object;I)Ljava/lang/Object;
}
-public abstract interface class space/kscience/kmath/operations/RingOperations : space/kscience/kmath/operations/GroupOperations {
- public static final field Companion Lspace/kscience/kmath/operations/RingOperations$Companion;
+public final class space/kscience/kmath/operations/Ring$Companion {
+}
+
+public abstract interface class space/kscience/kmath/operations/RingOps : space/kscience/kmath/operations/GroupOps {
+ public static final field Companion Lspace/kscience/kmath/operations/RingOps$Companion;
public static final field TIMES_OPERATION Ljava/lang/String;
public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2;
public abstract fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
public fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
}
-public final class space/kscience/kmath/operations/RingOperations$Companion {
+public final class space/kscience/kmath/operations/RingOps$Companion {
public static final field TIMES_OPERATION Ljava/lang/String;
}
@@ -1544,6 +1983,10 @@ public final class space/kscience/kmath/operations/TrigonometricOperations$Compa
public static final field TAN_OPERATION Ljava/lang/String;
}
+public abstract interface class space/kscience/kmath/operations/WithSize {
+ public abstract fun getSize ()I
+}
+
public final class space/kscience/kmath/structures/ArrayBuffer : space/kscience/kmath/structures/MutableBuffer {
public fun ([Ljava/lang/Object;)V
public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer;
@@ -1551,6 +1994,11 @@ public final class space/kscience/kmath/structures/ArrayBuffer : space/kscience/
public fun getSize ()I
public fun iterator ()Ljava/util/Iterator;
public fun set (ILjava/lang/Object;)V
+ public fun toString ()Ljava/lang/String;
+}
+
+public final class space/kscience/kmath/structures/ArrayBufferKt {
+ public static final fun asBuffer ([Ljava/lang/Object;)Lspace/kscience/kmath/structures/ArrayBuffer;
}
public abstract interface class space/kscience/kmath/structures/Buffer {
@@ -1558,31 +2006,25 @@ public abstract interface class space/kscience/kmath/structures/Buffer {
public abstract fun get (I)Ljava/lang/Object;
public abstract fun getSize ()I
public abstract fun iterator ()Ljava/util/Iterator;
+ public abstract fun toString ()Ljava/lang/String;
}
public final class space/kscience/kmath/structures/Buffer$Companion {
public final fun auto (Lkotlin/reflect/KClass;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer;
public final fun boxing (ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer;
public final fun contentEquals (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Z
+ public final fun toString (Lspace/kscience/kmath/structures/Buffer;)Ljava/lang/String;
}
public final class space/kscience/kmath/structures/BufferKt {
- public static final fun asBuffer (Ljava/util/List;)Lspace/kscience/kmath/structures/ListBuffer;
- public static final fun asBuffer ([Ljava/lang/Object;)Lspace/kscience/kmath/structures/ArrayBuffer;
- public static final fun asMutableBuffer (Ljava/util/List;)Ljava/util/List;
public static final fun asReadOnly (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
+ public static final fun first (Lspace/kscience/kmath/structures/Buffer;)Ljava/lang/Object;
public static final fun getIndices (Lspace/kscience/kmath/structures/Buffer;)Lkotlin/ranges/IntRange;
-}
-
-public final class space/kscience/kmath/structures/BufferOperationKt {
- public static final fun asIterable (Lspace/kscience/kmath/structures/Buffer;)Ljava/lang/Iterable;
- public static final fun asSequence (Lspace/kscience/kmath/structures/Buffer;)Lkotlin/sequences/Sequence;
- public static final fun fold (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object;
- public static final fun map (Lspace/kscience/kmath/structures/Buffer;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer;
- public static final fun toList (Lspace/kscience/kmath/structures/Buffer;)Ljava/util/List;
+ public static final fun last (Lspace/kscience/kmath/structures/Buffer;)Ljava/lang/Object;
}
public final class space/kscience/kmath/structures/DoubleBuffer : space/kscience/kmath/structures/MutableBuffer {
+ public static final field Companion Lspace/kscience/kmath/structures/DoubleBuffer$Companion;
public static final synthetic fun box-impl ([D)Lspace/kscience/kmath/structures/DoubleBuffer;
public static fun constructor-impl ([D)[D
public synthetic fun copy ()Lspace/kscience/kmath/structures/MutableBuffer;
@@ -1610,97 +2052,8 @@ public final class space/kscience/kmath/structures/DoubleBuffer : space/kscience
public final synthetic fun unbox-impl ()[D
}
-public final class space/kscience/kmath/structures/DoubleBufferField : space/kscience/kmath/operations/ExtendedField {
- public fun (I)V
- public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object;
- public fun acos-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object;
- public fun acosh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
- public fun add-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object;
- public fun asin-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object;
- public fun asinh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object;
- public fun atan-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object;
- public fun atanh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object;
- public fun cos-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object;
- public fun cosh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
- public fun divide-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object;
- public fun exp-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun getOne ()Ljava/lang/Object;
- public fun getOne ()Lspace/kscience/kmath/structures/Buffer;
- public final fun getSize ()I
- public synthetic fun getZero ()Ljava/lang/Object;
- public fun getZero ()Lspace/kscience/kmath/structures/Buffer;
- public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object;
- public fun ln-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
- public fun multiply-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object;
- public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer;
- public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object;
- public fun power-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)[D
- public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object;
- public fun scale-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;D)[D
- public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object;
- public fun sin-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object;
- public fun sinh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object;
- public fun tan-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object;
- public fun tanh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object;
- public fun unaryMinus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer;
-}
-
-public final class space/kscience/kmath/structures/DoubleBufferFieldOperations : space/kscience/kmath/operations/ExtendedFieldOperations {
- public static final field INSTANCE Lspace/kscience/kmath/structures/DoubleBufferFieldOperations;
- public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object;
- public fun acos-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object;
- public fun acosh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
- public fun add-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object;
- public fun asin-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object;
- public fun asinh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object;
- public fun atan-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object;
- public fun atanh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object;
- public fun cos-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object;
- public fun cosh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
- public fun divide-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object;
- public fun exp-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object;
- public fun ln-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
- public fun multiply-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object;
- public fun power-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)[D
- public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object;
- public fun sin-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object;
- public fun sinh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object;
- public fun tan-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object;
- public fun tanh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
- public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object;
- public fun unaryMinus-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D
+public final class space/kscience/kmath/structures/DoubleBuffer$Companion {
+ public final fun zero-Udx-57Q (I)[D
}
public final class space/kscience/kmath/structures/DoubleBufferKt {
@@ -1731,6 +2084,7 @@ public final class space/kscience/kmath/structures/FlaggedDoubleBuffer : space/k
public fun getSize ()I
public final fun getValues ()[D
public fun iterator ()Ljava/util/Iterator;
+ public fun toString ()Ljava/lang/String;
}
public final class space/kscience/kmath/structures/FloatBuffer : space/kscience/kmath/structures/MutableBuffer {
@@ -1808,6 +2162,12 @@ public final class space/kscience/kmath/structures/ListBuffer : space/kscience/k
public final fun getList ()Ljava/util/List;
public fun getSize ()I
public fun iterator ()Ljava/util/Iterator;
+ public fun toString ()Ljava/lang/String;
+}
+
+public final class space/kscience/kmath/structures/ListBufferKt {
+ public static final fun asBuffer (Ljava/util/List;)Lspace/kscience/kmath/structures/ListBuffer;
+ public static final fun asMutableBuffer (Ljava/util/List;)Ljava/util/List;
}
public final class space/kscience/kmath/structures/LongBuffer : space/kscience/kmath/structures/MutableBuffer {
@@ -1852,6 +2212,7 @@ public class space/kscience/kmath/structures/MemoryBuffer : space/kscience/kmath
public fun getSize ()I
protected final fun getSpec ()Lspace/kscience/kmath/memory/MemorySpec;
public fun iterator ()Ljava/util/Iterator;
+ public fun toString ()Ljava/lang/String;
}
public final class space/kscience/kmath/structures/MemoryBuffer$Companion {
@@ -1981,5 +2342,6 @@ public final class space/kscience/kmath/structures/VirtualBuffer : space/kscienc
public fun get (I)Ljava/lang/Object;
public fun getSize ()I
public fun iterator ()Ljava/util/Iterator;
+ public fun toString ()Ljava/lang/String;
}
diff --git a/kmath-core/build.gradle.kts b/kmath-core/build.gradle.kts
index 4a35a54fb..052924ce8 100644
--- a/kmath-core/build.gradle.kts
+++ b/kmath-core/build.gradle.kts
@@ -1,8 +1,6 @@
plugins {
- kotlin("multiplatform")
- id("ru.mipt.npm.gradle.common")
+ id("ru.mipt.npm.gradle.mpp")
id("ru.mipt.npm.gradle.native")
-// id("com.xcporter.metaview") version "0.0.5"
}
kotlin.sourceSets {
diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/Domain1D.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/Domain1D.kt
new file mode 100644
index 000000000..3d531349c
--- /dev/null
+++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/Domain1D.kt
@@ -0,0 +1,59 @@
+/*
+ * 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.domains
+
+import space.kscience.kmath.linear.Point
+import space.kscience.kmath.misc.UnstableKMathAPI
+
+@UnstableKMathAPI
+public abstract class Domain1D>(public val range: ClosedRange) : Domain {
+ override val dimension: Int get() = 1
+
+ public operator fun contains(value: T): Boolean = range.contains(value)
+
+ override operator fun contains(point: Point): Boolean {
+ require(point.size == 0)
+ return contains(point[0])
+ }
+}
+
+@UnstableKMathAPI
+public class DoubleDomain1D(
+ @Suppress("CanBeParameter") public val doubleRange: ClosedFloatingPointRange,
+) : Domain1D(doubleRange), DoubleDomain {
+ override fun getLowerBound(num: Int): Double {
+ require(num == 0)
+ return range.start
+ }
+
+ override fun getUpperBound(num: Int): Double {
+ require(num == 0)
+ return range.endInclusive
+ }
+
+ override fun volume(): Double = range.endInclusive - range.start
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other == null || this::class != other::class) return false
+
+ other as DoubleDomain1D
+
+ if (doubleRange != other.doubleRange) return false
+
+ return true
+ }
+
+ override fun hashCode(): Int = doubleRange.hashCode()
+
+ override fun toString(): String = doubleRange.toString()
+
+
+}
+
+@UnstableKMathAPI
+public val Domain1D.center: Double
+ get() = (range.endInclusive + range.start) / 2
diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/HyperSquareDomain.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/HyperSquareDomain.kt
index bd5514623..485416a69 100644
--- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/HyperSquareDomain.kt
+++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/HyperSquareDomain.kt
@@ -7,18 +7,28 @@ package space.kscience.kmath.domains
import space.kscience.kmath.linear.Point
import space.kscience.kmath.misc.UnstableKMathAPI
import space.kscience.kmath.structures.Buffer
+import space.kscience.kmath.structures.DoubleBuffer
import space.kscience.kmath.structures.indices
/**
- *
- * HyperSquareDomain class.
- *
- * @author Alexander Nozik
+ * A hyper-square (or hyper-cube) real-space domain. It is formed by a [Buffer] of [lower] boundaries
+ * and a [Buffer] of upper boundaries. Upper should be greater or equals than lower.
*/
@UnstableKMathAPI
-public class HyperSquareDomain(private val lower: Buffer, private val upper: Buffer) : DoubleDomain {
+public class HyperSquareDomain(public val lower: Buffer