diff --git a/LICENSE b/LICENSE index 8541f77f..2f682441 100644 --- a/LICENSE +++ b/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2000-2021 JetBrains s.r.o. + Copyright 2000-2022 JetBrains s.r.o. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index e54dedc4..4a0f3847 100644 --- a/README.md +++ b/README.md @@ -8,12 +8,13 @@ Multidimensional array library for Kotlin. ## Modules -* multik-core — contains ndarrays, methods called on them and [math], [stat] and [linalg] interfaces. -* multik-default — implementation including `jvm` and `native` for performance. -* multik-kotlin — implementation of [math], [stat] and [linalg] interfaces on JVM. -* multik-openblas — implementation of [math], [stat] and [linalg] interfaces in native code using OpenBLAS. +* `multik-core` — contains ndarrays, methods called on them and [math], [stat] and [linalg] interfaces. +* `multik-default` — implementation including `multik-kotlin` and `multik-openblas` for performance. +* `multik-kotlin` — implementation of [math], [stat] and [linalg] interfaces on JVM. +* `multik-openblas` — implementation of [math], [stat] and [linalg] interfaces in native code using OpenBLAS. ## Using in your projects +### Gradle In your Gradle build script: 1. Add the Maven Central Repository. 2. Add the `org.jetbrains.kotlinx:multik-core:$multik_version` api dependency. @@ -27,8 +28,8 @@ repositories { } dependencies { - implementation "org.jetbrains.kotlinx:multik-core:0.1.1" - implementation "org.jetbrains.kotlinx:multik-default:0.1.1" + implementation "org.jetbrains.kotlinx:multik-core:0.2.0" + implementation "org.jetbrains.kotlinx:multik-default:0.2.0" } ``` @@ -39,11 +40,73 @@ repositories { } dependencies { - implementation("org.jetbrains.kotlinx:multik-core:0.1.1") - implementation("org.jetbrains.kotlinx:multik-default:0.1.1") + implementation("org.jetbrains.kotlinx:multik-core:0.2.0") + implementation("org.jetbrains.kotlinx:multik-default:0.2.0") } ``` +For a multiplatform project, set the dependency in a common block: + +```kotlin +kotlin { + sourceSets { + val commonMain by getting { + dependencies { + implementation("org.jetbrains.kotlinx:multik-core:0.2.0") + } + } + } +} +``` + +or in a platform-specific block: + +```kotlin +kotlin { + sourceSets { + val jvmName by getting { + dependencies { + implementation("org.jetbrains.kotlinx:multik-core-jvm:0.2.0") + } + } + } +} +``` + +### Jupyter Notebook +Install [Kotlin kernel](https://github.com/Kotlin/kotlin-jupyter) for +[Jupyter](https://jupyter.org/) +or just visit to [Datalore](https://datalore.jetbrains.com/). + +Import stable `multik` version into notebook: +``` +%use multik +``` + +## Support platforms + +| Platforms | `multik-core` | `multik-kotlin` | `multik-openblas` | `multik-default` | +|:---------------------:|:------------------:|:------------------:|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| +| **JS** | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | +| **linuxX64** | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| **mingwX64** | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| **macosX64** | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| **macosArm64** | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| **iosArm64** | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | +| **iosX64** | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | +| **iosSimulatorArm64** | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | +| **JVM** | :white_check_mark: | :white_check_mark: | linuxX64 - :white_check_mark:
mingwX64 - :white_check_mark:
macosX64 - :white_check_mark:
macosArm64 - :white_check_mark:
androidArm64 - :white_check_mark: | linuxX64 - :white_check_mark:
mingwX64 - :white_check_mark:
macosX64 - :white_check_mark:
macosArm64 - :white_check_mark:
androidArm64 - :white_check_mark: | + +For Kotlin/JS, we use the new [IR](https://kotlinlang.org/docs/js-ir-compiler.html). +We also use the [new memory model](https://blog.jetbrains.com/kotlin/2021/08/try-the-new-kotlin-native-memory-manager-development-preview/) +in Kotlin/Native. Keep this in mind when using Multik in your multiplatform projects. + +**Note**: +* on ubuntu 18.04 and older `multik-openblas` doesn't work due to older versions of _**glibc**_. +* `multik-openblas` for desktop targets (_linuxX64_, _mingwX64_, _macosX64_, _macosArm64_) is experimental and unstable. +We will improve stability and perfomance as _Kotlin/Native_ evolves. +* JVM target `multik-openblas` for Android only supports **arm64-v8a** processors. + ## Quickstart Visit [Multik documentation](https://kotlin.github.io/multik) for a detailed feature overview. @@ -153,6 +216,12 @@ f * d // multiplication ``` #### Array mathematics + +See documentation for other methods of +[mathematics](https://kotlin.github.io/multik/multik-core/org.jetbrains.kotlinx.multik.api.math/index.html), +[linear algebra](https://kotlin.github.io/multik/multik-core/org.jetbrains.kotlinx.multik.api.linalg/index.html), +[statistics](https://kotlin.github.io/multik/multik-core/org.jetbrains.kotlinx.multik.api.stat/index.html). + ```kotlin a.sin() // element-wise sin, equivalent to mk.math.sin(a) a.cos() // element-wise cos, equivalent to mk.math.cos(a) @@ -161,8 +230,6 @@ b.exp() // element-wise exp, equivalent to mk.math.exp(b) d dot e // dot product, equivalent to mk.linalg.dot(d, e) ``` -See [documentation](https://kotlin.github.io/multik) for other linear algebra methods. - #### Aggregate functions ```kotlin mk.math.sum(c) // array-wise sum @@ -230,18 +297,15 @@ a.inplace { ``` ## Building -Multik uses BLAS and LAPACK for implementing algebraic operations. -Therefore, you would need a C ++ compiler and gfortran. +To build the entire project, you need to set up an environment for building `multik-openblas`: +* JDK 1.8 or higher +* _JAVA_HOME_ environment - to search for jni files +* Compilers _gcc_, _g++_, _gfortran_ version 8 or higher. +It is important that they are of the same version. + Run `./gradlew assemble` to build all modules. -* To build api module run `./gradlew multik-core:assemble`. -* To build jvm module run `./gradlew multik-kotlin:assemble`. -* To build native module run `./gradlew multik-openblas:assemble`. -To reuse `multik-openblas` in the future, you must first build `multik_jni` and place the native library in -`multik-openblas/build/libs` -* To build default module run `./gradlew multik-openblas:assemble` then `./gradlew multik-default:assemble`. - -## Testing -`./gradlew test` +If you don't need to build `multik-openblas`, +just disable the `cmake_build` task and build the module you need. ## Contributing There is an opportunity to contribute to the project: diff --git a/build.gradle.kts b/build.gradle.kts index 58d45d49..9bf4d567 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ import java.time.Duration diff --git a/gradle.properties b/gradle.properties index a5b83270..d9ad1910 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ kotlin.code.style=official -multik_version=0.2.0-dev-4 +multik_version=0.2.0 # Kotlin systemProp.kotlin_version=1.7.10 @@ -7,7 +7,7 @@ group=org.jetbrains.kotlinx # Dependencies systemProp.nexus_version=1.1.0 -systemProp.dokka_version=1.6.0 +systemProp.dokka_version=1.7.10 openblas_version=0.3.19 common_csv_version=1.9.0 diff --git a/gradle/publish.gradle b/gradle/publish.gradle index d2b8161c..8b1f090e 100644 --- a/gradle/publish.gradle +++ b/gradle/publish.gradle @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 85b299a2..ffbf66c2 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ #Thu Apr 09 14:05:51 MSK 2020 -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStorePath=wrapper/dists diff --git a/multik-core/build.gradle.kts b/multik-core/build.gradle.kts index 4744bf82..dc47d888 100644 --- a/multik-core/build.gradle.kts +++ b/multik-core/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ plugins { @@ -87,15 +87,22 @@ kotlin { tasks.dokkaHtml.configure { outputDirectory.set(rootProject.buildDir.resolve("dokka")) + suppressObviousFunctions.set(true) + suppressInheritedMembers.set(true) dokkaSourceSets { configureEach { - includeNonPublic.set(false) - skipEmptyPackages.set(false) + documentedVisibilities.set( + setOf( + org.jetbrains.dokka.DokkaConfiguration.Visibility.PUBLIC, + org.jetbrains.dokka.DokkaConfiguration.Visibility.PROTECTED + ) + ) + skipDeprecated.set(false) jdkVersion.set(8) noStdlibLink.set(false) noJdkLink.set(false) - samples.from(files("src/test/kotlin/samples/creation.kt")) + samples.from(files("src/commonTest/kotlin/samples/creation.kt")) } } } \ No newline at end of file diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/CreateNDArray.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/CreateNDArray.kt index 7999c964..f01c9610 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/CreateNDArray.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/CreateNDArray.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.api @@ -15,10 +15,6 @@ import kotlin.math.ceil /** * Returns a new zero array with the specified shape. - * - * @param dims shape of the array. - * @return [NDArray] of [D] dimension - * @sample samples.NDArrayTest.empty */ @Deprecated("Use zeros instead.", ReplaceWith("mk.zeros(dims)")) public inline fun Multik.empty(vararg dims: Int): NDArray { @@ -34,11 +30,6 @@ public inline fun Multik.empty(vararg d * Returns a new zero array of type [dtype] with the specified shape. * * Note: Generic type of elements [T] must match [dtype]. - * - * @param dims shape of the array. - * @param dtype array type. - * @return [NDArray] of [D] dimension. - * @sample samples.NDArrayTest.emptyWithDtype */ @Deprecated("Use zeros instead.", ReplaceWith("mk.zeros(dims)")) public fun Multik.empty(dims: IntArray, dtype: DataType): NDArray { @@ -50,25 +41,52 @@ public fun Multik.empty(dims: IntArray, dtype: DataType): NDA } /** - * Returns a new zero array of type [T] with the specified shape. + * Returns a new zero array of 1 dim of type [T] with [dim1] size. + * + * @sample samples.NDArrayTest.zerosD1 */ public inline fun Multik.zeros(dim1: Int): D1Array = zeros(intArrayOf(dim1), DataType.ofKClass(T::class)) +/** + * Returns a new zero array of 2 dim of type [T] with ([dim1], [dim2]) shape. + * + * @sample samples.NDArrayTest.zerosD2 + */ public inline fun Multik.zeros(dim1: Int, dim2: Int): D2Array = zeros(intArrayOf(dim1, dim2), DataType.ofKClass(T::class)) +/** + * Returns a new zero array of 3 dim of type [T] with ([dim1], [dim2], [dim3]) shape. + * + * @sample samples.NDArrayTest.zerosD3 + */ public inline fun Multik.zeros(dim1: Int, dim2: Int, dim3: Int): D3Array = zeros(intArrayOf(dim1, dim2, dim3), DataType.ofKClass(T::class)) +/** + * Returns a new zero array of 4 dim of type [T] with ([dim1], [dim2], [dim3], [dim4]) shape. + * + * @sample samples.NDArrayTest.zerosD4 + */ public inline fun Multik.zeros(dim1: Int, dim2: Int, dim3: Int, dim4: Int): D4Array = zeros(intArrayOf(dim1, dim2, dim3, dim4), DataType.ofKClass(T::class)) +/** + * Returns a new zero array of N dim of type [T] with ([dim1], [dim2], [dim3], [dim4], [dims]) shape. + * + * @sample samples.NDArrayTest.zerosDN + */ public inline fun Multik.zeros( dim1: Int, dim2: Int, dim3: Int, dim4: Int, vararg dims: Int ): NDArray = zeros(intArrayOf(dim1, dim2, dim3, dim4) + dims, DataType.ofKClass(T::class)) +/** + * Returns a new zero array of type [T] with specify shape. + * + * @sample samples.NDArrayTest.zerosDNWithDtype + */ public fun Multik.zeros(dims: IntArray, dtype: DataType): NDArray { val dim = dimensionOf(dims.size) requireDimension(dim, dims.size) @@ -78,25 +96,52 @@ public fun Multik.zeros(dims: IntArray, dtype: DataType): NDA } /** - * Returns a new ones array of type [T] with the specified shape. + * Returns a new ones array of 1 dim of type [T] with [dim1] size. + * + * @sample samples.NDArrayTest.onesD1 */ public inline fun Multik.ones(dim1: Int): D1Array = ones(intArrayOf(dim1), DataType.ofKClass(T::class)) +/** + * Returns a new ones array of 2 dim of type [T] with ([dim1], [dim2]) shape. + * + * @sample samples.NDArrayTest.onesD2 + */ public inline fun Multik.ones(dim1: Int, dim2: Int): D2Array = ones(intArrayOf(dim1, dim2), DataType.ofKClass(T::class)) +/** + * Returns a new ones array of 3 dim of type [T] with ([dim1], [dim2], [dim3]) shape. + * + * @sample samples.NDArrayTest.onesD3 + */ public inline fun Multik.ones(dim1: Int, dim2: Int, dim3: Int): D3Array = ones(intArrayOf(dim1, dim2, dim3), DataType.ofKClass(T::class)) +/** + * Returns a new ones array of 4 dim of type [T] with ([dim1], [dim2], [dim3], [dim4]) shape. + * + * @sample samples.NDArrayTest.onesD4 + */ public inline fun Multik.ones(dim1: Int, dim2: Int, dim3: Int, dim4: Int): D4Array = ones(intArrayOf(dim1, dim2, dim3, dim4), DataType.ofKClass(T::class)) +/** + * Returns a new ones array of N dim of type [T] with ([dim1], [dim2], [dim3], [dim4], [dims]) shape. + * + * @sample samples.NDArrayTest.onesDN + */ public inline fun Multik.ones( dim1: Int, dim2: Int, dim3: Int, dim4: Int, vararg dims: Int ): NDArray = ones(intArrayOf(dim1, dim2, dim3, dim4) + dims, DataType.ofKClass(T::class)) +/** + * Returns a new ones array of N dim of type [T] with specify shape. + * + * @sample samples.NDArrayTest.onesDNWithDtype + */ @Suppress("IMPLICIT_CAST_TO_ANY", "UNCHECKED_CAST") public fun Multik.ones(dims: IntArray, dtype: DataType): NDArray { val dim = dimensionOf(dims.size) @@ -1216,12 +1261,11 @@ public inline fun Multik.d1array(sizeD1: Int, noinline init: ( } /** - * Returns a 2-dimensions array. + * Creates a new array of the specified ([sizeD1], [sizeD2]) shape, where each element is calculated by calling + * the specified [init] function. * - * @param sizeD1 value of 1-dimension. - * @param sizeD2 value of 2-dimension. - * @param init initialization function. - * @return [D2Array]. + * The function [init] is called for each array element sequentially starting from the first one. + * It should return the value for an array element given its index. * @sample samples.NDArrayTest.d2array */ public inline fun Multik.d2array(sizeD1: Int, sizeD2: Int, noinline init: (Int) -> T): D2Array { @@ -1235,7 +1279,12 @@ public inline fun Multik.d2array(sizeD1: Int, sizeD2: Int, noi } /** + * Creates a new 2-dimensions array of the specified ([sizeD1], [sizeD2]) shape, where each element is calculated by calling + * the specified [init] function. * + * The function [init] is called for each array element sequentially starting from the first one. + * It should return the value for an array element given its indices. + * @sample samples.NDArrayTest.d2arrayIndices */ public inline fun Multik.d2arrayIndices( sizeD1: Int, sizeD2: Int, init: (i: Int, j: Int) -> T @@ -1255,13 +1304,11 @@ public inline fun Multik.d2arrayIndices( } /** - * Returns a 3-dimensions array. + * Creates a new 3-dimensions array of the specified ([sizeD1], [sizeD2], [sizeD3]) shape, where each element is calculated by calling + * the specified [init] function. * - * @param sizeD1 value of 1-dimension. - * @param sizeD2 value of 2-dimension. - * @param sizeD3 value of 3-dimension. - * @param init initialization function. - * @return [D3Array]. + * The function [init] is called for each array element sequentially starting from the first one. + * It should return the value for an array element given its index. * @sample samples.NDArrayTest.d3array */ public inline fun Multik.d3array( @@ -1277,7 +1324,12 @@ public inline fun Multik.d3array( } /** + * Creates a new 3-dimensions array of the specified ([sizeD1], [sizeD2], [sizeD3]) shape, where each element is calculated by calling + * the specified [init] function. * + * The function [init] is called for each array element sequentially starting from the first one. + * It should return the value for an array element given its indices. + * @sample samples.NDArrayTest.d3arrayIndices */ public inline fun Multik.d3arrayIndices( sizeD1: Int, sizeD2: Int, sizeD3: Int, init: (i: Int, j: Int, k: Int) -> T @@ -1301,14 +1353,11 @@ public inline fun Multik.d3arrayIndices( } /** - * Returns a 4-dimensions array. + * Creates a new 4-dimensions array of the specified ([sizeD1], [sizeD2], [sizeD3], [sizeD4]) shape, + * where each element is calculated by calling the specified [init] function. * - * @param sizeD1 value of 1-dimension. - * @param sizeD2 value of 2-dimension. - * @param sizeD3 value of 3-dimension. - * @param sizeD4 value of 4-dimension. - * @param init initialization function. - * @return [D4Array]. + * The function [init] is called for each array element sequentially starting from the first one. + * It should return the value for an array element given its index. * @sample samples.NDArrayTest.d4array */ public inline fun Multik.d4array( @@ -1323,6 +1372,14 @@ public inline fun Multik.d4array( return D4Array(data, shape = shape, dim = D4) } +/** + * Creates a new 4-dimensions array of the specified ([sizeD1], [sizeD2], [sizeD3], [sizeD4]) shape, + * where each element is calculated by calling the specified [init] function. + * + * The function [init] is called for each array element sequentially starting from the first one. + * It should return the value for an array element given its indices. + * @sample samples.NDArrayTest.d4arrayIndices + */ public inline fun Multik.d4arrayIndices( sizeD1: Int, sizeD2: Int, sizeD3: Int, sizeD4: Int, init: (i: Int, j: Int, k: Int, m: Int) -> T ): D4Array { @@ -1347,16 +1404,11 @@ public inline fun Multik.d4arrayIndices( } /** - * Returns a new array with the specified shape, where each element is calculated by calling the specified - * [init] function. + * Creates a new 4-dimensions array of the specified ([sizeD1], [sizeD2], [sizeD3], [sizeD4], [dims]) shape, + * where each element is calculated by calling the specified [init] function. * - * @param sizeD1 value of 1-dimension. - * @param sizeD2 value of 2-dimension. - * @param sizeD3 value of 3-dimension. - * @param sizeD4 value of 4-dimension. - * @param dims values other dimensions. - * @param init initialization function. - * @return [NDArray] of [DN] dimension. + * The function [init] is called for each array element sequentially starting from the first one. + * It should return the value for an array element given its index. * @sample samples.NDArrayTest.dnarray */ public inline fun Multik.dnarray( @@ -1367,9 +1419,6 @@ public inline fun Multik.dnarray( * Returns a new array with the specified [shape], where each element is calculated by calling the specified * [init] function. * - * @param shape array shape. - * @param init initialization function. - * @return [NDArray] of [DN] dimension. * @sample samples.NDArrayTest.dnarrayWithDims */ public inline fun Multik.dnarray( @@ -1388,18 +1437,36 @@ public inline fun Multik.dnarray( /** * Returns a new 1-dimension array from [items]. - * - * @param items specified elements. - * @return [D1Array]. - * @sample samples.NDArrayTest.ndarrayOf */ public fun Multik.ndarrayOf(vararg items: Byte): D1Array = ndarrayOfCommon(items.toTypedArray(), DataType.ByteDataType) +/** + * Returns a new 1-dimension array from [items]. + */ public fun Multik.ndarrayOf(vararg items: Short): D1Array = ndarrayOfCommon(items.toTypedArray(), DataType.ShortDataType) +/** + * Returns a new 1-dimension array from [items]. + * @sample samples.NDArrayTest.ndarrayOf + */ public fun Multik.ndarrayOf(vararg items: Int): D1Array = ndarrayOfCommon(items.toTypedArray(), DataType.IntDataType) +/** + * Returns a new 1-dimension array from [items]. + */ public fun Multik.ndarrayOf(vararg items: Long): D1Array = ndarrayOfCommon(items.toTypedArray(), DataType.LongDataType) +/** + * Returns a new 1-dimension array from [items]. + */ public fun Multik.ndarrayOf(vararg items: Float): D1Array = ndarrayOfCommon(items.toTypedArray(), DataType.FloatDataType) +/** + * Returns a new 1-dimension array from [items]. + */ public fun Multik.ndarrayOf(vararg items: Double): D1Array = ndarrayOfCommon(items.toTypedArray(), DataType.DoubleDataType) +/** + * Returns a new 1-dimension array from [items]. + */ public fun Multik.ndarrayOf(vararg items: ComplexFloat): D1Array = ndarrayOfCommon(items, DataType.ComplexFloatDataType) +/** + * Returns a new 1-dimension array from [items]. + */ public fun Multik.ndarrayOf(vararg items: ComplexDouble): D1Array = ndarrayOfCommon(items, DataType.ComplexDoubleDataType) @@ -1509,6 +1576,9 @@ public inline fun Multik.linspace(start: Double, stop: Doub return ret.asType() } +/** + * Return coordinate matrices from coordinate vectors. + */ public fun Multik.meshgrid(x: MultiArray, y: MultiArray): Pair, D2Array> = Pair(mk.stack(List(y.size) { x }), mk.stack(List(x.size) { y }, axis = 1)) diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/Engine.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/Engine.kt index ec108cd1..6eb38ab4 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/Engine.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/Engine.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.api @@ -8,19 +8,39 @@ import org.jetbrains.kotlinx.multik.api.linalg.LinAlg import org.jetbrains.kotlinx.multik.api.math.Math import org.jetbrains.kotlinx.multik.api.stat.Statistics +/** + * Type engine implementations. + * + * @param name engine type name + */ public sealed class EngineType(public val name: String) +/** + * Engine type for default implementation. + */ public object DefaultEngineType : EngineType("DEFAULT") +/** + * Engine type for "pure kotlin" implementation. + */ public object KEEngineType : EngineType("KOTLIN") +/** + * Engine type for implementation with OpenBLAS. + */ public object NativeEngineType : EngineType("NATIVE") +/** + * Engine provider. + */ public expect fun enginesProvider(): Map /** * This class gives access to different implementations of [LinAlg], [Math], [Statistics]. * When initializing [Multik], it loads engines, by default `DEFAULT` implementation is used. + * + * @property name engine name + * @property type [EngineType] */ public abstract class Engine { diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/Multik.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/Multik.kt index 18d1373f..1d0769a2 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/Multik.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/Multik.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.api diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/LinAlg.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/LinAlg.kt index fc6e58d4..c521c5e5 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/LinAlg.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/LinAlg.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.api.linalg @@ -14,6 +14,9 @@ import org.jetbrains.kotlinx.multik.ndarray.data.NDArray */ public interface LinAlg { + /** + * instance of [LinAlgEx] + */ public val linAlgEx: LinAlgEx /** @@ -21,8 +24,4 @@ public interface LinAlg { */ public fun pow(mat: MultiArray, n: Int): NDArray -// /** -// * Matrix ov vector norm. The default is Frobenius norm. -// */ -// public fun norm(mat: MultiArray, p: Int = 2): Double } \ No newline at end of file diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/LinAlgEx.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/LinAlgEx.kt index a263b8d7..a7cc405c 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/LinAlgEx.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/LinAlgEx.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.api.linalg @@ -13,38 +13,121 @@ import org.jetbrains.kotlinx.multik.ndarray.data.* * Extension interface for [LinAlg] for improved type support. */ public interface LinAlgEx { + /** + * Returns inverse of a double matrix from numeric matrix + */ public fun inv(mat: MultiArray): NDArray + /** + * Returns inverse float matrix + */ public fun invF(mat: MultiArray): NDArray + /** + * Returns inverse complex matrix + */ public fun invC(mat: MultiArray): NDArray + /** + * Solve a linear matrix equation, or system of linear scalar equations. + */ public fun solve(a: MultiArray, b: MultiArray): NDArray + /** + * Solve a linear matrix equation, or system of linear scalar equations. + */ public fun solveF(a: MultiArray, b: MultiArray): NDArray + /** + * Solve a linear matrix equation, or system of linear scalar equations. + */ public fun solveC(a: MultiArray, b: MultiArray): NDArray + /** + * Returns norm of float matrix + */ public fun normF(mat: MultiArray, norm: Norm = Norm.Fro): Float - + /** + * Returns norm of double matrix + */ public fun norm(mat: MultiArray, norm: Norm = Norm.Fro): Double + /** + * Returns QR decomposition of the numeric matrix + */ public fun qr(mat: MultiArray): Pair, D2Array> + /** + * Returns QR decomposition of the float matrix + */ public fun qrF(mat: MultiArray): Pair, D2Array> + /** + * Returns QR decomposition of the complex matrix + */ public fun qrC(mat: MultiArray): Pair, D2Array> + /** + * Returns PLU decomposition of the numeric matrix + */ public fun plu(mat: MultiArray): Triple, D2Array, D2Array> + /** + * Returns PLU decomposition of the float matrix + */ public fun pluF(mat: MultiArray): Triple, D2Array, D2Array> + /** + * Returns PLU decomposition of the complex matrix + */ public fun pluC(mat: MultiArray): Triple, D2Array, D2Array> + /** + * Calculates the eigenvalues and eigenvectors of a numeric matrix + * @return a pair of a vector of eigenvalues and a matrix of eigenvectors + */ public fun eig(mat: MultiArray): Pair, D2Array> + /** + * Calculates the eigenvalues and eigenvectors of a float matrix + * @return a pair of a vector of eigenvalues and a matrix of eigenvectors + */ public fun eigF(mat: MultiArray): Pair, D2Array> + /** + * Calculates the eigenvalues and eigenvectors of a complex matrix + * @return a pair of a vector of eigenvalues and a matrix of eigenvectors + */ public fun eigC(mat: MultiArray): Pair, D2Array> + /** + * Calculates the eigenvalues of a numeric matrix. + * @return [ComplexDouble] vector + */ public fun eigVals(mat: MultiArray): D1Array + /** + * Calculates the eigenvalues of a float matrix + * @return [ComplexFloat] vector + */ public fun eigValsF(mat: MultiArray): D1Array + /** + * Calculates the eigenvalues of a float matrix + * @return complex vector + */ public fun eigValsC(mat: MultiArray): D1Array + /** + * Dot products of two number matrices. + */ public fun dotMM(a: MultiArray, b: MultiArray): NDArray + /** + * Dot products of two complex matrices. + */ public fun dotMMComplex(a: MultiArray, b: MultiArray): NDArray + /** + * Dot products of number matrix and number vector. + */ public fun dotMV(a: MultiArray, b: MultiArray): NDArray + /** + * Dot products of complex matrix and complex vector. + */ public fun dotMVComplex(a: MultiArray, b: MultiArray): NDArray + /** + * Dot products of two number vectors. Scalar product. + */ public fun dotVV(a: MultiArray, b: MultiArray): T + /** + * Dot products of two complex vectors. Scalar product. + */ public fun dotVVComplex(a: MultiArray, b: MultiArray): T } \ No newline at end of file diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/NormClassification.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/NormClassification.kt index 72cd3b18..50133ba0 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/NormClassification.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/NormClassification.kt @@ -1,8 +1,32 @@ +/* + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + package org.jetbrains.kotlinx.multik.api.linalg +/** + * Matrix norm types. + * + * @property lapackCode value for lapack + */ public enum class Norm(public val lapackCode: Char) { + /** + * max(abs(A(i,j))) + */ Max('M'), + + /** + * denotes the one norm of a matrix (maximum column sum) + */ N1('1'), + + /** + * denotes the infinity norm of a matrix (maximum row sum) + */ Inf('I'), + + /** + * denotes the Frobenius norm of a matrix (square root of sum of squares) + */ Fro('F') } \ No newline at end of file diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/_linalg.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/_linalg.kt index b6be0bb4..5a29c51b 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/_linalg.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/_linalg.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.api.linalg @@ -12,20 +12,50 @@ import org.jetbrains.kotlinx.multik.ndarray.data.MultiArray import org.jetbrains.kotlinx.multik.ndarray.data.NDArray import kotlin.jvm.JvmName +/** + * Returns the matrix product of two numeric matrices. + * + * same as [LinAlg.dot] + */ @JvmName("dotDefMMNumber") public infix fun MultiArray.dot(b: MultiArray): NDArray = mk.linalg.linAlgEx.dotMM(this, b) +/** + * Returns the matrix product of two complex matrices. + * + * same as [LinAlg.dot] + */ @JvmName("dotDefMMComplex") public infix fun MultiArray.dot(b: MultiArray): NDArray = mk.linalg.linAlgEx.dotMMComplex(this, b) +/** + * Returns the matrix product of a numeric matrix and a numeric vector. + * + * same as [LinAlg.dot] + */ @JvmName("dotDefMVNumber") public infix fun MultiArray.dot(b: MultiArray): NDArray = mk.linalg.linAlgEx.dotMV(this, b) +/** + * Returns the matrix product of a complex matrix and a complex vector. + * + * same as [LinAlg.dot] + */ @JvmName("dotDefMVComplex") public infix fun MultiArray.dot(b: MultiArray): NDArray = mk.linalg.linAlgEx.dotMVComplex(this, b) +/** + * Returns the product of two numeric vectors. + * + * same as [LinAlg.dot] + */ @JvmName("dotDefVVNumber") public infix fun MultiArray.dot(b: MultiArray): T = mk.linalg.linAlgEx.dotVV(this, b) +/** + * Returns the product of two complex vectors. + * + * same as [LinAlg.dot] + */ @JvmName("dotDefVVComplex") public infix fun MultiArray.dot(b: MultiArray): T = mk.linalg.linAlgEx.dotVVComplex(this, b) \ No newline at end of file diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/dot.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/dot.kt index c9298e05..87f16f04 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/dot.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/dot.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.api.linalg diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/eigvals.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/eigvals.kt index 069d071c..2bc22845 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/eigvals.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/eigvals.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.api.linalg diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/inverse.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/inverse.kt index b2f48d53..1cdfd3ce 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/inverse.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/inverse.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.api.linalg diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/norm.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/norm.kt index 78d6e7eb..835a99ed 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/norm.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/norm.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + package org.jetbrains.kotlinx.multik.api.linalg import org.jetbrains.kotlinx.multik.ndarray.data.D2 @@ -11,7 +15,7 @@ import kotlin.jvm.JvmName public fun LinAlg.norm(mat: MultiArray, norm: Norm = Norm.Fro): Float = this.linAlgEx.normF(mat, norm) /** - * Returns norm of float matrix + * Returns norm of double matrix */ @JvmName("normD") public fun LinAlg.norm(mat: MultiArray, norm: Norm = Norm.Fro): Double = this.linAlgEx.norm(mat, norm) diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/plu.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/plu.kt index 90cd66f7..be30627e 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/plu.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/plu.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.api.linalg diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/qr.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/qr.kt index 2ac206b9..fb0da1f7 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/qr.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/qr.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.api.linalg diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/solve.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/solve.kt index 8aadf889..46c4f2c1 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/solve.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/linalg/solve.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.api.linalg @@ -12,13 +12,17 @@ import org.jetbrains.kotlinx.multik.ndarray.data.NDArray import kotlin.jvm.JvmName /** - * Returns the solution to a system of linear equations + * Solves a linear matrix equation, or system of linear scalar equations. */ @JvmName("solveF") public fun LinAlg.solve(a: MultiArray, b: MultiArray): NDArray = this.linAlgEx.solveF(a, b) - +/** + * Solves a linear matrix equation, or system of linear scalar equations. + */ @JvmName("solveD") public fun LinAlg.solve(a: MultiArray, b: MultiArray): NDArray = this.linAlgEx.solve(a, b) - +/** + * Solves a linear matrix equation, or system of linear scalar equations. + */ @JvmName("solveC") public fun LinAlg.solve(a: MultiArray, b: MultiArray): NDArray = this.linAlgEx.solveC(a, b) \ No newline at end of file diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/Math.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/Math.kt index 9723a473..f4716603 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/Math.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/Math.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.api.math @@ -11,6 +11,9 @@ import org.jetbrains.kotlinx.multik.ndarray.data.* */ public interface Math { + /** + * instance of [MathEx] + */ public val mathEx: MathEx /** diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/MathEx.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/MathEx.kt index 115212ae..6e461a9b 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/MathEx.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/MathEx.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.api.math @@ -14,23 +14,71 @@ import org.jetbrains.kotlinx.multik.ndarray.data.NDArray * Extension interface for [Math] for improved type support. */ public interface MathEx { + /** + * Returns a ndarray of Double from the given ndarray to each element of which an exp function has been applied. + */ public fun exp(a: MultiArray): NDArray + /** + * Returns a ndarray of Float from the given ndarray to each element of which an exp function has been applied. + */ public fun expF(a: MultiArray): NDArray + /** + * Returns a ndarray of [ComplexFloat] from the given ndarray to each element of which an exp function has been applied. + */ public fun expCF(a: MultiArray): NDArray + /** + * Returns a ndarray of [ComplexDouble] from the given ndarray to each element of which an exp function has been applied. + */ public fun expCD(a: MultiArray): NDArray + /** + * Returns a ndarray of Double from the given ndarray to each element of which a log function has been applied. + */ public fun log(a: MultiArray): NDArray + /** + * Returns a ndarray of Float from the given ndarray to each element of which a log function has been applied. + */ public fun logF(a: MultiArray): NDArray + /** + * Returns a ndarray of [ComplexFloat] from the given ndarray to each element of which a log function has been applied. + */ public fun logCF(a: MultiArray): NDArray + /** + * Returns a ndarray of [ComplexDouble] from the given ndarray to each element of which a log function has been applied. + */ public fun logCD(a: MultiArray): NDArray + /** + * Returns an ndarray of Double from the given ndarray to each element of which a sin function has been applied. + */ public fun sin(a: MultiArray): NDArray + /** + * Returns an ndarray of Float from the given ndarray to each element of which a sin function has been applied. + */ public fun sinF(a: MultiArray): NDArray + /** + * Returns an ndarray of [ComplexFloat] from the given ndarray to each element of which a sin function has been applied. + */ public fun sinCF(a: MultiArray): NDArray + /** + * Returns an ndarray of [ComplexDouble] from the given ndarray to each element of which a sin function has been applied. + */ public fun sinCD(a: MultiArray): NDArray + /** + * Returns a ndarray of Double from the given ndarray to each element of which a cos function has been applied. + */ public fun cos(a: MultiArray): NDArray + /** + * Returns a ndarray of Float from the given ndarray to each element of which a cos function has been applied. + */ public fun cosF(a: MultiArray): NDArray + /** + * Returns a ndarray of [ComplexFloat] from the given ndarray to each element of which a cos function has been applied. + */ public fun cosCF(a: MultiArray): NDArray + /** + * Returns a ndarray of [ComplexDouble] from the given ndarray to each element of which a cos function has been applied. + */ public fun cosCD(a: MultiArray): NDArray } \ No newline at end of file diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/_math.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/_math.kt index 8e89447f..8bddd392 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/_math.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/_math.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.api.math @@ -15,71 +15,131 @@ import kotlin.jvm.JvmName /** * Returns flat index of maximum element in an ndarray. + * + * same as [Math.argMax] */ public fun MultiArray.argMax(): Int = mk.math.argMax(this) /** * Returns flat index of minimum element in an ndarray. + * + * same as [Math.argMin] */ public fun MultiArray.argMin(): Int = mk.math.argMin(this) /** * Returns an ndarray of Double from the given ndarray to each element of which an exp function has been applied. + * + * same as [Math.exp] */ @JvmName("expTD") public fun MultiArray.exp(): NDArray = mk.math.exp(this) - +/** + * Returns an ndarray of Float from the given ndarray to each element of which an exp function has been applied. + * + * same as [Math.exp] + */ @JvmName("expFloatD") public fun MultiArray.exp(): NDArray = mk.math.mathEx.expF(this) - +/** + * Returns an ndarray of [ComplexFloat] from the given ndarray to each element of which an exp function has been applied. + * + * same as [Math.exp] + */ @JvmName("expComplexFloatD") public fun MultiArray.exp(): NDArray = mk.math.mathEx.expCF(this) - +/** + * Returns an ndarray of [ComplexDouble] from the given ndarray to each element of which an exp function has been applied. + * + * same as [Math.exp] + */ @JvmName("expComplexDoubleD") public fun MultiArray.exp(): NDArray = mk.math.mathEx.expCD(this) /** * Returns an ndarray of Double from the given ndarray to each element of which a log function has been applied. + * + * same as [Math.log] */ @JvmName("logTD") public fun MultiArray.log(): NDArray = mk.math.mathEx.log(this) - +/** + * Returns an ndarray of Float from the given ndarray to each element of which a log function has been applied. + * + * same as [Math.log] + */ @JvmName("logFloatD") public fun MultiArray.log(): NDArray = mk.math.mathEx.logF(this) - +/** + * Returns an ndarray of [ComplexFloat] from the given ndarray to each element of which a log function has been applied. + * + * same as [Math.log] + */ @JvmName("logComplexFloatD") public fun MultiArray.log(): NDArray = mk.math.mathEx.logCF(this) - +/** + * Returns an ndarray of [ComplexDouble] from the given ndarray to each element of which a log function has been applied. + * + * same as [Math.log] + */ @JvmName("logComplexDoubleD") public fun MultiArray.log(): NDArray = mk.math.mathEx.logCD(this) /** * Returns an ndarray of Double from the given ndarray to each element of which a sin function has been applied. + * + * same as [Math.sin] */ @JvmName("sinTD") public fun MultiArray.sin(): NDArray = mk.math.mathEx.sin(this) - +/** + * Returns an ndarray of Float from the given ndarray to each element of which a sin function has been applied. + * + * same as [Math.sin] + */ @JvmName("sinFloatD") public fun MultiArray.sin(): NDArray = mk.math.mathEx.sinF(this) - +/** + * Returns an ndarray of [ComplexFloat] from the given ndarray to each element of which a sin function has been applied. + * + * same as [Math.sin] + */ @JvmName("sinComplexFloatD") public fun MultiArray.sin(): NDArray = mk.math.mathEx.sinCF(this) - +/** + * Returns an ndarray of [ComplexDouble] from the given ndarray to each element of which a sin function has been applied. + * + * same as [Math.sin] + */ @JvmName("sinComplexDoubleD") public fun MultiArray.sin(): NDArray = mk.math.mathEx.sinCD(this) /** * Returns an ndarray of Double from the given ndarray to each element of which a cos function has been applied. + * + * same as [Math.cos] */ @JvmName("cosTD") public fun MultiArray.cos(): NDArray = mk.math.mathEx.cos(this) - +/** + * Returns an ndarray of Float from the given ndarray to each element of which a cos function has been applied. + * + * same as [Math.cos] + */ @JvmName("cosFloatD") public fun MultiArray.cos(): NDArray = mk.math.mathEx.cosF(this) - +/** + * Returns an ndarray of [ComplexFloat] from the given ndarray to each element of which a cos function has been applied. + * + * same as [Math.cos] + */ @JvmName("cosComplexFloatD") public fun MultiArray.cos(): NDArray = mk.math.mathEx.cosCF(this) - +/** + * Returns an ndarray of [ComplexFloat] from the given ndarray to each element of which a cos function has been applied. + * + * same as [Math.cos] + */ @JvmName("cosComplexDoubleD") public fun MultiArray.cos(): NDArray = mk.math.mathEx.cosCD(this) diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/cos.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/cos.kt index bac88b9a..ea6d3089 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/cos.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/cos.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.api.math @@ -17,11 +17,20 @@ import kotlin.jvm.JvmName @JvmName("cos") public fun Math.cos(a: MultiArray): NDArray = this.mathEx.cos(a) +/** + * Returns a ndarray of Float from the given ndarray to each element of which a cos function has been applied. + */ @JvmName("cosFloat") public fun Math.cos(a: MultiArray): NDArray = this.mathEx.cosF(a) +/** + * Returns a ndarray of [ComplexFloat] from the given ndarray to each element of which a cos function has been applied. + */ @JvmName("cosComplexFloat") public fun Math.cos(a: MultiArray): NDArray = this.mathEx.cosCF(a) +/** + * Returns a ndarray of [ComplexDouble] from the given ndarray to each element of which a cos function has been applied. + */ @JvmName("cosComplexDouble") public fun Math.cos(a: MultiArray): NDArray = this.mathEx.cosCD(a) \ No newline at end of file diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/exp.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/exp.kt index 0ae7a88d..425f20a5 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/exp.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/exp.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.api.math @@ -17,11 +17,20 @@ import kotlin.jvm.JvmName @JvmName("exp") public fun Math.exp(a: MultiArray): NDArray = this.mathEx.exp(a) +/** + * Returns a ndarray of Float from the given ndarray to each element of which an exp function has been applied. + */ @JvmName("expFloat") public fun Math.exp(a: MultiArray): NDArray = this.mathEx.expF(a) +/** + * Returns a ndarray of [ComplexFloat] from the given ndarray to each element of which an exp function has been applied. + */ @JvmName("expComplexFloat") public fun Math.exp(a: MultiArray): NDArray = this.mathEx.expCF(a) +/** + * Returns a ndarray of [ComplexDouble] from the given ndarray to each element of which an exp function has been applied. + */ @JvmName("expComplexDouble") public fun Math.exp(a: MultiArray): NDArray = this.mathEx.expCD(a) \ No newline at end of file diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/log.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/log.kt index 1c57ce34..82448e5b 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/log.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/log.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.api.math @@ -17,11 +17,20 @@ import kotlin.jvm.JvmName @JvmName("log") public fun Math.log(a: MultiArray): NDArray = this.mathEx.log(a) +/** + * Returns a ndarray of Float from the given ndarray to each element of which a log function has been applied. + */ @JvmName("logFloat") public fun Math.log(a: MultiArray): NDArray = this.mathEx.logF(a) +/** + * Returns a ndarray of [ComplexFloat] from the given ndarray to each element of which a log function has been applied. + */ @JvmName("logComplexFloat") public fun Math.log(a: MultiArray): NDArray = this.mathEx.logCF(a) +/** + * Returns a ndarray of [ComplexDouble] from the given ndarray to each element of which a log function has been applied. + */ @JvmName("logComplexDouble") public fun Math.log(a: MultiArray): NDArray = this.mathEx.logCD(a) \ No newline at end of file diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/sin.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/sin.kt index f72813d6..cd8e8c3c 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/sin.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/math/sin.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.api.math @@ -17,11 +17,20 @@ import kotlin.jvm.JvmName @JvmName("sin") public fun Math.sin(a: MultiArray): NDArray = this.mathEx.sin(a) +/** + * Returns an ndarray of Float from the given ndarray to each element of which a sin function has been applied. + */ @JvmName("sinFloat") public fun Math.sin(a: MultiArray): NDArray = this.mathEx.sinF(a) +/** + * Returns an ndarray of [ComplexFloat] from the given ndarray to each element of which a sin function has been applied. + */ @JvmName("sinComplexFloat") public fun Math.sin(a: MultiArray): NDArray = this.mathEx.sinCF(a) +/** + * Returns an ndarray of [ComplexDouble] from the given ndarray to each element of which a sin function has been applied. + */ @JvmName("sinComplexDouble") public fun Math.sin(a: MultiArray): NDArray = this.mathEx.sinCD(a) \ No newline at end of file diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/primitiveArrays.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/primitiveArrays.kt index ba99a040..35ab78dc 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/primitiveArrays.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/primitiveArrays.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.api diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/stat/Statistics.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/stat/Statistics.kt index e4c54463..12fbf23f 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/stat/Statistics.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/api/stat/Statistics.kt @@ -68,6 +68,9 @@ public fun abs(a: MultiArray): NDArray { return NDArray(ret, 0, a.shape.copyOf(), dim = a.dim) } +/** + * Returns the absolute value of the given ndarray [a]. + */ @JvmName("absShort") public fun abs(a: MultiArray): NDArray { val ret = initMemoryView(a.size, a.dtype) @@ -78,6 +81,9 @@ public fun abs(a: MultiArray): NDArray { return NDArray(ret, 0, a.shape.copyOf(), dim = a.dim) } +/** + * Returns the absolute value of the given ndarray [a]. + */ @JvmName("absInt") public fun abs(a: MultiArray): NDArray { val ret = initMemoryView(a.size, a.dtype) @@ -88,6 +94,9 @@ public fun abs(a: MultiArray): NDArray { return NDArray(ret, 0, a.shape.copyOf(), dim = a.dim) } +/** + * Returns the absolute value of the given ndarray [a]. + */ @JvmName("absLong") public fun abs(a: MultiArray): NDArray { val ret = initMemoryView(a.size, a.dtype) @@ -98,6 +107,9 @@ public fun abs(a: MultiArray): NDArray { return NDArray(ret, 0, a.shape.copyOf(), dim = a.dim) } +/** + * Returns the absolute value of the given ndarray [a]. + */ @JvmName("absFloat") public fun abs(a: MultiArray): NDArray { val ret = initMemoryView(a.size) @@ -108,6 +120,9 @@ public fun abs(a: MultiArray): NDArray { return NDArray(ret, 0, a.shape.copyOf(), dim = a.dim) } +/** + * Returns the absolute value of the given ndarray [a]. + */ @JvmName("absDouble") public fun abs(a: MultiArray): NDArray { val ret = initMemoryView(a.size) @@ -118,6 +133,9 @@ public fun abs(a: MultiArray): NDArray { return NDArray(ret, 0, a.shape.copyOf(), dim = a.dim) } +/** + * Returns the absolute value of the given ndarray [a]. + */ @JvmName("absComplexFloat") public fun abs(a: MultiArray): NDArray { val ret = initMemoryView(a.size) @@ -128,6 +146,9 @@ public fun abs(a: MultiArray): NDArray abs(a: MultiArray): NDArray { val ret = initMemoryView(a.size) @@ -138,6 +159,12 @@ public fun abs(a: MultiArray): NDArray { // Reshape /** - * Returns an ndarray with a new shape without changing data. + * Returns an ndarray with a new ([dim1]) shape without changing data. */ public fun reshape(dim1: Int): MultiArray - + /** + * Returns an ndarray with a new ([dim1], [dim2]) shape without changing data. + */ public fun reshape(dim1: Int, dim2: Int): MultiArray - + /** + * Returns an ndarray with a new ([dim1], [dim2], [dim3]) shape without changing data. + */ public fun reshape(dim1: Int, dim2: Int, dim3: Int): MultiArray - + /** + * Returns an ndarray with a new ([dim1], [dim2], [dim3], [dim4]) shape without changing data. + */ public fun reshape(dim1: Int, dim2: Int, dim3: Int, dim4: Int): MultiArray - + /** + * Returns an ndarray with a new ([dim1], [dim2], [dim3], [dim4], [dims]) shape without changing data. + */ public fun reshape(dim1: Int, dim2: Int, dim3: Int, dim4: Int, vararg dims: Int): MultiArray /** @@ -106,8 +114,14 @@ public interface MultiArray { */ public infix fun cat(other: MultiArray): NDArray + /** + * Concatenates this ndarray with [other] along the specified [axis]. + */ public fun cat(other: MultiArray, axis: Int = 0): NDArray + /** + * Concatenates this ndarray with a list of [other] ndarrays. + */ public fun cat(other: List>, axis: Int = 0): NDArray } diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/data/MultiIndexProgression.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/data/MultiIndexProgression.kt index 1abca068..d8d57f17 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/data/MultiIndexProgression.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/data/MultiIndexProgression.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.ndarray.data diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/data/MutableMultiArrays.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/data/MutableMultiArrays.kt index a2c6f027..c072ac2f 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/data/MutableMultiArrays.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/data/MutableMultiArrays.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.ndarray.data diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/data/NDArray.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/data/NDArray.kt index 06e1a109..1c46ee1a 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/data/NDArray.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/data/NDArray.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.ndarray.data diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/data/NDArrayIterator.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/data/NDArrayIterator.kt index 3a7a1e68..6c9ae769 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/data/NDArrayIterator.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/data/NDArrayIterator.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.ndarray.data diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/data/Slice.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/data/Slice.kt index 6d6bac5f..b2b04a61 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/data/Slice.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/data/Slice.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.ndarray.data diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/operations/Inplace.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/operations/Inplace.kt index 8c936cf6..11ec4870 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/operations/Inplace.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/operations/Inplace.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.ndarray.operations diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/operations/IteratingNDArray.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/operations/IteratingNDArray.kt index ae18bd19..599ccab9 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/operations/IteratingNDArray.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/operations/IteratingNDArray.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.ndarray.operations diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/operations/_Arithmetic.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/operations/_Arithmetic.kt index d194eeda..f4529531 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/operations/_Arithmetic.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/operations/_Arithmetic.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.ndarray.operations diff --git a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/operations/_ArithmeticNDArray.kt b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/operations/_ArithmeticNDArray.kt index dcb12f4f..ad438661 100644 --- a/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/operations/_ArithmeticNDArray.kt +++ b/multik-core/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/operations/_ArithmeticNDArray.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.ndarray.operations diff --git a/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/creation/CreateArray1DTest.kt b/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/creation/CreateArray1DTest.kt index 9cbd3898..7a3e1439 100644 --- a/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/creation/CreateArray1DTest.kt +++ b/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/creation/CreateArray1DTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.creation diff --git a/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/creation/CreateArray2DTest.kt b/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/creation/CreateArray2DTest.kt index a9184f8e..6725fd0d 100644 --- a/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/creation/CreateArray2DTest.kt +++ b/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/creation/CreateArray2DTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.creation diff --git a/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/creation/CreateArray3DTest.kt b/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/creation/CreateArray3DTest.kt index 1f2c5a57..84f9527a 100644 --- a/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/creation/CreateArray3DTest.kt +++ b/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/creation/CreateArray3DTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.creation diff --git a/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/creation/CreateArray4DTest.kt b/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/creation/CreateArray4DTest.kt index 3f87b503..b2fa6172 100644 --- a/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/creation/CreateArray4DTest.kt +++ b/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/creation/CreateArray4DTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.creation diff --git a/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/creation/CreateArrayNDTest.kt b/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/creation/CreateArrayNDTest.kt index ca167392..2c00ccd2 100644 --- a/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/creation/CreateArrayNDTest.kt +++ b/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/creation/CreateArrayNDTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.creation diff --git a/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/iterable/IterableNDArrayTest.kt b/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/iterable/IterableNDArrayTest.kt index 0221071d..88b89d6b 100644 --- a/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/iterable/IterableNDArrayTest.kt +++ b/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/iterable/IterableNDArrayTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.iterable diff --git a/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/ndarray/data/MultiIndexProgressionTest.kt b/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/ndarray/data/MultiIndexProgressionTest.kt index d6981679..fcc803fe 100644 --- a/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/ndarray/data/MultiIndexProgressionTest.kt +++ b/multik-core/src/commonTest/kotlin/org/jetbrains/kotlinx/multik/ndarray/data/MultiIndexProgressionTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.ndarray.data diff --git a/multik-core/src/commonTest/kotlin/samples/creation.kt b/multik-core/src/commonTest/kotlin/samples/creation.kt index 5d5ff485..c0f1bb0d 100644 --- a/multik-core/src/commonTest/kotlin/samples/creation.kt +++ b/multik-core/src/commonTest/kotlin/samples/creation.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package samples @@ -13,24 +13,132 @@ import kotlin.test.Test class NDArrayTest { @Test - fun empty() { - val ndarray = mk.empty(2, 2) + fun zerosD1() { + val ndarray = mk.zeros(5) + println(ndarray) // [0, 0, 0, 0, 0] + } + + @Test + fun zerosD2() { + val ndarray = mk.zeros(2, 2) + println(ndarray) + /* + [[0.0, 0.0], + [0.0, 0.0]] + */ + } + + @Test + fun zerosD3() { + val ndarray = mk.zeros(2, 2, 2) + println(ndarray) + /* + [[[0.0, 0.0], + [0.0, 0.0]], + + [[0.0, 0.0], + [0.0, 0.0]]] + */ + } + + @Test + fun zerosD4() { + val ndarray = mk.zeros(2, 1, 2, 1) + println(ndarray) + /* + [[[[0.0], + [0.0]]], + + + [[[0.0], + [0.0]]]] + */ +} + + @Test + fun zerosDN() { + val ndarray = mk.zeros(1, 1, 1, 2, 2) println(ndarray) /* - [[0, 0], - [0, 0]] + [[[[[0.0, 0.0], + [0.0, 0.0]]]]] */ } @Test - fun emptyWithDtype() { + fun zerosDNWithDtype() { val dims = intArrayOf(3, 2) - val ndarray = mk.empty(dims, DataType.FloatDataType) + val ndarray = mk.zeros(dims, DataType.FloatDataType) + println(ndarray) + /* + [[0.0, 0.0], + [0.0, 0.0], + [0.0, 0.0]] + */ + } + + @Test + fun onesD1() { + val ndarray = mk.ones(5) + println(ndarray) // [1, 1, 1, 1, 1] + } + + @Test + fun onesD2() { + val ndarray = mk.ones(2, 2) println(ndarray) /* - [[0.0, 0.0], - [0.0, 0.0], - [0.0, 0.0]] + [[1.0, 1.0], + [1.0, 1.0]] + */ + } + + @Test + fun onesD3() { + val ndarray = mk.ones(2, 2, 2) + println(ndarray) + /* + [[[1.0, 1.0], + [1.0, 1.0]], + + [[0.0, 0.0], + [0.0, 0.0]]] + */ + } + + @Test + fun onesD4() { + val ndarray = mk.ones(2, 1, 2, 1) + println(ndarray) + /* + [[[[1.0], + [1.0]]], + + + [[[1.0], + [1.0]]]] + */ + } + + @Test + fun onesDN() { + val ndarray = mk.ones(1, 1, 1, 2, 2) + println(ndarray) + /* + [[[[[1.0, 1.0], + [1.0, 1.0]]]]] + */ + } + + @Test + fun onesDNWithDtype() { + val dims = intArrayOf(3, 2) + val ndarray = mk.ones(dims, DataType.FloatDataType) + println(ndarray) + /* + [[1.0, 1.0], + [1.0, 1.0], + [1.0, 1.0]] */ } @@ -684,7 +792,17 @@ class NDArrayTest { println(ndarray) /* [[0, 1], - [4, 9]] + [4, 9]] + */ + } + + @Test + fun d2arrayIndices() { + val ndarray = mk.d2arrayIndices(2, 2) { i, j -> i + j } + println(ndarray) + /* + [[0, 1], + [1, 2]] */ } @@ -701,6 +819,19 @@ class NDArrayTest { */ } + @Test + fun d3arrayIndices() { + val ndarray = mk.d3arrayIndices(2, 2, 2) { i, j, k -> i + j + k } + println(ndarray) + /* + [[[0, 1], + [1, 2]], + + [[1, 2], + [2, 3]]] + */ + } + @Test fun d4array() { val ndarray = mk.d4array(2, 1, 2, 1) { (it - 10f) / 10 } @@ -715,6 +846,22 @@ class NDArrayTest { */ } + @Test + fun d4arrayIndices() { + val ndarray = mk.d4arrayIndices(2, 1, 2, 1) {i, j, k, m -> + (i - j * 5f) / (k + 1) + m + } + println(ndarray) + /* + [[[[0.0], + [0.0]]], + + + [[[1.0], + [0.5]]]] + */ + } + @Test fun dnarray() { val ndarray = mk.dnarray(1, 2, 1, 2, 1, 2) { kotlin.math.PI * it } diff --git a/multik-core/src/jsMain/kotlin/org/jetbrains/kotlinx/multik/api/Engine.kt b/multik-core/src/jsMain/kotlin/org/jetbrains/kotlinx/multik/api/Engine.kt index 35031809..fe6497dd 100644 --- a/multik-core/src/jsMain/kotlin/org/jetbrains/kotlinx/multik/api/Engine.kt +++ b/multik-core/src/jsMain/kotlin/org/jetbrains/kotlinx/multik/api/Engine.kt @@ -1,5 +1,15 @@ +/* + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + package org.jetbrains.kotlinx.multik.api +/** + * Engine Provider for JS. + */ public actual fun enginesProvider(): Map = enginesStore -public val enginesStore: MutableMap = mutableMapOf() +/** + * Saves and initialize engine. + */ +public val enginesStore: MutableMap = mutableMapOf() diff --git a/multik-core/src/jvmMain/kotlin/org/jetbrains/kotlinx/multik/api/Engine.kt b/multik-core/src/jvmMain/kotlin/org/jetbrains/kotlinx/multik/api/Engine.kt index 3f1acd24..6e7dd22f 100644 --- a/multik-core/src/jvmMain/kotlin/org/jetbrains/kotlinx/multik/api/Engine.kt +++ b/multik-core/src/jvmMain/kotlin/org/jetbrains/kotlinx/multik/api/Engine.kt @@ -2,6 +2,9 @@ package org.jetbrains.kotlinx.multik.api import java.util.* +/** + * Engine Provider for JVM. + */ public actual fun enginesProvider(): Map { val engineList = ServiceLoader.load(Engine::class.java).toList() diff --git a/multik-core/src/jvmMain/kotlin/org/jetbrains/kotlinx/multik/api/io/csv.kt b/multik-core/src/jvmMain/kotlin/org/jetbrains/kotlinx/multik/api/io/csv.kt index 5c027511..c349dae0 100644 --- a/multik-core/src/jvmMain/kotlin/org/jetbrains/kotlinx/multik/api/io/csv.kt +++ b/multik-core/src/jvmMain/kotlin/org/jetbrains/kotlinx/multik/api/io/csv.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.api.io diff --git a/multik-core/src/jvmMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/operations/JVMIteratingNDArray.kt b/multik-core/src/jvmMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/operations/JVMIteratingNDArray.kt index cfc47ea7..aa20f961 100644 --- a/multik-core/src/jvmMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/operations/JVMIteratingNDArray.kt +++ b/multik-core/src/jvmMain/kotlin/org/jetbrains/kotlinx/multik/ndarray/operations/JVMIteratingNDArray.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.ndarray.operations diff --git a/multik-core/src/nativeMain/kotlin/org/jetbrains/kotlinx/multik/api/Engine.kt b/multik-core/src/nativeMain/kotlin/org/jetbrains/kotlinx/multik/api/Engine.kt index f1323186..0c0f5077 100644 --- a/multik-core/src/nativeMain/kotlin/org/jetbrains/kotlinx/multik/api/Engine.kt +++ b/multik-core/src/nativeMain/kotlin/org/jetbrains/kotlinx/multik/api/Engine.kt @@ -1,7 +1,17 @@ +/* + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + package org.jetbrains.kotlinx.multik.api +/** + * Engine Provider for Kotlin/Native targets. + */ public actual fun enginesProvider(): Map = engines +/** + * Saves and initialize engine. + */ public val engines: MutableMap by lazy { - mutableMapOf() + mutableMapOf() } diff --git a/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/KELinAlg.kt b/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/KELinAlg.kt index 0b6e4efb..e37fbae2 100644 --- a/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/KELinAlg.kt +++ b/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/KELinAlg.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.kotlin.linalg diff --git a/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/LinAlgEx.kt b/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/LinAlgEx.kt index 4e6efd8b..7eff943d 100644 --- a/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/LinAlgEx.kt +++ b/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/LinAlgEx.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.kotlin.linalg diff --git a/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/dot.kt b/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/dot.kt index 11c438e8..643d96ba 100644 --- a/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/dot.kt +++ b/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/dot.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ @file:Suppress("DuplicatedCode") diff --git a/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/eigen.kt b/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/eigen.kt index cdd9afae..5e24ac94 100644 --- a/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/eigen.kt +++ b/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/eigen.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ @file:Suppress("DuplicatedCode") diff --git a/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/gramShmidt.kt b/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/gramShmidt.kt index 436761b5..e1977b02 100644 --- a/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/gramShmidt.kt +++ b/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/gramShmidt.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ @file:Suppress("DuplicatedCode") diff --git a/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/hessenbergForm.kt b/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/hessenbergForm.kt index 8768f69e..337fe54a 100644 --- a/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/hessenbergForm.kt +++ b/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/hessenbergForm.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.kotlin.linalg diff --git a/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/norm.kt b/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/norm.kt index 92cbaf44..b507516f 100644 --- a/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/norm.kt +++ b/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/norm.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.kotlin.linalg diff --git a/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/pluDecomposition.kt b/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/pluDecomposition.kt index 8834ac4a..29732589 100644 --- a/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/pluDecomposition.kt +++ b/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/pluDecomposition.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ @file:Suppress("DuplicatedCode") diff --git a/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/qrFactorization.kt b/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/qrFactorization.kt index 4180b77c..5653cb48 100644 --- a/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/qrFactorization.kt +++ b/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/qrFactorization.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ @file:Suppress("DuplicatedCode") diff --git a/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/solve.kt b/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/solve.kt index d49b9692..522449b2 100644 --- a/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/solve.kt +++ b/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/solve.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ @file:Suppress("DuplicatedCode") diff --git a/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/utils.kt b/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/utils.kt index 1483e283..9f13e30d 100644 --- a/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/utils.kt +++ b/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/linalg/utils.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.kotlin.linalg diff --git a/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/math/KEMath.kt b/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/math/KEMath.kt index 125f3942..c7b6f159 100644 --- a/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/math/KEMath.kt +++ b/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/math/KEMath.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ @file:Suppress("DuplicatedCode") diff --git a/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/math/KEMathEx.kt b/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/math/KEMathEx.kt index e76ad7bd..30e1deaf 100644 --- a/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/math/KEMathEx.kt +++ b/multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/math/KEMathEx.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.kotlin.math diff --git a/multik-kotlin/src/commonTest/kotlin/org/jetbrains/kotlinx/multik_kotlin/linAlg/KELinAlgTest.kt b/multik-kotlin/src/commonTest/kotlin/org/jetbrains/kotlinx/multik_kotlin/linAlg/KELinAlgTest.kt index aa13ffda..65782aa5 100644 --- a/multik-kotlin/src/commonTest/kotlin/org/jetbrains/kotlinx/multik_kotlin/linAlg/KELinAlgTest.kt +++ b/multik-kotlin/src/commonTest/kotlin/org/jetbrains/kotlinx/multik_kotlin/linAlg/KELinAlgTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik_kotlin.linAlg diff --git a/multik-kotlin/src/commonTest/kotlin/org/jetbrains/kotlinx/multik_kotlin/math/KEMathTest.kt b/multik-kotlin/src/commonTest/kotlin/org/jetbrains/kotlinx/multik_kotlin/math/KEMathTest.kt index 2e7f5216..a465249f 100644 --- a/multik-kotlin/src/commonTest/kotlin/org/jetbrains/kotlinx/multik_kotlin/math/KEMathTest.kt +++ b/multik-kotlin/src/commonTest/kotlin/org/jetbrains/kotlinx/multik_kotlin/math/KEMathTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik_kotlin.math diff --git a/multik-openblas/build.gradle.kts b/multik-openblas/build.gradle.kts index d1f17eed..4343fdfd 100644 --- a/multik-openblas/build.gradle.kts +++ b/multik-openblas/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ import org.jetbrains.kotlin.gradle.tasks.CInteropProcess diff --git a/multik-openblas/multik_jni/CMakeLists.txt b/multik-openblas/multik_jni/CMakeLists.txt index 7a31992d..35fd0386 100644 --- a/multik-openblas/multik_jni/CMakeLists.txt +++ b/multik-openblas/multik_jni/CMakeLists.txt @@ -147,7 +147,7 @@ elseif(${TARGET_OS} STREQUAL "androidArm64") set(LIB_GCC "-static-libgcc -static-libstdc++ -Wl,--no-whole-archive -ldl -lm") else() # set(LIB_QUADMATH "${GCC_LIB_PATH}/libquadmath.a") -# set(LIB_GCC "-static-libgcc") + set(LIB_GCC "-static-libgcc") endif() ######################## diff --git a/multik-openblas/multik_jni/src/main/cpp/jni_Linalg.cpp b/multik-openblas/multik_jni/src/main/cpp/jni_Linalg.cpp index 14505822..1209d0ef 100644 --- a/multik-openblas/multik_jni/src/main/cpp/jni_Linalg.cpp +++ b/multik-openblas/multik_jni/src/main/cpp/jni_Linalg.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ #include "jni_JniLinAlg.h" diff --git a/multik-openblas/multik_jni/src/main/cpp/mk_linalg.cpp b/multik-openblas/multik_jni/src/main/cpp/mk_linalg.cpp index 82f0ff38..5283b20c 100644 --- a/multik-openblas/multik_jni/src/main/cpp/mk_linalg.cpp +++ b/multik-openblas/multik_jni/src/main/cpp/mk_linalg.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ #include "mk_linalg.h" diff --git a/multik-openblas/multik_jni/src/main/cpp/mk_math.cpp b/multik-openblas/multik_jni/src/main/cpp/mk_math.cpp index acbd110d..7f23043e 100644 --- a/multik-openblas/multik_jni/src/main/cpp/mk_math.cpp +++ b/multik-openblas/multik_jni/src/main/cpp/mk_math.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ #include diff --git a/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/Loader.kt b/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/Loader.kt index 7bbf71ec..d0174cbc 100644 --- a/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/Loader.kt +++ b/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/Loader.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.openblas diff --git a/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/linalg/JniLinAlg.kt b/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/linalg/JniLinAlg.kt index 2fafe66c..e8dbd1d5 100644 --- a/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/linalg/JniLinAlg.kt +++ b/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/linalg/JniLinAlg.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.openblas.linalg diff --git a/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/linalg/NativeLinAlg.kt b/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/linalg/NativeLinAlg.kt index b4724b4d..589d3271 100644 --- a/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/linalg/NativeLinAlg.kt +++ b/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/linalg/NativeLinAlg.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.openblas.linalg diff --git a/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/linalg/NativeLinAlgEx.kt b/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/linalg/NativeLinAlgEx.kt index bfc289d4..1e2a88fa 100644 --- a/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/linalg/NativeLinAlgEx.kt +++ b/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/linalg/NativeLinAlgEx.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.openblas.linalg diff --git a/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/math/JniMath.kt b/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/math/JniMath.kt index 4d235781..e51723d6 100644 --- a/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/math/JniMath.kt +++ b/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/math/JniMath.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.openblas.math diff --git a/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/math/NativeMath.kt b/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/math/NativeMath.kt index 3b9d79ed..1d42e59e 100644 --- a/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/math/NativeMath.kt +++ b/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/math/NativeMath.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.openblas.math diff --git a/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/math/NativeMathEx.kt b/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/math/NativeMathEx.kt index 402215ce..982654b5 100644 --- a/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/math/NativeMathEx.kt +++ b/multik-openblas/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/openblas/math/NativeMathEx.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.openblas.math diff --git a/multik-openblas/src/jvmTest/kotlin/org/jetbrains/kotlinx/multik/openblas/DataStructure.kt b/multik-openblas/src/jvmTest/kotlin/org/jetbrains/kotlinx/multik/openblas/DataStructure.kt index b2ecb47a..49a1a418 100644 --- a/multik-openblas/src/jvmTest/kotlin/org/jetbrains/kotlinx/multik/openblas/DataStructure.kt +++ b/multik-openblas/src/jvmTest/kotlin/org/jetbrains/kotlinx/multik/openblas/DataStructure.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.openblas diff --git a/multik-openblas/src/jvmTest/kotlin/org/jetbrains/kotlinx/multik/openblas/MathTestUtils.kt b/multik-openblas/src/jvmTest/kotlin/org/jetbrains/kotlinx/multik/openblas/MathTestUtils.kt index 45ceb43c..bf24737d 100644 --- a/multik-openblas/src/jvmTest/kotlin/org/jetbrains/kotlinx/multik/openblas/MathTestUtils.kt +++ b/multik-openblas/src/jvmTest/kotlin/org/jetbrains/kotlinx/multik/openblas/MathTestUtils.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.openblas diff --git a/multik-openblas/src/jvmTest/kotlin/org/jetbrains/kotlinx/multik/openblas/linalg/NativeLinAlgTest.kt b/multik-openblas/src/jvmTest/kotlin/org/jetbrains/kotlinx/multik/openblas/linalg/NativeLinAlgTest.kt index c09cef2c..599b5857 100644 --- a/multik-openblas/src/jvmTest/kotlin/org/jetbrains/kotlinx/multik/openblas/linalg/NativeLinAlgTest.kt +++ b/multik-openblas/src/jvmTest/kotlin/org/jetbrains/kotlinx/multik/openblas/linalg/NativeLinAlgTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.openblas.linalg diff --git a/multik-openblas/src/jvmTest/kotlin/org/jetbrains/kotlinx/multik/openblas/math/NativeMathTest.kt b/multik-openblas/src/jvmTest/kotlin/org/jetbrains/kotlinx/multik/openblas/math/NativeMathTest.kt index 85ba8f67..acbd15a1 100644 --- a/multik-openblas/src/jvmTest/kotlin/org/jetbrains/kotlinx/multik/openblas/math/NativeMathTest.kt +++ b/multik-openblas/src/jvmTest/kotlin/org/jetbrains/kotlinx/multik/openblas/math/NativeMathTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.kotlinx.multik.openblas.math