Merge branch 'dev' into commandertvis/hermitian-conjugate
This commit is contained in:
commit
78dc3ee985
@ -12,6 +12,8 @@ jobs:
|
|||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 11
|
java-version: 11
|
||||||
|
- name: Grant execute permission for gradlew
|
||||||
|
run: chmod +x gradlew
|
||||||
- name: Install Chrome
|
- name: Install Chrome
|
||||||
run: |
|
run: |
|
||||||
sudo apt install -y libappindicator1 fonts-liberation
|
sudo apt install -y libappindicator1 fonts-liberation
|
||||||
@ -47,6 +49,8 @@ jobs:
|
|||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 11
|
java-version: 11
|
||||||
|
- name: Grant execute permission for gradlew
|
||||||
|
run: chmod +x gradlew
|
||||||
- name: Cache gradle
|
- name: Cache gradle
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
@ -77,6 +81,8 @@ jobs:
|
|||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 11
|
java-version: 11
|
||||||
|
- name: Grant execute permission for gradlew
|
||||||
|
run: chmod +x gradlew
|
||||||
- name: Add msys to path
|
- name: Add msys to path
|
||||||
run: SETX PATH "%PATH%;C:\msys64\mingw64\bin"
|
run: SETX PATH "%PATH%;C:\msys64\mingw64\bin"
|
||||||
- name: Cache gradle
|
- name: Cache gradle
|
117
.github/workflows/publish.yml
vendored
Normal file
117
.github/workflows/publish.yml
vendored
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
name: Bintray Publish
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types:
|
||||||
|
- created
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-ubuntu:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up JDK 11
|
||||||
|
uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 11
|
||||||
|
- name: Grant execute permission for gradlew
|
||||||
|
run: chmod +x gradlew
|
||||||
|
- name: Install Chrome
|
||||||
|
run: |
|
||||||
|
sudo apt install -y libappindicator1 fonts-liberation
|
||||||
|
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
||||||
|
sudo dpkg -i google-chrome*.deb
|
||||||
|
- name: Cache gradle
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
.gradle
|
||||||
|
build
|
||||||
|
~/.gradle
|
||||||
|
key: gradle
|
||||||
|
restore-keys: gradle
|
||||||
|
|
||||||
|
- name: Cache konan
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.konan/dependencies
|
||||||
|
~/.konan/kotlin-native-prebuilt-linux-*
|
||||||
|
key: ${{ runner.os }}-konan
|
||||||
|
restore-keys: ${{ runner.os }}-konan
|
||||||
|
- name: Build with Gradle
|
||||||
|
run: ./gradlew -Dorg.gradle.daemon=false --build-cache build
|
||||||
|
- name: Run release task
|
||||||
|
run: ./gradlew release -PbintrayUser=${{ secrets.BINTRAY_USER }} -PbintrayApiKey=${{ secrets.BINTRAY_KEY }}
|
||||||
|
|
||||||
|
build-osx:
|
||||||
|
runs-on: macos-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up JDK 11
|
||||||
|
uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 11
|
||||||
|
- name: Grant execute permission for gradlew
|
||||||
|
run: chmod +x gradlew
|
||||||
|
- name: Cache gradle
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
.gradle
|
||||||
|
build
|
||||||
|
~/.gradle
|
||||||
|
key: gradle
|
||||||
|
restore-keys: gradle
|
||||||
|
|
||||||
|
- name: Cache konan
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.konan/dependencies
|
||||||
|
~/.konan/kotlin-native-prebuilt-macos-*
|
||||||
|
key: ${{ runner.os }}-konan
|
||||||
|
restore-keys: ${{ runner.os }}-konan
|
||||||
|
- name: Build with Gradle
|
||||||
|
run: sudo ./gradlew -Dorg.gradle.daemon=false --build-cache build
|
||||||
|
- name: Run release task
|
||||||
|
run: ./gradlew release -PbintrayUser=${{ secrets.BINTRAY_USER }} -PbintrayApiKey=${{ secrets.BINTRAY_KEY }}
|
||||||
|
|
||||||
|
build-windows:
|
||||||
|
runs-on: windows-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up JDK 11
|
||||||
|
uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 11
|
||||||
|
- name: Grant execute permission for gradlew
|
||||||
|
run: chmod +x gradlew
|
||||||
|
- name: Add msys to path
|
||||||
|
run: SETX PATH "%PATH%;C:\msys64\mingw64\bin"
|
||||||
|
- name: Cache gradle
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
.gradle
|
||||||
|
build
|
||||||
|
~/.gradle
|
||||||
|
key: ${{ runner.os }}-gradle
|
||||||
|
restore-keys: ${{ runner.os }}-gradle
|
||||||
|
|
||||||
|
- name: Cache konan
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.konan/dependencies
|
||||||
|
~/.konan/kotlin-native-prebuilt-mingw-*
|
||||||
|
key: ${{ runner.os }}-konan
|
||||||
|
restore-keys: ${{ runner.os }}-konan
|
||||||
|
- name: Build with Gradle
|
||||||
|
run: ./gradlew --build-cache build
|
||||||
|
- name: Run release task
|
||||||
|
run: ./gradlew release -PbintrayUser=${{ secrets.BINTRAY_USER }} -PbintrayApiKey=${{ secrets.BINTRAY_KEY }}
|
||||||
|
|
@ -37,6 +37,8 @@
|
|||||||
- Features moved to NDStructure and became transparent.
|
- Features moved to NDStructure and became transparent.
|
||||||
- Capitalization of LUP in many names changed to Lup.
|
- Capitalization of LUP in many names changed to Lup.
|
||||||
- Refactored `NDStructure` algebra to be more simple, preferring under-the-hood conversion to explicit NDStructure types
|
- Refactored `NDStructure` algebra to be more simple, preferring under-the-hood conversion to explicit NDStructure types
|
||||||
|
- Refactor histograms. They are marked as prototype
|
||||||
|
- Refactor AlgebraElement
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
||||||
@ -45,6 +47,7 @@
|
|||||||
- Support of `legacy` JS backend (we will support only IR)
|
- Support of `legacy` JS backend (we will support only IR)
|
||||||
- `toGrid` method.
|
- `toGrid` method.
|
||||||
- Public visibility of `BufferAccessor2D`
|
- Public visibility of `BufferAccessor2D`
|
||||||
|
- `Real` class
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- `symbol` method in `MstExtendedField` (https://github.com/mipt-npm/kmath/pull/140)
|
- `symbol` method in `MstExtendedField` (https://github.com/mipt-npm/kmath/pull/140)
|
||||||
|
90
README.md
90
README.md
@ -9,7 +9,7 @@ Bintray-dev: [ ![Download](https://api.bintray.com/packages/mipt-npm/dev/kmat
|
|||||||
|
|
||||||
# KMath
|
# KMath
|
||||||
|
|
||||||
Could be pronounced as `key-math`. The Kotlin MATHematics library was initially intended as a Kotlin-based analog to
|
Could be pronounced as `key-math`. The **K**otlin **Math**ematics library was initially intended as a Kotlin-based analog to
|
||||||
Python's NumPy library. Later we found that kotlin is much more flexible language and allows superior architecture
|
Python's NumPy library. Later we found that kotlin is much more flexible language and allows superior architecture
|
||||||
designs. In contrast to `numpy` and `scipy` it is modular and has a lightweight core. The `numpy`-like experience could
|
designs. In contrast to `numpy` and `scipy` it is modular and has a lightweight core. The `numpy`-like experience could
|
||||||
be achieved with [kmath-for-real](/kmath-for-real) extension module.
|
be achieved with [kmath-for-real](/kmath-for-real) extension module.
|
||||||
@ -32,49 +32,46 @@ be achieved with [kmath-for-real](/kmath-for-real) extension module.
|
|||||||
* Provide the best performance out of the box. We have specialized libraries for that. Need only API wrappers for them.
|
* Provide the best performance out of the box. We have specialized libraries for that. Need only API wrappers for them.
|
||||||
* Cover all cases as immediately and in one bundle. We will modularize everything and add new features gradually.
|
* Cover all cases as immediately and in one bundle. We will modularize everything and add new features gradually.
|
||||||
* Provide specialized behavior in the core. API is made generic on purpose, so one needs to specialize for types, like
|
* Provide specialized behavior in the core. API is made generic on purpose, so one needs to specialize for types, like
|
||||||
for `Double` in the core. For that we will have specialization modules like `for-real`, which will give better
|
for `Double` in the core. For that we will have specialization modules like `kmath-for-real`, which will give better
|
||||||
experience for those, who want to work with specific types.
|
experience for those, who want to work with specific types.
|
||||||
|
|
||||||
## Features
|
## Features and stability
|
||||||
|
|
||||||
Current feature list is [here](/docs/features.md)
|
KMath is a modular library. Different modules provide different features with different API stability guarantees. All core modules are released with the same version, but with different API change policy. The features are described in module definitions below. The module stability could have following levels:
|
||||||
|
|
||||||
* **Algebra**
|
* **PROTOTYPE**. On this level there are no compatibility guarantees. All methods and classes form those modules could break any moment. You can still use it, but be sure to fix the specific version.
|
||||||
* Algebraic structures like rings, spaces and fields (**TODO** add example to wiki)
|
* **EXPERIMENTAL**. The general API is decided, but some changes could be made. Volatile API is marked with `@UnstableKmathAPI` or other stability warning annotations.
|
||||||
* Basic linear algebra operations (sums, products, etc.), backed by the `Space` API.
|
* **DEVELOPMENT**. API breaking genrally follows semantic versioning ideology. There could be changes in minor versions, but not in patch versions. API is protected with [binary-compatibility-validator](https://github.com/Kotlin/binary-compatibility-validator) tool.
|
||||||
* Complex numbers backed by the `Field` API (meaning they will be usable in any structure like vectors and
|
* **STABLE**. The API stabilized. Breaking changes are allowed only in major releases.
|
||||||
N-dimensional arrays).
|
|
||||||
* Advanced linear algebra operations like matrix inversion and LU decomposition.
|
|
||||||
|
|
||||||
* **Array-like structures** Full support of many-dimensional array-like structures
|
<!--Current feature list is [here](/docs/features.md)-->
|
||||||
including mixed arithmetic operations and function operations over arrays and numbers (with the added benefit of static type checking).
|
|
||||||
|
|
||||||
* **Expressions** By writing a single mathematical expression once, users will be able to apply different types of
|
|
||||||
objects to the expression by providing a context. Expressions can be used for a wide variety of purposes from high
|
|
||||||
performance calculations to code generation.
|
|
||||||
|
|
||||||
* **Histograms** Fast multi-dimensional histograms.
|
<!--* **Array-like structures** Full support of many-dimensional array-like structures -->
|
||||||
|
<!--including mixed arithmetic operations and function operations over arrays and numbers (with the added benefit of static type checking).-->
|
||||||
|
|
||||||
* **Streaming** Streaming operations on mathematical objects and objects buffers.
|
<!--* **Histograms** Fast multi-dimensional histograms.-->
|
||||||
|
|
||||||
* **Type-safe dimensions** Type-safe dimensions for matrix operations.
|
<!--* **Streaming** Streaming operations on mathematical objects and objects buffers.-->
|
||||||
|
|
||||||
* **Commons-math wrapper** It is planned to gradually wrap most parts of
|
<!--* **Type-safe dimensions** Type-safe dimensions for matrix operations.-->
|
||||||
[Apache commons-math](http://commons.apache.org/proper/commons-math/) library in Kotlin code and maybe rewrite some
|
|
||||||
parts to better suit the Kotlin programming paradigm, however there is no established roadmap for that. Feel free to
|
|
||||||
submit a feature request if you want something to be implemented first.
|
|
||||||
|
|
||||||
## Planned features
|
<!--* **Commons-math wrapper** It is planned to gradually wrap most parts of -->
|
||||||
|
<!--[Apache commons-math](http://commons.apache.org/proper/commons-math/) library in Kotlin code and maybe rewrite some -->
|
||||||
|
<!--parts to better suit the Kotlin programming paradigm, however there is no established roadmap for that. Feel free to -->
|
||||||
|
<!--submit a feature request if you want something to be implemented first.-->
|
||||||
|
<!-- -->
|
||||||
|
<!--## Planned features-->
|
||||||
|
|
||||||
* **Messaging** A mathematical notation to support multi-language and multi-node communication for mathematical tasks.
|
<!--* **Messaging** A mathematical notation to support multi-language and multi-node communication for mathematical tasks.-->
|
||||||
|
|
||||||
* **Array statistics**
|
<!--* **Array statistics** -->
|
||||||
|
|
||||||
* **Integration** Univariate and multivariate integration framework.
|
<!--* **Integration** Univariate and multivariate integration framework.-->
|
||||||
|
|
||||||
* **Probability and distributions**
|
<!--* **Probability and distributions**-->
|
||||||
|
|
||||||
* **Fitting** Non-linear curve fitting facilities
|
<!--* **Fitting** Non-linear curve fitting facilities-->
|
||||||
|
|
||||||
## Modules
|
## Modules
|
||||||
|
|
||||||
@ -113,10 +110,13 @@ submit a feature request if you want something to be implemented first.
|
|||||||
> **Maturity**: DEVELOPMENT
|
> **Maturity**: DEVELOPMENT
|
||||||
>
|
>
|
||||||
> **Features:**
|
> **Features:**
|
||||||
> - [algebras](kmath-core/src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt) : Algebraic structures: contexts and elements
|
> - [algebras](kmath-core/src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt) : Algebraic structures like rings, spaces and fields.
|
||||||
> - [nd](kmath-core/src/commonMain/kotlin/kscience/kmath/nd/NDStructure.kt) : Many-dimensional structures
|
> - [nd](kmath-core/src/commonMain/kotlin/kscience/kmath/structures/NDStructure.kt) : Many-dimensional structures and operations on them.
|
||||||
|
> - [linear](kmath-core/src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt) : Basic linear algebra operations (sums, products, etc.), backed by the `Space` API. Advanced linear algebra operations like matrix inversion and LU decomposition.
|
||||||
> - [buffers](kmath-core/src/commonMain/kotlin/kscience/kmath/structures/Buffers.kt) : One-dimensional structure
|
> - [buffers](kmath-core/src/commonMain/kotlin/kscience/kmath/structures/Buffers.kt) : One-dimensional structure
|
||||||
> - [expressions](kmath-core/src/commonMain/kotlin/kscience/kmath/expressions) : Functional Expressions
|
> - [expressions](kmath-core/src/commonMain/kotlin/kscience/kmath/expressions) : By writing a single mathematical expression once, users will be able to apply different types of
|
||||||
|
objects to the expression by providing a context. Expressions can be used for a wide variety of purposes from high
|
||||||
|
performance calculations to code generation.
|
||||||
> - [domains](kmath-core/src/commonMain/kotlin/kscience/kmath/domains) : Domains
|
> - [domains](kmath-core/src/commonMain/kotlin/kscience/kmath/domains) : Domains
|
||||||
> - [autodif](kmath-core/src/commonMain/kotlin/kscience/kmath/expressions/SimpleAutoDiff.kt) : Automatic differentiation
|
> - [autodif](kmath-core/src/commonMain/kotlin/kscience/kmath/expressions/SimpleAutoDiff.kt) : Automatic differentiation
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ submit a feature request if you want something to be implemented first.
|
|||||||
* ### [kmath-ejml](kmath-ejml)
|
* ### [kmath-ejml](kmath-ejml)
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
> **Maturity**: EXPERIMENTAL
|
> **Maturity**: PROTOTYPE
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|
||||||
* ### [kmath-for-real](kmath-for-real)
|
* ### [kmath-for-real](kmath-for-real)
|
||||||
@ -155,33 +155,40 @@ One can still use generic algebras though.
|
|||||||
<hr/>
|
<hr/>
|
||||||
|
|
||||||
* ### [kmath-functions](kmath-functions)
|
* ### [kmath-functions](kmath-functions)
|
||||||
|
> Functions and interpolation
|
||||||
>
|
>
|
||||||
|
> **Maturity**: PROTOTYPE
|
||||||
>
|
>
|
||||||
> **Maturity**: EXPERIMENTAL
|
> **Features:**
|
||||||
|
> - [piecewise](kmath-functions/Piecewise functions.) : src/commonMain/kotlin/kscience/kmath/functions/Piecewise.kt
|
||||||
|
> - [polynomials](kmath-functions/Polynomial functions.) : src/commonMain/kotlin/kscience/kmath/functions/Polynomial.kt
|
||||||
|
> - [linear interpolation](kmath-functions/Linear XY interpolator.) : src/commonMain/kotlin/kscience/kmath/interpolation/LinearInterpolator.kt
|
||||||
|
> - [spline interpolation](kmath-functions/Cubic spline XY interpolator.) : src/commonMain/kotlin/kscience/kmath/interpolation/SplineInterpolator.kt
|
||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|
||||||
* ### [kmath-geometry](kmath-geometry)
|
* ### [kmath-geometry](kmath-geometry)
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
> **Maturity**: EXPERIMENTAL
|
> **Maturity**: PROTOTYPE
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|
||||||
* ### [kmath-histograms](kmath-histograms)
|
* ### [kmath-histograms](kmath-histograms)
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
> **Maturity**: EXPERIMENTAL
|
> **Maturity**: PROTOTYPE
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|
||||||
* ### [kmath-kotlingrad](kmath-kotlingrad)
|
* ### [kmath-kotlingrad](kmath-kotlingrad)
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
> **Maturity**: EXPERIMENTAL
|
> **Maturity**: PROTOTYPE
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|
||||||
* ### [kmath-memory](kmath-memory)
|
* ### [kmath-memory](kmath-memory)
|
||||||
|
> An API and basic implementation for arranging objects in a continous memory block.
|
||||||
>
|
>
|
||||||
>
|
> **Maturity**: DEVELOPMENT
|
||||||
> **Maturity**: EXPERIMENTAL
|
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|
||||||
* ### [kmath-nd4j](kmath-nd4j)
|
* ### [kmath-nd4j](kmath-nd4j)
|
||||||
@ -205,7 +212,7 @@ One can still use generic algebras though.
|
|||||||
* ### [kmath-viktor](kmath-viktor)
|
* ### [kmath-viktor](kmath-viktor)
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
> **Maturity**: EXPERIMENTAL
|
> **Maturity**: DEVELOPMENT
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|
||||||
|
|
||||||
@ -235,11 +242,12 @@ Release artifacts are accessible from bintray with following configuration (see
|
|||||||
```kotlin
|
```kotlin
|
||||||
repositories {
|
repositories {
|
||||||
maven("https://dl.bintray.com/mipt-npm/kscience")
|
maven("https://dl.bintray.com/mipt-npm/kscience")
|
||||||
|
// maven("https://dl.bintray.com/mipt-npm/dev") for dev versions
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api("kscience.kmath:kmath-core:0.2.0-dev-4")
|
api("kscience.kmath:kmath-core:0.2.0-dev-6")
|
||||||
// api("kscience.kmath:kmath-core-jvm:0.2.0-dev-4") for jvm-specific version
|
// api("kscience.kmath:kmath-core-jvm:0.2.0-dev-6") for jvm-specific version
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ plugins {
|
|||||||
id("ru.mipt.npm.project")
|
id("ru.mipt.npm.project")
|
||||||
}
|
}
|
||||||
|
|
||||||
internal val kmathVersion: String by extra("0.2.0-dev-6")
|
internal val kmathVersion: String by extra("0.2.0-dev-7")
|
||||||
internal val bintrayRepo: String by extra("kscience")
|
internal val bintrayRepo: String by extra("kscience")
|
||||||
internal val githubProject: String by extra("kmath")
|
internal val githubProject: String by extra("kmath")
|
||||||
|
|
||||||
@ -35,10 +35,6 @@ readme {
|
|||||||
readmeTemplate = file("docs/templates/README-TEMPLATE.md")
|
readmeTemplate = file("docs/templates/README-TEMPLATE.md")
|
||||||
}
|
}
|
||||||
|
|
||||||
apiValidation {
|
|
||||||
validationDisabled = true
|
|
||||||
}
|
|
||||||
|
|
||||||
ksciencePublish {
|
ksciencePublish {
|
||||||
spaceRepo = "https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven"
|
spaceRepo = "https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven"
|
||||||
}
|
}
|
54
docs/templates/README-TEMPLATE.md
vendored
54
docs/templates/README-TEMPLATE.md
vendored
@ -9,7 +9,7 @@ Bintray-dev: [ ![Download](https://api.bintray.com/packages/mipt-npm/dev/kmat
|
|||||||
|
|
||||||
# KMath
|
# KMath
|
||||||
|
|
||||||
Could be pronounced as `key-math`. The Kotlin MATHematics library was initially intended as a Kotlin-based analog to
|
Could be pronounced as `key-math`. The **K**otlin **Math**ematics library was initially intended as a Kotlin-based analog to
|
||||||
Python's NumPy library. Later we found that kotlin is much more flexible language and allows superior architecture
|
Python's NumPy library. Later we found that kotlin is much more flexible language and allows superior architecture
|
||||||
designs. In contrast to `numpy` and `scipy` it is modular and has a lightweight core. The `numpy`-like experience could
|
designs. In contrast to `numpy` and `scipy` it is modular and has a lightweight core. The `numpy`-like experience could
|
||||||
be achieved with [kmath-for-real](/kmath-for-real) extension module.
|
be achieved with [kmath-for-real](/kmath-for-real) extension module.
|
||||||
@ -32,49 +32,46 @@ be achieved with [kmath-for-real](/kmath-for-real) extension module.
|
|||||||
* Provide the best performance out of the box. We have specialized libraries for that. Need only API wrappers for them.
|
* Provide the best performance out of the box. We have specialized libraries for that. Need only API wrappers for them.
|
||||||
* Cover all cases as immediately and in one bundle. We will modularize everything and add new features gradually.
|
* Cover all cases as immediately and in one bundle. We will modularize everything and add new features gradually.
|
||||||
* Provide specialized behavior in the core. API is made generic on purpose, so one needs to specialize for types, like
|
* Provide specialized behavior in the core. API is made generic on purpose, so one needs to specialize for types, like
|
||||||
for `Double` in the core. For that we will have specialization modules like `for-real`, which will give better
|
for `Double` in the core. For that we will have specialization modules like `kmath-for-real`, which will give better
|
||||||
experience for those, who want to work with specific types.
|
experience for those, who want to work with specific types.
|
||||||
|
|
||||||
## Features
|
## Features and stability
|
||||||
|
|
||||||
Current feature list is [here](/docs/features.md)
|
KMath is a modular library. Different modules provide different features with different API stability guarantees. All core modules are released with the same version, but with different API change policy. The features are described in module definitions below. The module stability could have following levels:
|
||||||
|
|
||||||
* **Algebra**
|
* **PROTOTYPE**. On this level there are no compatibility guarantees. All methods and classes form those modules could break any moment. You can still use it, but be sure to fix the specific version.
|
||||||
* Algebraic structures like rings, spaces and fields (**TODO** add example to wiki)
|
* **EXPERIMENTAL**. The general API is decided, but some changes could be made. Volatile API is marked with `@UnstableKmathAPI` or other stability warning annotations.
|
||||||
* Basic linear algebra operations (sums, products, etc.), backed by the `Space` API.
|
* **DEVELOPMENT**. API breaking genrally follows semantic versioning ideology. There could be changes in minor versions, but not in patch versions. API is protected with [binary-compatibility-validator](https://github.com/Kotlin/binary-compatibility-validator) tool.
|
||||||
* Complex numbers backed by the `Field` API (meaning they will be usable in any structure like vectors and
|
* **STABLE**. The API stabilized. Breaking changes are allowed only in major releases.
|
||||||
N-dimensional arrays).
|
|
||||||
* Advanced linear algebra operations like matrix inversion and LU decomposition.
|
|
||||||
|
|
||||||
* **Array-like structures** Full support of many-dimensional array-like structures
|
<!--Current feature list is [here](/docs/features.md)-->
|
||||||
including mixed arithmetic operations and function operations over arrays and numbers (with the added benefit of static type checking).
|
|
||||||
|
|
||||||
* **Expressions** By writing a single mathematical expression once, users will be able to apply different types of
|
|
||||||
objects to the expression by providing a context. Expressions can be used for a wide variety of purposes from high
|
|
||||||
performance calculations to code generation.
|
|
||||||
|
|
||||||
* **Histograms** Fast multi-dimensional histograms.
|
<!--* **Array-like structures** Full support of many-dimensional array-like structures -->
|
||||||
|
<!--including mixed arithmetic operations and function operations over arrays and numbers (with the added benefit of static type checking).-->
|
||||||
|
|
||||||
* **Streaming** Streaming operations on mathematical objects and objects buffers.
|
<!--* **Histograms** Fast multi-dimensional histograms.-->
|
||||||
|
|
||||||
* **Type-safe dimensions** Type-safe dimensions for matrix operations.
|
<!--* **Streaming** Streaming operations on mathematical objects and objects buffers.-->
|
||||||
|
|
||||||
* **Commons-math wrapper** It is planned to gradually wrap most parts of
|
<!--* **Type-safe dimensions** Type-safe dimensions for matrix operations.-->
|
||||||
[Apache commons-math](http://commons.apache.org/proper/commons-math/) library in Kotlin code and maybe rewrite some
|
|
||||||
parts to better suit the Kotlin programming paradigm, however there is no established roadmap for that. Feel free to
|
|
||||||
submit a feature request if you want something to be implemented first.
|
|
||||||
|
|
||||||
## Planned features
|
<!--* **Commons-math wrapper** It is planned to gradually wrap most parts of -->
|
||||||
|
<!--[Apache commons-math](http://commons.apache.org/proper/commons-math/) library in Kotlin code and maybe rewrite some -->
|
||||||
|
<!--parts to better suit the Kotlin programming paradigm, however there is no established roadmap for that. Feel free to -->
|
||||||
|
<!--submit a feature request if you want something to be implemented first.-->
|
||||||
|
<!-- -->
|
||||||
|
<!--## Planned features-->
|
||||||
|
|
||||||
* **Messaging** A mathematical notation to support multi-language and multi-node communication for mathematical tasks.
|
<!--* **Messaging** A mathematical notation to support multi-language and multi-node communication for mathematical tasks.-->
|
||||||
|
|
||||||
* **Array statistics**
|
<!--* **Array statistics** -->
|
||||||
|
|
||||||
* **Integration** Univariate and multivariate integration framework.
|
<!--* **Integration** Univariate and multivariate integration framework.-->
|
||||||
|
|
||||||
* **Probability and distributions**
|
<!--* **Probability and distributions**-->
|
||||||
|
|
||||||
* **Fitting** Non-linear curve fitting facilities
|
<!--* **Fitting** Non-linear curve fitting facilities-->
|
||||||
|
|
||||||
## Modules
|
## Modules
|
||||||
|
|
||||||
@ -106,6 +103,7 @@ Release artifacts are accessible from bintray with following configuration (see
|
|||||||
```kotlin
|
```kotlin
|
||||||
repositories {
|
repositories {
|
||||||
maven("https://dl.bintray.com/mipt-npm/kscience")
|
maven("https://dl.bintray.com/mipt-npm/kscience")
|
||||||
|
// maven("https://dl.bintray.com/mipt-npm/dev") for dev versions
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
@ -87,3 +87,7 @@ kotlin.sourceSets.all {
|
|||||||
tasks.withType<KotlinCompile> {
|
tasks.withType<KotlinCompile> {
|
||||||
kotlinOptions.jvmTarget = "11"
|
kotlinOptions.jvmTarget = "11"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readme{
|
||||||
|
maturity = ru.mipt.npm.gradle.Maturity.EXPERIMENTAL
|
||||||
|
}
|
||||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
@ -12,7 +12,7 @@ This subproject implements the following features:
|
|||||||
|
|
||||||
> #### Artifact:
|
> #### Artifact:
|
||||||
>
|
>
|
||||||
> This module artifact: `kscience.kmath:kmath-ast:0.2.0-dev-4`.
|
> This module artifact: `kscience.kmath:kmath-ast:0.2.0-dev-6`.
|
||||||
>
|
>
|
||||||
> Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-ast/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-ast/_latestVersion)
|
> Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-ast/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-ast/_latestVersion)
|
||||||
>
|
>
|
||||||
@ -30,7 +30,7 @@ This subproject implements the following features:
|
|||||||
> }
|
> }
|
||||||
>
|
>
|
||||||
> dependencies {
|
> dependencies {
|
||||||
> implementation 'kscience.kmath:kmath-ast:0.2.0-dev-4'
|
> implementation 'kscience.kmath:kmath-ast:0.2.0-dev-6'
|
||||||
> }
|
> }
|
||||||
> ```
|
> ```
|
||||||
> **Gradle Kotlin DSL:**
|
> **Gradle Kotlin DSL:**
|
||||||
@ -44,7 +44,7 @@ This subproject implements the following features:
|
|||||||
> }
|
> }
|
||||||
>
|
>
|
||||||
> dependencies {
|
> dependencies {
|
||||||
> implementation("kscience.kmath:kmath-ast:0.2.0-dev-4")
|
> implementation("kscience.kmath:kmath-ast:0.2.0-dev-6")
|
||||||
> }
|
> }
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ For example, the following builder:
|
|||||||
RealField.mstInField { symbol("x") + 2 }.compile()
|
RealField.mstInField { symbol("x") + 2 }.compile()
|
||||||
```
|
```
|
||||||
|
|
||||||
… leads to generation of bytecode, which can be decompiled to the following Java class:
|
… leads to generation of bytecode, which can be decompiled to the following Java class:
|
||||||
|
|
||||||
```java
|
```java
|
||||||
package kscience.kmath.asm.generated;
|
package kscience.kmath.asm.generated;
|
||||||
|
@ -10,3 +10,7 @@ dependencies {
|
|||||||
api(project(":kmath-functions"))
|
api(project(":kmath-functions"))
|
||||||
api("org.apache.commons:commons-math3:3.6.1")
|
api("org.apache.commons:commons-math3:3.6.1")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readme{
|
||||||
|
maturity = ru.mipt.npm.gradle.Maturity.EXPERIMENTAL
|
||||||
|
}
|
@ -2,17 +2,20 @@
|
|||||||
|
|
||||||
The core features of KMath:
|
The core features of KMath:
|
||||||
|
|
||||||
- [algebras](src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt) : Algebraic structures: contexts and elements
|
- [algebras](src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt) : Algebraic structures like rings, spaces and fields.
|
||||||
- [nd](src/commonMain/kotlin/kscience/kmath/nd/NDStructure.kt) : Many-dimensional structures
|
- [nd](src/commonMain/kotlin/kscience/kmath/structures/NDStructure.kt) : Many-dimensional structures and operations on them.
|
||||||
|
- [linear](src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt) : Basic linear algebra operations (sums, products, etc.), backed by the `Space` API. Advanced linear algebra operations like matrix inversion and LU decomposition.
|
||||||
- [buffers](src/commonMain/kotlin/kscience/kmath/structures/Buffers.kt) : One-dimensional structure
|
- [buffers](src/commonMain/kotlin/kscience/kmath/structures/Buffers.kt) : One-dimensional structure
|
||||||
- [expressions](src/commonMain/kotlin/kscience/kmath/expressions) : Functional Expressions
|
- [expressions](src/commonMain/kotlin/kscience/kmath/expressions) : By writing a single mathematical expression once, users will be able to apply different types of
|
||||||
|
objects to the expression by providing a context. Expressions can be used for a wide variety of purposes from high
|
||||||
|
performance calculations to code generation.
|
||||||
- [domains](src/commonMain/kotlin/kscience/kmath/domains) : Domains
|
- [domains](src/commonMain/kotlin/kscience/kmath/domains) : Domains
|
||||||
- [autodif](src/commonMain/kotlin/kscience/kmath/expressions/SimpleAutoDiff.kt) : Automatic differentiation
|
- [autodif](src/commonMain/kotlin/kscience/kmath/expressions/SimpleAutoDiff.kt) : Automatic differentiation
|
||||||
|
|
||||||
|
|
||||||
> #### Artifact:
|
> #### Artifact:
|
||||||
>
|
>
|
||||||
> This module artifact: `kscience.kmath:kmath-core:0.2.0-dev-4`.
|
> This module artifact: `kscience.kmath:kmath-core:0.2.0-dev-6`.
|
||||||
>
|
>
|
||||||
> Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-core/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-core/_latestVersion)
|
> Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-core/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-core/_latestVersion)
|
||||||
>
|
>
|
||||||
@ -30,7 +33,7 @@ The core features of KMath:
|
|||||||
> }
|
> }
|
||||||
>
|
>
|
||||||
> dependencies {
|
> dependencies {
|
||||||
> implementation 'kscience.kmath:kmath-core:0.2.0-dev-4'
|
> implementation 'kscience.kmath:kmath-core:0.2.0-dev-6'
|
||||||
> }
|
> }
|
||||||
> ```
|
> ```
|
||||||
> **Gradle Kotlin DSL:**
|
> **Gradle Kotlin DSL:**
|
||||||
@ -44,6 +47,6 @@ The core features of KMath:
|
|||||||
> }
|
> }
|
||||||
>
|
>
|
||||||
> dependencies {
|
> dependencies {
|
||||||
> implementation("kscience.kmath:kmath-core:0.2.0-dev-4")
|
> implementation("kscience.kmath:kmath-core:0.2.0-dev-6")
|
||||||
> }
|
> }
|
||||||
> ```
|
> ```
|
||||||
|
3221
kmath-core/api/kmath-core.api
Normal file
3221
kmath-core/api/kmath-core.api
Normal file
File diff suppressed because it is too large
Load Diff
@ -16,16 +16,26 @@ readme {
|
|||||||
|
|
||||||
feature(
|
feature(
|
||||||
id = "algebras",
|
id = "algebras",
|
||||||
description = "Algebraic structures: contexts and elements",
|
description = """
|
||||||
|
Algebraic structures like rings, spaces and fields.
|
||||||
|
""".trimIndent(),
|
||||||
ref = "src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt"
|
ref = "src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt"
|
||||||
)
|
)
|
||||||
|
|
||||||
feature(
|
feature(
|
||||||
id = "nd",
|
id = "nd",
|
||||||
description = "Many-dimensional structures",
|
description = "Many-dimensional structures and operations on them.",
|
||||||
ref = "src/commonMain/kotlin/kscience/kmath/structures/NDStructure.kt"
|
ref = "src/commonMain/kotlin/kscience/kmath/structures/NDStructure.kt"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
feature(
|
||||||
|
id = "linear",
|
||||||
|
description = """
|
||||||
|
Basic linear algebra operations (sums, products, etc.), backed by the `Space` API. Advanced linear algebra operations like matrix inversion and LU decomposition.
|
||||||
|
""".trimIndent(),
|
||||||
|
ref = "src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt"
|
||||||
|
)
|
||||||
|
|
||||||
feature(
|
feature(
|
||||||
id = "buffers",
|
id = "buffers",
|
||||||
description = "One-dimensional structure",
|
description = "One-dimensional structure",
|
||||||
@ -34,7 +44,11 @@ readme {
|
|||||||
|
|
||||||
feature(
|
feature(
|
||||||
id = "expressions",
|
id = "expressions",
|
||||||
description = "Functional Expressions",
|
description = """
|
||||||
|
By writing a single mathematical expression once, users will be able to apply different types of
|
||||||
|
objects to the expression by providing a context. Expressions can be used for a wide variety of purposes from high
|
||||||
|
performance calculations to code generation.
|
||||||
|
""".trimIndent(),
|
||||||
ref = "src/commonMain/kotlin/kscience/kmath/expressions"
|
ref = "src/commonMain/kotlin/kscience/kmath/expressions"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ package kscience.kmath.expressions
|
|||||||
import kscience.kmath.operations.Algebra
|
import kscience.kmath.operations.Algebra
|
||||||
import kotlin.jvm.JvmName
|
import kotlin.jvm.JvmName
|
||||||
import kotlin.properties.ReadOnlyProperty
|
import kotlin.properties.ReadOnlyProperty
|
||||||
import kotlin.reflect.KProperty
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A marker interface for a symbol. A symbol mus have an identity
|
* A marker interface for a symbol. A symbol mus have an identity
|
||||||
@ -13,13 +12,6 @@ public interface Symbol {
|
|||||||
* Identity object for the symbol. Two symbols with the same identity are considered to be the same symbol.
|
* Identity object for the symbol. Two symbols with the same identity are considered to be the same symbol.
|
||||||
*/
|
*/
|
||||||
public val identity: String
|
public val identity: String
|
||||||
|
|
||||||
public companion object : ReadOnlyProperty<Any?, Symbol> {
|
|
||||||
//TODO deprecate and replace by top level function after fix of https://youtrack.jetbrains.com/issue/KT-40121
|
|
||||||
override fun getValue(thisRef: Any?, property: KProperty<*>): Symbol {
|
|
||||||
return StringSymbol(property.name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -103,9 +95,9 @@ public fun <T, E> ExpressionAlgebra<T, E>.bind(symbol: Symbol): E =
|
|||||||
/**
|
/**
|
||||||
* A delegate to create a symbol with a string identity in this scope
|
* A delegate to create a symbol with a string identity in this scope
|
||||||
*/
|
*/
|
||||||
public val symbol: ReadOnlyProperty<Any?, Symbol> get() = Symbol
|
public val symbol: ReadOnlyProperty<Any?, Symbol> = ReadOnlyProperty { _, property ->
|
||||||
//TODO does not work directly on native due to https://youtrack.jetbrains.com/issue/KT-40121
|
StringSymbol(property.name)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bind a symbol by name inside the [ExpressionAlgebra]
|
* Bind a symbol by name inside the [ExpressionAlgebra]
|
||||||
|
@ -162,7 +162,7 @@ public interface SpaceOperations<T> : Algebra<T> {
|
|||||||
* @param k the multiplicand.
|
* @param k the multiplicand.
|
||||||
* @return the product.
|
* @return the product.
|
||||||
*/
|
*/
|
||||||
public operator fun T.times(k: Number): T = multiply(this, k.toDouble())
|
public operator fun T.times(k: Number): T = multiply(this, k)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Division of this element by scalar.
|
* Division of this element by scalar.
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
package kscience.kmath.operations
|
package kscience.kmath.operations
|
||||||
|
|
||||||
|
import kscience.kmath.misc.UnstableKMathAPI
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The generic mathematics elements which is able to store its context
|
* The generic mathematics elements which is able to store its context
|
||||||
*
|
*
|
||||||
* @param C the type of mathematical context for this element.
|
* @param C the type of mathematical context for this element.
|
||||||
|
* @param T the type wrapped by this wrapper.
|
||||||
*/
|
*/
|
||||||
public interface MathElement<C> {
|
public interface AlgebraElement<T, C : Algebra<T>> {
|
||||||
/**
|
/**
|
||||||
* The context this element belongs to.
|
* The context this element belongs to.
|
||||||
*/
|
*/
|
||||||
@ -13,22 +16,67 @@ public interface MathElement<C> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents element that can be wrapped to its "primitive" value.
|
* Divides this element by number.
|
||||||
*
|
*
|
||||||
* @param T the type wrapped by this wrapper.
|
* @param k the divisor.
|
||||||
* @param I the type of this wrapper.
|
* @return the quotient.
|
||||||
*/
|
*/
|
||||||
public interface MathWrapper<T, I> {
|
public operator fun <T : AlgebraElement<T, S>, S : Space<T>> T.div(k: Number): T =
|
||||||
/**
|
context.multiply(this, 1.0 / k.toDouble())
|
||||||
* Unwraps [I] to [T].
|
|
||||||
*/
|
/**
|
||||||
public fun unwrap(): T
|
* Multiplies this element by number.
|
||||||
|
*
|
||||||
|
* @param k the multiplicand.
|
||||||
|
* @return the product.
|
||||||
|
*/
|
||||||
|
public operator fun <T : AlgebraElement<T, S>, S : Space<T>> T.times(k: Number): T =
|
||||||
|
context.multiply(this, k.toDouble())
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subtracts element from this one.
|
||||||
|
*
|
||||||
|
* @param b the subtrahend.
|
||||||
|
* @return the difference.
|
||||||
|
*/
|
||||||
|
public operator fun <T : AlgebraElement<T, S>, S : Space<T>> T.minus(b: T): T =
|
||||||
|
context.add(this, context.multiply(b, -1.0))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds element to this one.
|
||||||
|
*
|
||||||
|
* @param b the augend.
|
||||||
|
* @return the sum.
|
||||||
|
*/
|
||||||
|
public operator fun <T : AlgebraElement<T, S>, S : Space<T>> T.plus(b: T): T =
|
||||||
|
context.add(this, b)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number times element
|
||||||
|
*/
|
||||||
|
public operator fun <T : AlgebraElement<T, S>, S : Space<T>> Number.times(element: T): T =
|
||||||
|
element.times(this)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Multiplies this element by another one.
|
||||||
|
*
|
||||||
|
* @param b the multiplicand.
|
||||||
|
* @return the product.
|
||||||
|
*/
|
||||||
|
public operator fun <T : AlgebraElement<T, R>, R : Ring<T>> T.times(b: T): T =
|
||||||
|
context.multiply(this, b)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Divides this element by another one.
|
||||||
|
*
|
||||||
|
* @param b the divisor.
|
||||||
|
* @return the quotient.
|
||||||
|
*/
|
||||||
|
public operator fun <T : AlgebraElement<T, F>, F : Field<T>> T.div(b: T): T =
|
||||||
|
context.divide(this, b)
|
||||||
|
|
||||||
/**
|
|
||||||
* Wraps [T] to [I].
|
|
||||||
*/
|
|
||||||
public fun T.wrap(): I
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The element of [Space].
|
* The element of [Space].
|
||||||
@ -37,39 +85,8 @@ public interface MathWrapper<T, I> {
|
|||||||
* @param I self type of the element. Needed for static type checking.
|
* @param I self type of the element. Needed for static type checking.
|
||||||
* @param S the type of space.
|
* @param S the type of space.
|
||||||
*/
|
*/
|
||||||
public interface SpaceElement<T, I : SpaceElement<T, I, S>, S : Space<T>> : MathElement<S>, MathWrapper<T, I> {
|
@UnstableKMathAPI
|
||||||
/**
|
public interface SpaceElement<T : SpaceElement<T, S>, S : Space<T>> : AlgebraElement<T, S>
|
||||||
* Adds element to this one.
|
|
||||||
*
|
|
||||||
* @param b the augend.
|
|
||||||
* @return the sum.
|
|
||||||
*/
|
|
||||||
public operator fun plus(b: T): I = context.add(unwrap(), b).wrap()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Subtracts element from this one.
|
|
||||||
*
|
|
||||||
* @param b the subtrahend.
|
|
||||||
* @return the difference.
|
|
||||||
*/
|
|
||||||
public operator fun minus(b: T): I = context.add(unwrap(), context.multiply(b, -1.0)).wrap()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Multiplies this element by number.
|
|
||||||
*
|
|
||||||
* @param k the multiplicand.
|
|
||||||
* @return the product.
|
|
||||||
*/
|
|
||||||
public operator fun times(k: Number): I = context.multiply(unwrap(), k.toDouble()).wrap()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Divides this element by number.
|
|
||||||
*
|
|
||||||
* @param k the divisor.
|
|
||||||
* @return the quotient.
|
|
||||||
*/
|
|
||||||
public operator fun div(k: Number): I = context.multiply(unwrap(), 1.0 / k.toDouble()).wrap()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The element of [Ring].
|
* The element of [Ring].
|
||||||
@ -78,15 +95,8 @@ public interface SpaceElement<T, I : SpaceElement<T, I, S>, S : Space<T>> : Math
|
|||||||
* @param I self type of the element. Needed for static type checking.
|
* @param I self type of the element. Needed for static type checking.
|
||||||
* @param R the type of ring.
|
* @param R the type of ring.
|
||||||
*/
|
*/
|
||||||
public interface RingElement<T, I : RingElement<T, I, R>, R : Ring<T>> : SpaceElement<T, I, R> {
|
@UnstableKMathAPI
|
||||||
/**
|
public interface RingElement<T : RingElement<T, R>, R : Ring<T>> : SpaceElement<T, R>
|
||||||
* Multiplies this element by another one.
|
|
||||||
*
|
|
||||||
* @param b the multiplicand.
|
|
||||||
* @return the product.
|
|
||||||
*/
|
|
||||||
public operator fun times(b: T): I = context.multiply(unwrap(), b).wrap()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The element of [Field].
|
* The element of [Field].
|
||||||
@ -95,14 +105,5 @@ public interface RingElement<T, I : RingElement<T, I, R>, R : Ring<T>> : SpaceEl
|
|||||||
* @param I self type of the element. Needed for static type checking.
|
* @param I self type of the element. Needed for static type checking.
|
||||||
* @param F the type of field.
|
* @param F the type of field.
|
||||||
*/
|
*/
|
||||||
public interface FieldElement<T, I : FieldElement<T, I, F>, F : Field<T>> : RingElement<T, I, F> {
|
@UnstableKMathAPI
|
||||||
override val context: F
|
public interface FieldElement<T : FieldElement<T, F>, F : Field<T>> : RingElement<T, F>
|
||||||
|
|
||||||
/**
|
|
||||||
* Divides this element by another one.
|
|
||||||
*
|
|
||||||
* @param b the divisor.
|
|
||||||
* @return the quotient.
|
|
||||||
*/
|
|
||||||
public operator fun div(b: T): I = context.divide(unwrap(), b).wrap()
|
|
||||||
}
|
|
@ -167,16 +167,15 @@ public object ComplexField : ExtendedField<Complex>, Norm<Complex, Complex>, Rin
|
|||||||
* @property re The real part.
|
* @property re The real part.
|
||||||
* @property im The imaginary part.
|
* @property im The imaginary part.
|
||||||
*/
|
*/
|
||||||
public data class Complex(val re: Double, val im: Double) : FieldElement<Complex, Complex, ComplexField>,
|
@OptIn(UnstableKMathAPI::class)
|
||||||
Comparable<Complex> {
|
public data class Complex(
|
||||||
|
val re: Double,
|
||||||
|
val im: Double,
|
||||||
|
) : FieldElement<Complex, ComplexField>, Comparable<Complex> {
|
||||||
public constructor(re: Number, im: Number) : this(re.toDouble(), im.toDouble())
|
public constructor(re: Number, im: Number) : this(re.toDouble(), im.toDouble())
|
||||||
|
|
||||||
override val context: ComplexField get() = ComplexField
|
override val context: ComplexField get() = ComplexField
|
||||||
|
|
||||||
override fun unwrap(): Complex = this
|
|
||||||
|
|
||||||
override fun Complex.wrap(): Complex = this
|
|
||||||
|
|
||||||
override fun compareTo(other: Complex): Int = r.compareTo(other.r)
|
override fun compareTo(other: Complex): Int = r.compareTo(other.r)
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package kscience.kmath.operations
|
package kscience.kmath.operations
|
||||||
|
|
||||||
|
import kscience.kmath.misc.UnstableKMathAPI
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A container for trigonometric operations for specific type.
|
* A container for trigonometric operations for specific type.
|
||||||
*
|
*
|
||||||
@ -72,32 +74,38 @@ public interface TrigonometricOperations<T> : Algebra<T> {
|
|||||||
/**
|
/**
|
||||||
* Computes the sine of [arg].
|
* Computes the sine of [arg].
|
||||||
*/
|
*/
|
||||||
public fun <T : MathElement<out TrigonometricOperations<T>>> sin(arg: T): T = arg.context.sin(arg)
|
@UnstableKMathAPI
|
||||||
|
public fun <T : AlgebraElement<T, out TrigonometricOperations<T>>> sin(arg: T): T = arg.context.sin(arg)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Computes the cosine of [arg].
|
* Computes the cosine of [arg].
|
||||||
*/
|
*/
|
||||||
public fun <T : MathElement<out TrigonometricOperations<T>>> cos(arg: T): T = arg.context.cos(arg)
|
@UnstableKMathAPI
|
||||||
|
public fun <T : AlgebraElement<T, out TrigonometricOperations<T>>> cos(arg: T): T = arg.context.cos(arg)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Computes the tangent of [arg].
|
* Computes the tangent of [arg].
|
||||||
*/
|
*/
|
||||||
public fun <T : MathElement<out TrigonometricOperations<T>>> tan(arg: T): T = arg.context.tan(arg)
|
@UnstableKMathAPI
|
||||||
|
public fun <T : AlgebraElement<T, out TrigonometricOperations<T>>> tan(arg: T): T = arg.context.tan(arg)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Computes the inverse sine of [arg].
|
* Computes the inverse sine of [arg].
|
||||||
*/
|
*/
|
||||||
public fun <T : MathElement<out TrigonometricOperations<T>>> asin(arg: T): T = arg.context.asin(arg)
|
@UnstableKMathAPI
|
||||||
|
public fun <T : AlgebraElement<T, out TrigonometricOperations<T>>> asin(arg: T): T = arg.context.asin(arg)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Computes the inverse cosine of [arg].
|
* Computes the inverse cosine of [arg].
|
||||||
*/
|
*/
|
||||||
public fun <T : MathElement<out TrigonometricOperations<T>>> acos(arg: T): T = arg.context.acos(arg)
|
@UnstableKMathAPI
|
||||||
|
public fun <T : AlgebraElement<T, out TrigonometricOperations<T>>> acos(arg: T): T = arg.context.acos(arg)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Computes the inverse tangent of [arg].
|
* Computes the inverse tangent of [arg].
|
||||||
*/
|
*/
|
||||||
public fun <T : MathElement<out TrigonometricOperations<T>>> atan(arg: T): T = arg.context.atan(arg)
|
@UnstableKMathAPI
|
||||||
|
public fun <T : AlgebraElement<T, out TrigonometricOperations<T>>> atan(arg: T): T = arg.context.atan(arg)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A container for hyperbolic trigonometric operations for specific type.
|
* A container for hyperbolic trigonometric operations for specific type.
|
||||||
@ -171,32 +179,38 @@ public interface HyperbolicOperations<T> : Algebra<T> {
|
|||||||
/**
|
/**
|
||||||
* Computes the hyperbolic sine of [arg].
|
* Computes the hyperbolic sine of [arg].
|
||||||
*/
|
*/
|
||||||
public fun <T : MathElement<out HyperbolicOperations<T>>> sinh(arg: T): T = arg.context.sinh(arg)
|
@UnstableKMathAPI
|
||||||
|
public fun <T : AlgebraElement<T, out HyperbolicOperations<T>>> sinh(arg: T): T = arg.context.sinh(arg)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Computes the hyperbolic cosine of [arg].
|
* Computes the hyperbolic cosine of [arg].
|
||||||
*/
|
*/
|
||||||
public fun <T : MathElement<out HyperbolicOperations<T>>> cosh(arg: T): T = arg.context.cosh(arg)
|
@UnstableKMathAPI
|
||||||
|
public fun <T : AlgebraElement<T, out HyperbolicOperations<T>>> cosh(arg: T): T = arg.context.cosh(arg)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Computes the hyperbolic tangent of [arg].
|
* Computes the hyperbolic tangent of [arg].
|
||||||
*/
|
*/
|
||||||
public fun <T : MathElement<out HyperbolicOperations<T>>> tanh(arg: T): T = arg.context.tanh(arg)
|
@UnstableKMathAPI
|
||||||
|
public fun <T : AlgebraElement<T, out HyperbolicOperations<T>>> tanh(arg: T): T = arg.context.tanh(arg)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Computes the inverse hyperbolic sine of [arg].
|
* Computes the inverse hyperbolic sine of [arg].
|
||||||
*/
|
*/
|
||||||
public fun <T : MathElement<out HyperbolicOperations<T>>> asinh(arg: T): T = arg.context.asinh(arg)
|
@UnstableKMathAPI
|
||||||
|
public fun <T : AlgebraElement<T, out HyperbolicOperations<T>>> asinh(arg: T): T = arg.context.asinh(arg)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Computes the inverse hyperbolic cosine of [arg].
|
* Computes the inverse hyperbolic cosine of [arg].
|
||||||
*/
|
*/
|
||||||
public fun <T : MathElement<out HyperbolicOperations<T>>> acosh(arg: T): T = arg.context.acosh(arg)
|
@UnstableKMathAPI
|
||||||
|
public fun <T : AlgebraElement<T, out HyperbolicOperations<T>>> acosh(arg: T): T = arg.context.acosh(arg)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Computes the inverse hyperbolic tangent of [arg].
|
* Computes the inverse hyperbolic tangent of [arg].
|
||||||
*/
|
*/
|
||||||
public fun <T : MathElement<out HyperbolicOperations<T>>> atanh(arg: T): T = arg.context.atanh(arg)
|
@UnstableKMathAPI
|
||||||
|
public fun <T : AlgebraElement<T, out HyperbolicOperations<T>>> atanh(arg: T): T = arg.context.atanh(arg)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A context extension to include power operations based on exponentiation.
|
* A context extension to include power operations based on exponentiation.
|
||||||
@ -239,17 +253,20 @@ public interface PowerOperations<T> : Algebra<T> {
|
|||||||
* @param power the exponent.
|
* @param power the exponent.
|
||||||
* @return the base raised to the power.
|
* @return the base raised to the power.
|
||||||
*/
|
*/
|
||||||
public infix fun <T : MathElement<out PowerOperations<T>>> T.pow(power: Double): T = context.power(this, power)
|
@UnstableKMathAPI
|
||||||
|
public infix fun <T : AlgebraElement<T, out PowerOperations<T>>> T.pow(power: Double): T = context.power(this, power)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Computes the square root of the value [arg].
|
* Computes the square root of the value [arg].
|
||||||
*/
|
*/
|
||||||
public fun <T : MathElement<out PowerOperations<T>>> sqrt(arg: T): T = arg pow 0.5
|
@UnstableKMathAPI
|
||||||
|
public fun <T : AlgebraElement<T, out PowerOperations<T>>> sqrt(arg: T): T = arg pow 0.5
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Computes the square of the value [arg].
|
* Computes the square of the value [arg].
|
||||||
*/
|
*/
|
||||||
public fun <T : MathElement<out PowerOperations<T>>> sqr(arg: T): T = arg pow 2.0
|
@UnstableKMathAPI
|
||||||
|
public fun <T : AlgebraElement<T, out PowerOperations<T>>> sqr(arg: T): T = arg pow 2.0
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A container for operations related to `exp` and `ln` functions.
|
* A container for operations related to `exp` and `ln` functions.
|
||||||
@ -283,12 +300,14 @@ public interface ExponentialOperations<T> : Algebra<T> {
|
|||||||
/**
|
/**
|
||||||
* The identifier of exponential function.
|
* The identifier of exponential function.
|
||||||
*/
|
*/
|
||||||
public fun <T : MathElement<out ExponentialOperations<T>>> exp(arg: T): T = arg.context.exp(arg)
|
@UnstableKMathAPI
|
||||||
|
public fun <T : AlgebraElement<T, out ExponentialOperations<T>>> exp(arg: T): T = arg.context.exp(arg)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The identifier of natural logarithm.
|
* The identifier of natural logarithm.
|
||||||
*/
|
*/
|
||||||
public fun <T : MathElement<out ExponentialOperations<T>>> ln(arg: T): T = arg.context.ln(arg)
|
@UnstableKMathAPI
|
||||||
|
public fun <T : AlgebraElement<T, out ExponentialOperations<T>>> ln(arg: T): T = arg.context.ln(arg)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A container for norm functional on element.
|
* A container for norm functional on element.
|
||||||
@ -306,4 +325,5 @@ public interface Norm<in T : Any, out R> {
|
|||||||
/**
|
/**
|
||||||
* Computes the norm of [arg] (i.e. absolute value or vector length).
|
* Computes the norm of [arg] (i.e. absolute value or vector length).
|
||||||
*/
|
*/
|
||||||
public fun <T : MathElement<out Norm<T, R>>, R> norm(arg: T): R = arg.context.norm(arg)
|
@UnstableKMathAPI
|
||||||
|
public fun <T : AlgebraElement<T, out Norm<T, R>>, R> norm(arg: T): R = arg.context.norm(arg)
|
||||||
|
@ -52,23 +52,6 @@ public interface ExtendedField<T> : ExtendedFieldOperations<T>, Field<T>, Numeri
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Real field element wrapping double.
|
|
||||||
*
|
|
||||||
* @property value the [Double] value wrapped by this [Real].
|
|
||||||
*
|
|
||||||
* TODO inline does not work due to compiler bug. Waiting for fix for KT-27586
|
|
||||||
*/
|
|
||||||
public inline class Real(public val value: Double) : FieldElement<Double, Real, RealField> {
|
|
||||||
public override val context: RealField
|
|
||||||
get() = RealField
|
|
||||||
|
|
||||||
public override fun unwrap(): Double = value
|
|
||||||
public override fun Double.wrap(): Real = Real(value)
|
|
||||||
|
|
||||||
public companion object
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A field for [Double] without boxing. Does not produce appropriate field element.
|
* A field for [Double] without boxing. Does not produce appropriate field element.
|
||||||
*/
|
*/
|
||||||
|
@ -16,3 +16,7 @@ kotlin.sourceSets {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readme{
|
||||||
|
maturity = ru.mipt.npm.gradle.Maturity.EXPERIMENTAL
|
||||||
|
}
|
@ -6,3 +6,7 @@ dependencies {
|
|||||||
implementation("org.ejml:ejml-simple:0.39")
|
implementation("org.ejml:ejml-simple:0.39")
|
||||||
implementation(project(":kmath-core"))
|
implementation(project(":kmath-core"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readme{
|
||||||
|
maturity = ru.mipt.npm.gradle.Maturity.PROTOTYPE
|
||||||
|
}
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
> #### Artifact:
|
> #### Artifact:
|
||||||
>
|
>
|
||||||
> This module artifact: `kscience.kmath:kmath-for-real:0.2.0-dev-4`.
|
> This module artifact: `kscience.kmath:kmath-for-real:0.2.0-dev-6`.
|
||||||
>
|
>
|
||||||
> Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-for-real/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-for-real/_latestVersion)
|
> Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-for-real/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-for-real/_latestVersion)
|
||||||
>
|
>
|
||||||
@ -25,7 +25,7 @@
|
|||||||
> }
|
> }
|
||||||
>
|
>
|
||||||
> dependencies {
|
> dependencies {
|
||||||
> implementation 'kscience.kmath:kmath-for-real:0.2.0-dev-4'
|
> implementation 'kscience.kmath:kmath-for-real:0.2.0-dev-6'
|
||||||
> }
|
> }
|
||||||
> ```
|
> ```
|
||||||
> **Gradle Kotlin DSL:**
|
> **Gradle Kotlin DSL:**
|
||||||
@ -39,6 +39,6 @@
|
|||||||
> }
|
> }
|
||||||
>
|
>
|
||||||
> dependencies {
|
> dependencies {
|
||||||
> implementation("kscience.kmath:kmath-for-real:0.2.0-dev-4")
|
> implementation("kscience.kmath:kmath-for-real:0.2.0-dev-6")
|
||||||
> }
|
> }
|
||||||
> ```
|
> ```
|
||||||
|
@ -29,8 +29,10 @@ public inline fun RealVector.map(transform: (Double) -> Double): RealVector =
|
|||||||
public inline fun RealVector.mapIndexed(transform: (index: Int, value: Double) -> Double): RealVector =
|
public inline fun RealVector.mapIndexed(transform: (index: Int, value: Double) -> Double): RealVector =
|
||||||
Buffer.real(size) { transform(it, get(it)) }
|
Buffer.real(size) { transform(it, get(it)) }
|
||||||
|
|
||||||
public operator fun RealVector.plus(other: RealVector): RealVector =
|
public operator fun RealVector.plus(other: RealVector): RealVector {
|
||||||
mapIndexed { index, value -> value + other[index] }
|
require(size == other.size){"Vector size $size expected but ${other.size} found"}
|
||||||
|
return mapIndexed { index, value -> value + other[index] }
|
||||||
|
}
|
||||||
|
|
||||||
public operator fun RealVector.plus(number: Number): RealVector = map { it + number.toDouble() }
|
public operator fun RealVector.plus(number: Number): RealVector = map { it + number.toDouble() }
|
||||||
|
|
||||||
@ -38,22 +40,28 @@ public operator fun Number.plus(vector: RealVector): RealVector = vector + this
|
|||||||
|
|
||||||
public operator fun RealVector.unaryMinus(): Buffer<Double> = map { -it }
|
public operator fun RealVector.unaryMinus(): Buffer<Double> = map { -it }
|
||||||
|
|
||||||
public operator fun RealVector.minus(other: RealVector): RealVector =
|
public operator fun RealVector.minus(other: RealVector): RealVector {
|
||||||
mapIndexed { index, value -> value - other[index] }
|
require(size == other.size){"Vector size $size expected but ${other.size} found"}
|
||||||
|
return mapIndexed { index, value -> value - other[index] }
|
||||||
|
}
|
||||||
|
|
||||||
public operator fun RealVector.minus(number: Number): RealVector = map { it - number.toDouble() }
|
public operator fun RealVector.minus(number: Number): RealVector = map { it - number.toDouble() }
|
||||||
|
|
||||||
public operator fun Number.minus(vector: RealVector): RealVector = vector.map { toDouble() - it }
|
public operator fun Number.minus(vector: RealVector): RealVector = vector.map { toDouble() - it }
|
||||||
|
|
||||||
public operator fun RealVector.times(other: RealVector): RealVector =
|
public operator fun RealVector.times(other: RealVector): RealVector {
|
||||||
mapIndexed { index, value -> value * other[index] }
|
require(size == other.size){"Vector size $size expected but ${other.size} found"}
|
||||||
|
return mapIndexed { index, value -> value * other[index] }
|
||||||
|
}
|
||||||
|
|
||||||
public operator fun RealVector.times(number: Number): RealVector = map { it * number.toDouble() }
|
public operator fun RealVector.times(number: Number): RealVector = map { it * number.toDouble() }
|
||||||
|
|
||||||
public operator fun Number.times(vector: RealVector): RealVector = vector * this
|
public operator fun Number.times(vector: RealVector): RealVector = vector * this
|
||||||
|
|
||||||
public operator fun RealVector.div(other: RealVector): RealVector =
|
public operator fun RealVector.div(other: RealVector): RealVector {
|
||||||
mapIndexed { index, value -> value / other[index] }
|
require(size == other.size){"Vector size $size expected but ${other.size} found"}
|
||||||
|
return mapIndexed { index, value -> value / other[index] }
|
||||||
|
}
|
||||||
|
|
||||||
public operator fun RealVector.div(number: Number): RealVector = map { it / number.toDouble() }
|
public operator fun RealVector.div(number: Number): RealVector = map { it / number.toDouble() }
|
||||||
|
|
||||||
|
47
kmath-functions/README.md
Normal file
47
kmath-functions/README.md
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
# Functions (`kmath-functions`)
|
||||||
|
|
||||||
|
Functions and interpolations:
|
||||||
|
|
||||||
|
- [piecewise](Piecewise functions.) : src/commonMain/kotlin/kscience/kmath/functions/Piecewise.kt
|
||||||
|
- [polynomials](Polynomial functions.) : src/commonMain/kotlin/kscience/kmath/functions/Polynomial.kt
|
||||||
|
- [linear interpolation](Linear XY interpolator.) : src/commonMain/kotlin/kscience/kmath/interpolation/LinearInterpolator.kt
|
||||||
|
- [spline interpolation](Cubic spline XY interpolator.) : src/commonMain/kotlin/kscience/kmath/interpolation/SplineInterpolator.kt
|
||||||
|
|
||||||
|
|
||||||
|
> #### Artifact:
|
||||||
|
>
|
||||||
|
> This module artifact: `kscience.kmath:kmath-functions:0.2.0-dev-6`.
|
||||||
|
>
|
||||||
|
> Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-functions/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-functions/_latestVersion)
|
||||||
|
>
|
||||||
|
> Bintray development version: [ ![Download](https://api.bintray.com/packages/mipt-npm/dev/kmath-functions/images/download.svg) ](https://bintray.com/mipt-npm/dev/kmath-functions/_latestVersion)
|
||||||
|
>
|
||||||
|
> **Gradle:**
|
||||||
|
>
|
||||||
|
> ```gradle
|
||||||
|
> repositories {
|
||||||
|
> maven { url "https://dl.bintray.com/kotlin/kotlin-eap" }
|
||||||
|
> maven { url 'https://dl.bintray.com/mipt-npm/kscience' }
|
||||||
|
> maven { url 'https://dl.bintray.com/mipt-npm/dev' }
|
||||||
|
> maven { url 'https://dl.bintray.com/hotkeytlt/maven' }
|
||||||
|
>
|
||||||
|
> }
|
||||||
|
>
|
||||||
|
> dependencies {
|
||||||
|
> implementation 'kscience.kmath:kmath-functions:0.2.0-dev-6'
|
||||||
|
> }
|
||||||
|
> ```
|
||||||
|
> **Gradle Kotlin DSL:**
|
||||||
|
>
|
||||||
|
> ```kotlin
|
||||||
|
> repositories {
|
||||||
|
> maven("https://dl.bintray.com/kotlin/kotlin-eap")
|
||||||
|
> maven("https://dl.bintray.com/mipt-npm/kscience")
|
||||||
|
> maven("https://dl.bintray.com/mipt-npm/dev")
|
||||||
|
> maven("https://dl.bintray.com/hotkeytlt/maven")
|
||||||
|
> }
|
||||||
|
>
|
||||||
|
> dependencies {
|
||||||
|
> implementation("kscience.kmath:kmath-functions:0.2.0-dev-6")
|
||||||
|
> }
|
||||||
|
> ```
|
@ -7,3 +7,14 @@ kotlin.sourceSets.commonMain {
|
|||||||
api(project(":kmath-core"))
|
api(project(":kmath-core"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readme {
|
||||||
|
description = "Functions and interpolation"
|
||||||
|
maturity = ru.mipt.npm.gradle.Maturity.PROTOTYPE
|
||||||
|
propertyByTemplate("artifact", rootProject.file("docs/templates/ARTIFACT-TEMPLATE.md"))
|
||||||
|
|
||||||
|
feature("piecewise", "src/commonMain/kotlin/kscience/kmath/functions/Piecewise.kt", "Piecewise functions.")
|
||||||
|
feature("polynomials", "src/commonMain/kotlin/kscience/kmath/functions/Polynomial.kt", "Polynomial functions.")
|
||||||
|
feature("linear interpolation", "src/commonMain/kotlin/kscience/kmath/interpolation/LinearInterpolator.kt", "Linear XY interpolator.")
|
||||||
|
feature("spline interpolation", "src/commonMain/kotlin/kscience/kmath/interpolation/SplineInterpolator.kt", "Cubic spline XY interpolator.")
|
||||||
|
}
|
7
kmath-functions/docs/README-TEMPLATE.md
Normal file
7
kmath-functions/docs/README-TEMPLATE.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Functions (`kmath-functions`)
|
||||||
|
|
||||||
|
Functions and interpolations:
|
||||||
|
|
||||||
|
${features}
|
||||||
|
|
||||||
|
${artifact}
|
@ -6,8 +6,7 @@ public fun interface Piecewise<T, R> {
|
|||||||
public fun findPiece(arg: T): R?
|
public fun findPiece(arg: T): R?
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun interface PiecewisePolynomial<T : Any> :
|
public fun interface PiecewisePolynomial<T : Any> : Piecewise<T, Polynomial<T>>
|
||||||
Piecewise<T, Polynomial<T>>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ordered list of pieces in piecewise function
|
* Ordered list of pieces in piecewise function
|
||||||
|
@ -5,3 +5,7 @@ kotlin.sourceSets.commonMain {
|
|||||||
api(project(":kmath-core"))
|
api(project(":kmath-core"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readme{
|
||||||
|
maturity = ru.mipt.npm.gradle.Maturity.PROTOTYPE
|
||||||
|
}
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
package kscience.kmath.geometry
|
package kscience.kmath.geometry
|
||||||
|
|
||||||
import kscience.kmath.linear.Point
|
import kscience.kmath.linear.Point
|
||||||
|
import kscience.kmath.misc.UnstableKMathAPI
|
||||||
import kscience.kmath.operations.SpaceElement
|
import kscience.kmath.operations.SpaceElement
|
||||||
import kscience.kmath.operations.invoke
|
import kscience.kmath.operations.invoke
|
||||||
import kotlin.math.sqrt
|
import kotlin.math.sqrt
|
||||||
|
|
||||||
public interface Vector2D : Point<Double>, Vector, SpaceElement<Vector2D, Vector2D, Euclidean2DSpace> {
|
@OptIn(UnstableKMathAPI::class)
|
||||||
|
public interface Vector2D : Point<Double>, Vector, SpaceElement<Vector2D, Euclidean2DSpace> {
|
||||||
public val x: Double
|
public val x: Double
|
||||||
public val y: Double
|
public val y: Double
|
||||||
public override val context: Euclidean2DSpace get() = Euclidean2DSpace
|
public override val context: Euclidean2DSpace get() = Euclidean2DSpace
|
||||||
@ -18,8 +20,6 @@ public interface Vector2D : Point<Double>, Vector, SpaceElement<Vector2D, Vector
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override operator fun iterator(): Iterator<Double> = listOf(x, y).iterator()
|
public override operator fun iterator(): Iterator<Double> = listOf(x, y).iterator()
|
||||||
public override fun unwrap(): Vector2D = this
|
|
||||||
public override fun Vector2D.wrap(): Vector2D = this
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public val Vector2D.r: Double
|
public val Vector2D.r: Double
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
package kscience.kmath.geometry
|
package kscience.kmath.geometry
|
||||||
|
|
||||||
import kscience.kmath.linear.Point
|
import kscience.kmath.linear.Point
|
||||||
|
import kscience.kmath.misc.UnstableKMathAPI
|
||||||
import kscience.kmath.operations.SpaceElement
|
import kscience.kmath.operations.SpaceElement
|
||||||
import kscience.kmath.operations.invoke
|
import kscience.kmath.operations.invoke
|
||||||
import kotlin.math.sqrt
|
import kotlin.math.sqrt
|
||||||
|
|
||||||
public interface Vector3D : Point<Double>, Vector, SpaceElement<Vector3D, Vector3D, Euclidean3DSpace> {
|
@OptIn(UnstableKMathAPI::class)
|
||||||
|
public interface Vector3D : Point<Double>, Vector, SpaceElement<Vector3D, Euclidean3DSpace> {
|
||||||
public val x: Double
|
public val x: Double
|
||||||
public val y: Double
|
public val y: Double
|
||||||
public val z: Double
|
public val z: Double
|
||||||
@ -20,8 +22,6 @@ public interface Vector3D : Point<Double>, Vector, SpaceElement<Vector3D, Vector
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override operator fun iterator(): Iterator<Double> = listOf(x, y, z).iterator()
|
public override operator fun iterator(): Iterator<Double> = listOf(x, y, z).iterator()
|
||||||
public override fun unwrap(): Vector3D = this
|
|
||||||
public override fun Vector3D.wrap(): Vector3D = this
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("FunctionName")
|
@Suppress("FunctionName")
|
||||||
|
@ -8,10 +8,10 @@ import kscience.kmath.operations.invoke
|
|||||||
import kscience.kmath.structures.*
|
import kscience.kmath.structures.*
|
||||||
import kotlin.math.floor
|
import kotlin.math.floor
|
||||||
|
|
||||||
public data class BinDef<T : Comparable<T>>(
|
public data class MultivariateBinDefinition<T : Comparable<T>>(
|
||||||
public val space: SpaceOperations<Point<T>>,
|
public val space: SpaceOperations<Point<T>>,
|
||||||
public val center: Point<T>,
|
public val center: Point<T>,
|
||||||
public val sizes: Point<T>
|
public val sizes: Point<T>,
|
||||||
) {
|
) {
|
||||||
public fun contains(vector: Point<out T>): Boolean {
|
public fun contains(vector: Point<out T>): Boolean {
|
||||||
require(vector.size == center.size) { "Dimension mismatch for input vector. Expected ${center.size}, but found ${vector.size}" }
|
require(vector.size == center.size) { "Dimension mismatch for input vector. Expected ${center.size}, but found ${vector.size}" }
|
||||||
@ -22,14 +22,18 @@ public data class BinDef<T : Comparable<T>>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class MultivariateBin<T : Comparable<T>>(public val def: BinDef<T>, public override val value: Number) : Bin<T> {
|
public class MultivariateBin<T : Comparable<T>>(
|
||||||
|
public val definition: MultivariateBinDefinition<T>,
|
||||||
|
public val count: Long,
|
||||||
|
public override val value: Double,
|
||||||
|
) : Bin<T> {
|
||||||
public override val dimension: Int
|
public override val dimension: Int
|
||||||
get() = def.center.size
|
get() = definition.center.size
|
||||||
|
|
||||||
public override val center: Point<T>
|
public override val center: Point<T>
|
||||||
get() = def.center
|
get() = definition.center
|
||||||
|
|
||||||
public override operator fun contains(point: Point<T>): Boolean = def.contains(point)
|
public override operator fun contains(point: Point<T>): Boolean = definition.contains(point)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,11 +42,11 @@ public class MultivariateBin<T : Comparable<T>>(public val def: BinDef<T>, publi
|
|||||||
public class RealHistogram(
|
public class RealHistogram(
|
||||||
private val lower: Buffer<Double>,
|
private val lower: Buffer<Double>,
|
||||||
private val upper: Buffer<Double>,
|
private val upper: Buffer<Double>,
|
||||||
private val binNums: IntArray = IntArray(lower.size) { 20 }
|
private val binNums: IntArray = IntArray(lower.size) { 20 },
|
||||||
) : MutableHistogram<Double, MultivariateBin<Double>> {
|
) : MutableHistogram<Double, MultivariateBin<Double>> {
|
||||||
private val strides = DefaultStrides(IntArray(binNums.size) { binNums[it] + 2 })
|
private val strides = DefaultStrides(IntArray(binNums.size) { binNums[it] + 2 })
|
||||||
private val values: NDStructure<LongCounter> = NDStructure.auto(strides) { LongCounter() }
|
private val counts: NDStructure<LongCounter> = NDStructure.auto(strides) { LongCounter() }
|
||||||
private val weights: NDStructure<DoubleCounter> = NDStructure.auto(strides) { DoubleCounter() }
|
private val values: NDStructure<DoubleCounter> = NDStructure.auto(strides) { DoubleCounter() }
|
||||||
public override val dimension: Int get() = lower.size
|
public override val dimension: Int get() = lower.size
|
||||||
private val binSize = RealBuffer(dimension) { (upper[it] - lower[it]) / binNums[it] }
|
private val binSize = RealBuffer(dimension) { (upper[it] - lower[it]) / binNums[it] }
|
||||||
|
|
||||||
@ -53,7 +57,6 @@ public class RealHistogram(
|
|||||||
require(!(0 until dimension).any { upper[it] - lower[it] < 0 }) { "Range for one of axis is not strictly positive" }
|
require(!(0 until dimension).any { upper[it] - lower[it] < 0 }) { "Range for one of axis is not strictly positive" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get internal [NDStructure] bin index for given axis
|
* Get internal [NDStructure] bin index for given axis
|
||||||
*/
|
*/
|
||||||
@ -65,11 +68,15 @@ public class RealHistogram(
|
|||||||
|
|
||||||
private fun getIndex(point: Buffer<out Double>): IntArray = IntArray(dimension) { getIndex(it, point[it]) }
|
private fun getIndex(point: Buffer<out Double>): IntArray = IntArray(dimension) { getIndex(it, point[it]) }
|
||||||
|
|
||||||
private fun getValue(index: IntArray): Long = values[index].sum()
|
private fun getCount(index: IntArray): Long = counts[index].sum()
|
||||||
|
|
||||||
public fun getValue(point: Buffer<out Double>): Long = getValue(getIndex(point))
|
public fun getCount(point: Buffer<out Double>): Long = getCount(getIndex(point))
|
||||||
|
|
||||||
private fun getDef(index: IntArray): BinDef<Double> {
|
private fun getValue(index: IntArray): Double = values[index].sum()
|
||||||
|
|
||||||
|
public fun getValue(point: Buffer<out Double>): Double = getValue(getIndex(point))
|
||||||
|
|
||||||
|
private fun getBinDefinition(index: IntArray): MultivariateBinDefinition<Double> {
|
||||||
val center = index.mapIndexed { axis, i ->
|
val center = index.mapIndexed { axis, i ->
|
||||||
when (i) {
|
when (i) {
|
||||||
0 -> Double.NEGATIVE_INFINITY
|
0 -> Double.NEGATIVE_INFINITY
|
||||||
@ -78,14 +85,14 @@ public class RealHistogram(
|
|||||||
}
|
}
|
||||||
}.asBuffer()
|
}.asBuffer()
|
||||||
|
|
||||||
return BinDef(RealBufferFieldOperations, center, binSize)
|
return MultivariateBinDefinition(RealBufferFieldOperations, center, binSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun getDef(point: Buffer<out Double>): BinDef<Double> = getDef(getIndex(point))
|
public fun getBinDefinition(point: Buffer<out Double>): MultivariateBinDefinition<Double> = getBinDefinition(getIndex(point))
|
||||||
|
|
||||||
public override operator fun get(point: Buffer<out Double>): MultivariateBin<Double>? {
|
public override operator fun get(point: Buffer<out Double>): MultivariateBin<Double>? {
|
||||||
val index = getIndex(point)
|
val index = getIndex(point)
|
||||||
return MultivariateBin(getDef(index), getValue(index))
|
return MultivariateBin(getBinDefinition(index), getCount(index),getValue(index))
|
||||||
}
|
}
|
||||||
|
|
||||||
// fun put(point: Point<out Double>){
|
// fun put(point: Point<out Double>){
|
||||||
@ -95,23 +102,24 @@ public class RealHistogram(
|
|||||||
|
|
||||||
public override fun putWithWeight(point: Buffer<out Double>, weight: Double) {
|
public override fun putWithWeight(point: Buffer<out Double>, weight: Double) {
|
||||||
val index = getIndex(point)
|
val index = getIndex(point)
|
||||||
values[index].increment()
|
counts[index].increment()
|
||||||
weights[index].add(weight)
|
values[index].add(weight)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override operator fun iterator(): Iterator<MultivariateBin<Double>> =
|
public override operator fun iterator(): Iterator<MultivariateBin<Double>> =
|
||||||
weights.elements().map { (index, value) -> MultivariateBin(getDef(index), value.sum()) }
|
strides.indices().map { index->
|
||||||
.iterator()
|
MultivariateBin(getBinDefinition(index), counts[index].sum(), values[index].sum())
|
||||||
|
}.iterator()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert this histogram into NDStructure containing bin values but not bin descriptions
|
* NDStructure containing number of events in bins without weights
|
||||||
*/
|
*/
|
||||||
public fun values(): NDStructure<Number> = NDStructure.auto(values.shape) { values[it].sum() }
|
public fun counts(): NDStructure<Long> = NDStructure.auto(counts.shape) { counts[it].sum() }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sum of weights
|
* NDStructure containing values of bins including weights
|
||||||
*/
|
*/
|
||||||
public fun weights(): NDStructure<Double> = NDStructure.auto(weights.shape) { weights[it].sum() }
|
public fun values(): NDStructure<Double> = NDStructure.auto(values.shape) { values[it].sum() }
|
||||||
|
|
||||||
public companion object {
|
public companion object {
|
||||||
/**
|
/**
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package kscience.kmath.histogram
|
package kscience.kmath.histogram
|
||||||
|
|
||||||
import kscience.kmath.linear.Point
|
import kscience.kmath.linear.Point
|
||||||
|
import kscience.kmath.misc.UnstableKMathAPI
|
||||||
|
import kscience.kmath.operations.SpaceElement
|
||||||
import kscience.kmath.structures.Buffer
|
import kscience.kmath.structures.Buffer
|
||||||
import kscience.kmath.structures.asBuffer
|
import kscience.kmath.structures.asBuffer
|
||||||
|
import kscience.kmath.structures.asSequence
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.math.floor
|
import kotlin.math.floor
|
||||||
|
|
||||||
@ -11,29 +14,37 @@ import kotlin.math.floor
|
|||||||
public class UnivariateBin(
|
public class UnivariateBin(
|
||||||
public val position: Double,
|
public val position: Double,
|
||||||
public val size: Double,
|
public val size: Double,
|
||||||
public val counter: LongCounter = LongCounter(),
|
|
||||||
) : Bin<Double> {
|
) : Bin<Double> {
|
||||||
//TODO add weighting
|
//internal mutation operations
|
||||||
public override val value: Number get() = counter.sum()
|
internal val counter: LongCounter = LongCounter()
|
||||||
|
internal val weightCounter: DoubleCounter = DoubleCounter()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The precise number of events ignoring weighting
|
||||||
|
*/
|
||||||
|
public val count: Long get() = counter.sum()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value of histogram including weighting
|
||||||
|
*/
|
||||||
|
public override val value: Double get() = weightCounter.sum()
|
||||||
|
|
||||||
public override val center: Point<Double> get() = doubleArrayOf(position).asBuffer()
|
public override val center: Point<Double> get() = doubleArrayOf(position).asBuffer()
|
||||||
public override val dimension: Int get() = 1
|
public override val dimension: Int get() = 1
|
||||||
|
|
||||||
public operator fun contains(value: Double): Boolean = value in (position - size / 2)..(position + size / 2)
|
public operator fun contains(value: Double): Boolean = value in (position - size / 2)..(position + size / 2)
|
||||||
public override fun contains(point: Buffer<Double>): Boolean = contains(point[0])
|
public override fun contains(point: Buffer<Double>): Boolean = contains(point[0])
|
||||||
internal operator fun inc(): UnivariateBin = this.also { counter.increment() }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Univariate histogram with log(n) bin search speed
|
* Univariate histogram with log(n) bin search speed
|
||||||
*/
|
*/
|
||||||
public class UnivariateHistogram private constructor(
|
@OptIn(UnstableKMathAPI::class)
|
||||||
private val factory: (Double) -> UnivariateBin,
|
public abstract class UnivariateHistogram protected constructor(
|
||||||
) : MutableHistogram<Double, UnivariateBin> {
|
protected val bins: TreeMap<Double, UnivariateBin> = TreeMap(),
|
||||||
|
) : Histogram<Double, UnivariateBin>, SpaceElement<UnivariateHistogram, UnivariateHistogramSpace> {
|
||||||
|
|
||||||
private val bins: TreeMap<Double, UnivariateBin> = TreeMap()
|
public operator fun get(value: Double): UnivariateBin? {
|
||||||
|
|
||||||
private operator fun get(value: Double): UnivariateBin? {
|
|
||||||
// check ceiling entry and return it if it is what needed
|
// check ceiling entry and return it if it is what needed
|
||||||
val ceil = bins.ceilingEntry(value)?.value
|
val ceil = bins.ceilingEntry(value)?.value
|
||||||
if (ceil != null && value in ceil) return ceil
|
if (ceil != null && value in ceil) return ceil
|
||||||
@ -44,38 +55,38 @@ public class UnivariateHistogram private constructor(
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createBin(value: Double): UnivariateBin = factory(value).also {
|
|
||||||
synchronized(this) { bins[it.position] = it }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override operator fun get(point: Buffer<out Double>): UnivariateBin? = get(point[0])
|
public override operator fun get(point: Buffer<out Double>): UnivariateBin? = get(point[0])
|
||||||
|
|
||||||
public override val dimension: Int get() = 1
|
public override val dimension: Int get() = 1
|
||||||
|
|
||||||
public override operator fun iterator(): Iterator<UnivariateBin> = bins.values.iterator()
|
public override operator fun iterator(): Iterator<UnivariateBin> = bins.values.iterator()
|
||||||
|
|
||||||
/**
|
|
||||||
* Thread safe put operation
|
|
||||||
*/
|
|
||||||
public fun put(value: Double) {
|
|
||||||
(get(value) ?: createBin(value)).inc()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun putWithWeight(point: Buffer<out Double>, weight: Double) {
|
|
||||||
if (weight != 1.0) TODO("Implement weighting")
|
|
||||||
put(point[0])
|
|
||||||
}
|
|
||||||
|
|
||||||
public companion object {
|
public companion object {
|
||||||
public fun uniform(binSize: Double, start: Double = 0.0): UnivariateHistogram = UnivariateHistogram { value ->
|
/**
|
||||||
val center = start + binSize * floor((value - start) / binSize + 0.5)
|
* Build a histogram with a uniform binning with a start at [start] and a bin size of [binSize]
|
||||||
UnivariateBin(center, binSize)
|
*/
|
||||||
}
|
public fun uniformBuilder(binSize: Double, start: Double = 0.0): UnivariateHistogramBuilder =
|
||||||
|
UnivariateHistogramSpace { value ->
|
||||||
|
val center = start + binSize * floor((value - start) / binSize + 0.5)
|
||||||
|
UnivariateBin(center, binSize)
|
||||||
|
}.builder()
|
||||||
|
|
||||||
public fun custom(borders: DoubleArray): UnivariateHistogram {
|
/**
|
||||||
|
* Build and fill a [UnivariateHistogram]. Returns a read-only histogram.
|
||||||
|
*/
|
||||||
|
public fun uniform(
|
||||||
|
binSize: Double,
|
||||||
|
start: Double = 0.0,
|
||||||
|
builder: UnivariateHistogramBuilder.() -> Unit,
|
||||||
|
): UnivariateHistogram = uniformBuilder(binSize, start).apply(builder)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a histogram with custom cell borders
|
||||||
|
*/
|
||||||
|
public fun customBuilder(borders: DoubleArray): UnivariateHistogramBuilder {
|
||||||
val sorted = borders.sortedArray()
|
val sorted = borders.sortedArray()
|
||||||
|
|
||||||
return UnivariateHistogram { value ->
|
return UnivariateHistogramSpace { value ->
|
||||||
when {
|
when {
|
||||||
value < sorted.first() -> UnivariateBin(
|
value < sorted.first() -> UnivariateBin(
|
||||||
Double.NEGATIVE_INFINITY,
|
Double.NEGATIVE_INFINITY,
|
||||||
@ -94,9 +105,57 @@ public class UnivariateHistogram private constructor(
|
|||||||
UnivariateBin((left + right) / 2, (right - left))
|
UnivariateBin((left + right) / 2, (right - left))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}.builder()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build and fill a histogram with custom borders. Returns a read-only histogram.
|
||||||
|
*/
|
||||||
|
public fun custom(
|
||||||
|
borders: DoubleArray,
|
||||||
|
builder: UnivariateHistogramBuilder.() -> Unit,
|
||||||
|
): UnivariateHistogram = customBuilder(borders).apply(builder)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class UnivariateHistogramBuilder internal constructor(
|
||||||
|
override val context: UnivariateHistogramSpace,
|
||||||
|
) : UnivariateHistogram(), MutableHistogram<Double, UnivariateBin> {
|
||||||
|
|
||||||
|
private fun createBin(value: Double): UnivariateBin = context.binFactory(value).also {
|
||||||
|
synchronized(this) { bins[it.position] = it }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thread safe put operation
|
||||||
|
*/
|
||||||
|
public fun put(value: Double, weight: Double = 1.0) {
|
||||||
|
(get(value) ?: createBin(value)).apply {
|
||||||
|
counter.increment()
|
||||||
|
weightCounter.add(weight)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun putWithWeight(point: Buffer<out Double>, weight: Double) {
|
||||||
|
put(point[0], weight)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put several items into a single bin
|
||||||
|
*/
|
||||||
|
public fun putMany(value: Double, count: Int, weight: Double = count.toDouble()) {
|
||||||
|
(get(value) ?: createBin(value)).apply {
|
||||||
|
counter.add(count.toLong())
|
||||||
|
weightCounter.add(weight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun UnivariateHistogram.fill(sequence: Iterable<Double>): Unit = sequence.forEach(::put)
|
@UnstableKMathAPI
|
||||||
|
public fun UnivariateHistogramBuilder.fill(items: Iterable<Double>): Unit = items.forEach(::put)
|
||||||
|
|
||||||
|
@UnstableKMathAPI
|
||||||
|
public fun UnivariateHistogramBuilder.fill(array: DoubleArray): Unit = array.forEach(::put)
|
||||||
|
|
||||||
|
@UnstableKMathAPI
|
||||||
|
public fun UnivariateHistogramBuilder.fill(buffer: Buffer<Double>): Unit = buffer.asSequence().forEach(::put)
|
@ -0,0 +1,25 @@
|
|||||||
|
package kscience.kmath.histogram
|
||||||
|
|
||||||
|
import kscience.kmath.operations.Space
|
||||||
|
|
||||||
|
public class UnivariateHistogramSpace(public val binFactory: (Double) -> UnivariateBin) : Space<UnivariateHistogram> {
|
||||||
|
|
||||||
|
public fun builder(): UnivariateHistogramBuilder = UnivariateHistogramBuilder(this)
|
||||||
|
|
||||||
|
public fun produce(builder: UnivariateHistogramBuilder.() -> Unit): UnivariateHistogram = builder().apply(builder)
|
||||||
|
|
||||||
|
override fun add(
|
||||||
|
a: UnivariateHistogram,
|
||||||
|
b: UnivariateHistogram,
|
||||||
|
): UnivariateHistogram {
|
||||||
|
require(a.context == this){"Histogram $a does not belong to this context"}
|
||||||
|
require(b.context == this){"Histogram $b does not belong to this context"}
|
||||||
|
TODO()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun multiply(a: UnivariateHistogram, k: Number): UnivariateHistogram {
|
||||||
|
TODO("Not yet implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
override val zero: UnivariateHistogram = produce { }
|
||||||
|
}
|
@ -7,3 +7,7 @@ dependencies {
|
|||||||
implementation("com.github.breandan:kotlingrad:0.4.0")
|
implementation("com.github.breandan:kotlingrad:0.4.0")
|
||||||
api(project(":kmath-ast"))
|
api(project(":kmath-ast"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readme{
|
||||||
|
maturity = ru.mipt.npm.gradle.Maturity.PROTOTYPE
|
||||||
|
}
|
72
kmath-memory/api/kmath-memory.api
Normal file
72
kmath-memory/api/kmath-memory.api
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
public final class kscience/kmath/memory/ByteBufferMemory : kscience/kmath/memory/Memory {
|
||||||
|
public fun <init> (Ljava/nio/ByteBuffer;II)V
|
||||||
|
public synthetic fun <init> (Ljava/nio/ByteBuffer;IIILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||||
|
public fun copy ()Lkscience/kmath/memory/Memory;
|
||||||
|
public final fun getBuffer ()Ljava/nio/ByteBuffer;
|
||||||
|
public fun getSize ()I
|
||||||
|
public final fun getStartOffset ()I
|
||||||
|
public fun reader ()Lkscience/kmath/memory/MemoryReader;
|
||||||
|
public fun view (II)Lkscience/kmath/memory/Memory;
|
||||||
|
public fun writer ()Lkscience/kmath/memory/MemoryWriter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class kscience/kmath/memory/ByteBufferMemoryKt {
|
||||||
|
public static final fun allocate (Lkscience/kmath/memory/Memory$Companion;I)Lkscience/kmath/memory/Memory;
|
||||||
|
public static final fun asMemory (Ljava/nio/ByteBuffer;II)Lkscience/kmath/memory/Memory;
|
||||||
|
public static synthetic fun asMemory$default (Ljava/nio/ByteBuffer;IIILjava/lang/Object;)Lkscience/kmath/memory/Memory;
|
||||||
|
public static final fun readAsMemory (Ljava/nio/file/Path;JJLkotlin/jvm/functions/Function1;)Ljava/lang/Object;
|
||||||
|
public static synthetic fun readAsMemory$default (Ljava/nio/file/Path;JJLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public static final fun wrap (Lkscience/kmath/memory/Memory$Companion;[B)Lkscience/kmath/memory/Memory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract interface class kscience/kmath/memory/Memory {
|
||||||
|
public static final field Companion Lkscience/kmath/memory/Memory$Companion;
|
||||||
|
public abstract fun copy ()Lkscience/kmath/memory/Memory;
|
||||||
|
public abstract fun getSize ()I
|
||||||
|
public abstract fun reader ()Lkscience/kmath/memory/MemoryReader;
|
||||||
|
public abstract fun view (II)Lkscience/kmath/memory/Memory;
|
||||||
|
public abstract fun writer ()Lkscience/kmath/memory/MemoryWriter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class kscience/kmath/memory/Memory$Companion {
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class kscience/kmath/memory/MemoryKt {
|
||||||
|
public static final fun read (Lkscience/kmath/memory/Memory;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
|
||||||
|
public static final fun write (Lkscience/kmath/memory/Memory;Lkotlin/jvm/functions/Function1;)V
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract interface class kscience/kmath/memory/MemoryReader {
|
||||||
|
public abstract fun getMemory ()Lkscience/kmath/memory/Memory;
|
||||||
|
public abstract fun readByte (I)B
|
||||||
|
public abstract fun readDouble (I)D
|
||||||
|
public abstract fun readFloat (I)F
|
||||||
|
public abstract fun readInt (I)I
|
||||||
|
public abstract fun readLong (I)J
|
||||||
|
public abstract fun readShort (I)S
|
||||||
|
public abstract fun release ()V
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract interface class kscience/kmath/memory/MemorySpec {
|
||||||
|
public abstract fun getObjectSize ()I
|
||||||
|
public abstract fun read (Lkscience/kmath/memory/MemoryReader;I)Ljava/lang/Object;
|
||||||
|
public abstract fun write (Lkscience/kmath/memory/MemoryWriter;ILjava/lang/Object;)V
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class kscience/kmath/memory/MemorySpecKt {
|
||||||
|
public static final fun read (Lkscience/kmath/memory/MemoryReader;Lkscience/kmath/memory/MemorySpec;I)Ljava/lang/Object;
|
||||||
|
public static final fun write (Lkscience/kmath/memory/MemoryWriter;Lkscience/kmath/memory/MemorySpec;ILjava/lang/Object;)V
|
||||||
|
public static final fun writeArray (Lkscience/kmath/memory/MemoryWriter;Lkscience/kmath/memory/MemorySpec;I[Ljava/lang/Object;)V
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract interface class kscience/kmath/memory/MemoryWriter {
|
||||||
|
public abstract fun getMemory ()Lkscience/kmath/memory/Memory;
|
||||||
|
public abstract fun release ()V
|
||||||
|
public abstract fun writeByte (IB)V
|
||||||
|
public abstract fun writeDouble (ID)V
|
||||||
|
public abstract fun writeFloat (IF)V
|
||||||
|
public abstract fun writeInt (II)V
|
||||||
|
public abstract fun writeLong (IJ)V
|
||||||
|
public abstract fun writeShort (IS)V
|
||||||
|
}
|
||||||
|
|
@ -2,3 +2,10 @@ plugins {
|
|||||||
id("ru.mipt.npm.mpp")
|
id("ru.mipt.npm.mpp")
|
||||||
id("ru.mipt.npm.native")
|
id("ru.mipt.npm.native")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readme{
|
||||||
|
description = """
|
||||||
|
An API and basic implementation for arranging objects in a continous memory block.
|
||||||
|
""".trimIndent()
|
||||||
|
maturity = ru.mipt.npm.gradle.Maturity.DEVELOPMENT
|
||||||
|
}
|
@ -9,7 +9,7 @@ This subproject implements the following features:
|
|||||||
|
|
||||||
> #### Artifact:
|
> #### Artifact:
|
||||||
>
|
>
|
||||||
> This module artifact: `kscience.kmath:kmath-nd4j:0.2.0-dev-4`.
|
> This module artifact: `kscience.kmath:kmath-nd4j:0.2.0-dev-6`.
|
||||||
>
|
>
|
||||||
> Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-nd4j/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-nd4j/_latestVersion)
|
> Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-nd4j/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-nd4j/_latestVersion)
|
||||||
>
|
>
|
||||||
@ -27,7 +27,7 @@ This subproject implements the following features:
|
|||||||
> }
|
> }
|
||||||
>
|
>
|
||||||
> dependencies {
|
> dependencies {
|
||||||
> implementation 'kscience.kmath:kmath-nd4j:0.2.0-dev-4'
|
> implementation 'kscience.kmath:kmath-nd4j:0.2.0-dev-6'
|
||||||
> }
|
> }
|
||||||
> ```
|
> ```
|
||||||
> **Gradle Kotlin DSL:**
|
> **Gradle Kotlin DSL:**
|
||||||
@ -41,7 +41,7 @@ This subproject implements the following features:
|
|||||||
> }
|
> }
|
||||||
>
|
>
|
||||||
> dependencies {
|
> dependencies {
|
||||||
> implementation("kscience.kmath:kmath-nd4j:0.2.0-dev-4")
|
> implementation("kscience.kmath:kmath-nd4j:0.2.0-dev-6")
|
||||||
> }
|
> }
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
|
@ -16,3 +16,7 @@ kotlin.sourceSets {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readme{
|
||||||
|
maturity = ru.mipt.npm.gradle.Maturity.EXPERIMENTAL
|
||||||
|
}
|
@ -83,7 +83,7 @@ public interface RandomGenerator {
|
|||||||
/**
|
/**
|
||||||
* Implements [RandomGenerator] by delegating all operations to [Random].
|
* Implements [RandomGenerator] by delegating all operations to [Random].
|
||||||
*/
|
*/
|
||||||
public inline class DefaultGenerator(public val random: Random = Random) : RandomGenerator {
|
public class DefaultGenerator(public val random: Random = Random) : RandomGenerator {
|
||||||
public override fun nextBoolean(): Boolean = random.nextBoolean()
|
public override fun nextBoolean(): Boolean = random.nextBoolean()
|
||||||
public override fun nextDouble(): Double = random.nextDouble()
|
public override fun nextDouble(): Double = random.nextDouble()
|
||||||
public override fun nextInt(): Int = random.nextInt()
|
public override fun nextInt(): Int = random.nextInt()
|
||||||
|
186
kmath-viktor/api/kmath-viktor.api
Normal file
186
kmath-viktor/api/kmath-viktor.api
Normal file
@ -0,0 +1,186 @@
|
|||||||
|
public final class kscience/kmath/viktor/ViktorBuffer : kscience/kmath/structures/MutableBuffer {
|
||||||
|
public static final synthetic fun box-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;)Lkscience/kmath/viktor/ViktorBuffer;
|
||||||
|
public static fun constructor-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;)Lorg/jetbrains/bio/viktor/F64FlatArray;
|
||||||
|
public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z
|
||||||
|
public static fun contentEquals-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;Lkscience/kmath/structures/Buffer;)Z
|
||||||
|
public fun copy ()Lkscience/kmath/structures/MutableBuffer;
|
||||||
|
public static fun copy-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;)Lkscience/kmath/structures/MutableBuffer;
|
||||||
|
public fun equals (Ljava/lang/Object;)Z
|
||||||
|
public static fun equals-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;Ljava/lang/Object;)Z
|
||||||
|
public static final fun equals-impl0 (Lorg/jetbrains/bio/viktor/F64FlatArray;Lorg/jetbrains/bio/viktor/F64FlatArray;)Z
|
||||||
|
public fun get (I)Ljava/lang/Double;
|
||||||
|
public synthetic fun get (I)Ljava/lang/Object;
|
||||||
|
public static fun get-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;I)Ljava/lang/Double;
|
||||||
|
public final fun getFlatArray ()Lorg/jetbrains/bio/viktor/F64FlatArray;
|
||||||
|
public fun getSize ()I
|
||||||
|
public static fun getSize-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;)I
|
||||||
|
public fun hashCode ()I
|
||||||
|
public static fun hashCode-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;)I
|
||||||
|
public fun iterator ()Ljava/util/Iterator;
|
||||||
|
public static fun iterator-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;)Ljava/util/Iterator;
|
||||||
|
public fun set (ID)V
|
||||||
|
public synthetic fun set (ILjava/lang/Object;)V
|
||||||
|
public static fun set-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;ID)V
|
||||||
|
public fun toString ()Ljava/lang/String;
|
||||||
|
public static fun toString-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;)Ljava/lang/String;
|
||||||
|
public final synthetic fun unbox-impl ()Lorg/jetbrains/bio/viktor/F64FlatArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class kscience/kmath/viktor/ViktorNDField : kscience/kmath/nd/NDField, kscience/kmath/operations/ExtendedField, kscience/kmath/operations/RingWithNumbers {
|
||||||
|
public fun <init> ([I)V
|
||||||
|
public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public fun acos-02gLDOA (Lkscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array;
|
||||||
|
public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public fun acosh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public synthetic fun add (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public fun add-frQ_39w (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array;
|
||||||
|
public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public fun asin-02gLDOA (Lkscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array;
|
||||||
|
public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public fun asinh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public fun atan-02gLDOA (Lkscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array;
|
||||||
|
public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public fun atanh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2;
|
||||||
|
public synthetic fun combine (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public fun combine-C8Lp-Ak (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lorg/jetbrains/bio/viktor/F64Array;
|
||||||
|
public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public fun cos-02gLDOA (Lkscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array;
|
||||||
|
public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public fun cosh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public fun div (DLkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public fun div (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
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;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public fun div (Lkscience/kmath/nd/NDStructure;D)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public fun div (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public synthetic fun div (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public fun div (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public fun divide (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public fun exp-02gLDOA (Lkscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array;
|
||||||
|
public synthetic fun getElementContext ()Ljava/lang/Object;
|
||||||
|
public fun getElementContext ()Lkscience/kmath/operations/RealField;
|
||||||
|
public final fun getF64Buffer (Lkscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array;
|
||||||
|
public synthetic fun getOne ()Ljava/lang/Object;
|
||||||
|
public fun getOne-hHuhEO0 ()Lorg/jetbrains/bio/viktor/F64Array;
|
||||||
|
public fun getShape ()[I
|
||||||
|
public synthetic fun getZero ()Ljava/lang/Object;
|
||||||
|
public fun getZero-hHuhEO0 ()Lorg/jetbrains/bio/viktor/F64Array;
|
||||||
|
public fun invoke (Lkotlin/jvm/functions/Function1;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2;
|
||||||
|
public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public fun ln-02gLDOA (Lkscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array;
|
||||||
|
public synthetic fun map (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public fun map-frQ_39w (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lorg/jetbrains/bio/viktor/F64Array;
|
||||||
|
public synthetic fun mapIndexed (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public fun mapIndexed-frQ_39w (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lorg/jetbrains/bio/viktor/F64Array;
|
||||||
|
public fun minus (DLkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public synthetic fun minus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public fun minus (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object;
|
||||||
|
public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public synthetic fun minus (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public fun minus (Lkscience/kmath/nd/NDStructure;D)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public fun minus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public synthetic fun minus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public fun minus-frQ_39w (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array;
|
||||||
|
public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object;
|
||||||
|
public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public synthetic fun multiply (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public fun multiply (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public fun multiply-frQ_39w (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lorg/jetbrains/bio/viktor/F64Array;
|
||||||
|
public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object;
|
||||||
|
public fun number-02gLDOA (Ljava/lang/Number;)Lorg/jetbrains/bio/viktor/F64Array;
|
||||||
|
public fun plus (DLkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public synthetic fun plus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public fun plus (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object;
|
||||||
|
public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public synthetic fun plus (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public fun plus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public synthetic fun plus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public fun plus-frQ_39w (Lkscience/kmath/nd/NDStructure;D)Lorg/jetbrains/bio/viktor/F64Array;
|
||||||
|
public fun plus-frQ_39w (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array;
|
||||||
|
public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object;
|
||||||
|
public fun pow (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object;
|
||||||
|
public fun power-frQ_39w (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lorg/jetbrains/bio/viktor/F64Array;
|
||||||
|
public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public fun produce-02gLDOA (Lkotlin/jvm/functions/Function2;)Lorg/jetbrains/bio/viktor/F64Array;
|
||||||
|
public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object;
|
||||||
|
public fun rightSideNumberOperation (Ljava/lang/String;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2;
|
||||||
|
public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public fun sin-02gLDOA (Lkscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array;
|
||||||
|
public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public fun sinh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public fun sqrt (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object;
|
||||||
|
public fun symbol (Ljava/lang/String;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public fun tan (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public fun tanh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public fun times (DLkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public fun times (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
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 synthetic fun times (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public fun times (Lkscience/kmath/nd/NDStructure;D)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public synthetic fun times (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public fun times (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public fun times-frQ_39w (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lorg/jetbrains/bio/viktor/F64Array;
|
||||||
|
public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public fun unaryMinus (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1;
|
||||||
|
public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object;
|
||||||
|
public fun unaryPlus (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class kscience/kmath/viktor/ViktorNDStructure : kscience/kmath/nd/MutableNDStructure {
|
||||||
|
public static final synthetic fun box-impl (Lorg/jetbrains/bio/viktor/F64Array;)Lkscience/kmath/viktor/ViktorNDStructure;
|
||||||
|
public static fun constructor-impl (Lorg/jetbrains/bio/viktor/F64Array;)Lorg/jetbrains/bio/viktor/F64Array;
|
||||||
|
public fun elements ()Lkotlin/sequences/Sequence;
|
||||||
|
public static fun elements-impl (Lorg/jetbrains/bio/viktor/F64Array;)Lkotlin/sequences/Sequence;
|
||||||
|
public fun equals (Ljava/lang/Object;)Z
|
||||||
|
public static fun equals-impl (Lorg/jetbrains/bio/viktor/F64Array;Ljava/lang/Object;)Z
|
||||||
|
public static final fun equals-impl0 (Lorg/jetbrains/bio/viktor/F64Array;Lorg/jetbrains/bio/viktor/F64Array;)Z
|
||||||
|
public fun get ([I)Ljava/lang/Double;
|
||||||
|
public synthetic fun get ([I)Ljava/lang/Object;
|
||||||
|
public static fun get-impl (Lorg/jetbrains/bio/viktor/F64Array;[I)Ljava/lang/Double;
|
||||||
|
public fun getDimension ()I
|
||||||
|
public static fun getDimension-impl (Lorg/jetbrains/bio/viktor/F64Array;)I
|
||||||
|
public final fun getF64Buffer ()Lorg/jetbrains/bio/viktor/F64Array;
|
||||||
|
public fun getFeature (Lkotlin/reflect/KClass;)Ljava/lang/Object;
|
||||||
|
public static fun getFeature-impl (Lorg/jetbrains/bio/viktor/F64Array;Lkotlin/reflect/KClass;)Ljava/lang/Object;
|
||||||
|
public fun getShape ()[I
|
||||||
|
public static fun getShape-impl (Lorg/jetbrains/bio/viktor/F64Array;)[I
|
||||||
|
public fun hashCode ()I
|
||||||
|
public static fun hashCode-impl (Lorg/jetbrains/bio/viktor/F64Array;)I
|
||||||
|
public fun set ([ID)V
|
||||||
|
public synthetic fun set ([ILjava/lang/Object;)V
|
||||||
|
public static fun set-impl (Lorg/jetbrains/bio/viktor/F64Array;[ID)V
|
||||||
|
public fun toString ()Ljava/lang/String;
|
||||||
|
public static fun toString-impl (Lorg/jetbrains/bio/viktor/F64Array;)Ljava/lang/String;
|
||||||
|
public final synthetic fun unbox-impl ()Lorg/jetbrains/bio/viktor/F64Array;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class kscience/kmath/viktor/ViktorNDStructureKt {
|
||||||
|
public static final fun ViktorNDField ([I)Lkscience/kmath/viktor/ViktorNDField;
|
||||||
|
public static final fun asStructure (Lorg/jetbrains/bio/viktor/F64Array;)Lorg/jetbrains/bio/viktor/F64Array;
|
||||||
|
}
|
||||||
|
|
@ -8,3 +8,7 @@ dependencies {
|
|||||||
api(project(":kmath-core"))
|
api(project(":kmath-core"))
|
||||||
api("org.jetbrains.bio:viktor:1.0.1")
|
api("org.jetbrains.bio:viktor:1.0.1")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readme{
|
||||||
|
maturity = ru.mipt.npm.gradle.Maturity.DEVELOPMENT
|
||||||
|
}
|
@ -8,8 +8,8 @@ pluginManagement {
|
|||||||
maven("https://dl.bintray.com/kotlin/kotlinx")
|
maven("https://dl.bintray.com/kotlin/kotlinx")
|
||||||
}
|
}
|
||||||
|
|
||||||
val toolsVersion = "0.7.3-1.4.30-RC"
|
val toolsVersion = "0.7.5"
|
||||||
val kotlinVersion = "1.4.30-RC"
|
val kotlinVersion = "1.4.30"
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("kotlinx.benchmark") version "0.2.0-dev-20"
|
id("kotlinx.benchmark") version "0.2.0-dev-20"
|
||||||
|
Loading…
Reference in New Issue
Block a user