88Multidimensional array library for Kotlin.
99
1010## Modules
11- * multik-core &mdash ; contains ndarrays, methods called on them and [ math] , [ stat] and [ linalg] interfaces.
12- * multik-default &mdash ; implementation including ` jvm ` and ` native ` for performance.
13- * multik-kotlin &mdash ; implementation of [ math] , [ stat] and [ linalg] interfaces on JVM.
14- * multik-openblas &mdash ; implementation of [ math] , [ stat] and [ linalg] interfaces in native code using OpenBLAS.
11+ * ` multik-core ` &mdash ; contains ndarrays, methods called on them and [ math] , [ stat] and [ linalg] interfaces.
12+ * ` multik-default ` &mdash ; implementation including ` multik-kotlin ` and ` multik-openblas ` for performance.
13+ * ` multik-kotlin ` &mdash ; implementation of [ math] , [ stat] and [ linalg] interfaces on JVM.
14+ * ` multik-openblas ` &mdash ; implementation of [ math] , [ stat] and [ linalg] interfaces in native code using OpenBLAS.
1515
1616## Using in your projects
17+ ### Gradle
1718In your Gradle build script:
18191 . Add the Maven Central Repository.
19202 . Add the ` org.jetbrains.kotlinx:multik-core:$multik_version ` api dependency.
@@ -27,8 +28,8 @@ repositories {
2728}
2829
2930dependencies {
30- implementation "org.jetbrains.kotlinx:multik-core:0.1.1 "
31- implementation "org.jetbrains.kotlinx:multik-default:0.1.1 "
31+ implementation "org.jetbrains.kotlinx:multik-core:0.2.0 "
32+ implementation "org.jetbrains.kotlinx:multik-default:0.2.0 "
3233}
3334```
3435
@@ -39,11 +40,73 @@ repositories {
3940}
4041
4142dependencies {
42- implementation(" org.jetbrains.kotlinx:multik-core:0.1.1 " )
43- implementation(" org.jetbrains.kotlinx:multik-default:0.1.1 " )
43+ implementation(" org.jetbrains.kotlinx:multik-core:0.2.0 " )
44+ implementation(" org.jetbrains.kotlinx:multik-default:0.2.0 " )
4445}
4546```
4647
48+ For a multiplatform project, set the dependency in a common block:
49+
50+ ``` kotlin
51+ kotlin {
52+ sourceSets {
53+ val commonMain by getting {
54+ dependencies {
55+ implementation(" org.jetbrains.kotlinx:multik-core:0.2.0" )
56+ }
57+ }
58+ }
59+ }
60+ ```
61+
62+ or in a platform-specific block:
63+
64+ ``` kotlin
65+ kotlin {
66+ sourceSets {
67+ val jvmName by getting {
68+ dependencies {
69+ implementation(" org.jetbrains.kotlinx:multik-core-jvm:0.2.0" )
70+ }
71+ }
72+ }
73+ }
74+ ```
75+
76+ ### Jupyter Notebook
77+ Install [ Kotlin kernel] ( https://github.com/Kotlin/kotlin-jupyter ) for
78+ [ Jupyter] ( https://jupyter.org/ )
79+ or just visit to [ Datalore] ( https://datalore.jetbrains.com/ ) .
80+
81+ Import stable ` multik ` version into notebook:
82+ ```
83+ %use multik
84+ ```
85+
86+ ## Support platforms
87+
88+ | Platforms | ` multik-core ` | ` multik-kotlin ` | ` multik-openblas ` | ` multik-default ` |
89+ | :---------------------:| :------------------:| :------------------:| :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
90+ | ** JS** | :white_check_mark : | :white_check_mark : | :x : | :white_check_mark : |
91+ | ** linuxX64** | :white_check_mark : | :white_check_mark : | :white_check_mark : | :white_check_mark : |
92+ | ** mingwX64** | :white_check_mark : | :white_check_mark : | :white_check_mark : | :white_check_mark : |
93+ | ** macosX64** | :white_check_mark : | :white_check_mark : | :white_check_mark : | :white_check_mark : |
94+ | ** macosArm64** | :white_check_mark : | :white_check_mark : | :white_check_mark : | :white_check_mark : |
95+ | ** iosArm64** | :white_check_mark : | :white_check_mark : | :x : | :white_check_mark : |
96+ | ** iosX64** | :white_check_mark : | :white_check_mark : | :x : | :white_check_mark : |
97+ | ** iosSimulatorArm64** | :white_check_mark : | :white_check_mark : | :x : | :white_check_mark : |
98+ | ** JVM** | :white_check_mark : | :white_check_mark : | linuxX64 - :white_check_mark : <br />mingwX64 - :white_check_mark : <br />macosX64 - :white_check_mark : <br />macosArm64 - :white_check_mark : <br />androidArm64 - :white_check_mark : | linuxX64 - :white_check_mark : <br />mingwX64 - :white_check_mark : <br />macosX64 - :white_check_mark : <br />macosArm64 - :white_check_mark : <br />androidArm64 - :white_check_mark : |
99+
100+ For Kotlin/JS, we use the new [ IR] ( https://kotlinlang.org/docs/js-ir-compiler.html ) .
101+ We also use the [ new memory model] ( https://blog.jetbrains.com/kotlin/2021/08/try-the-new-kotlin-native-memory-manager-development-preview/ )
102+ in Kotlin/Native. Keep this in mind when using Multik in your multiplatform projects.
103+
104+ ** Note** :
105+ * on ubuntu 18.04 and older ` multik-openblas ` doesn't work due to older versions of _ ** glibc** _ .
106+ * ` multik-openblas ` for desktop targets (_ linuxX64_ , _ mingwX64_ , _ macosX64_ , _ macosArm64_ ) is experimental and unstable.
107+ We will improve stability and perfomance as _ Kotlin/Native_ evolves.
108+ * JVM target ` multik-openblas ` for Android only supports ** arm64-v8a** processors.
109+
47110## Quickstart
48111
49112Visit [ Multik documentation] ( https://kotlin.github.io/multik ) for a detailed feature overview.
@@ -153,6 +216,12 @@ f * d // multiplication
153216```
154217
155218#### Array mathematics
219+
220+ See documentation for other methods of
221+ [ mathematics] ( https://kotlin.github.io/multik/multik-core/org.jetbrains.kotlinx.multik.api.math/index.html ) ,
222+ [ linear algebra] ( https://kotlin.github.io/multik/multik-core/org.jetbrains.kotlinx.multik.api.linalg/index.html ) ,
223+ [ statistics] ( https://kotlin.github.io/multik/multik-core/org.jetbrains.kotlinx.multik.api.stat/index.html ) .
224+
156225``` kotlin
157226a.sin() // element-wise sin, equivalent to mk.math.sin(a)
158227a.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)
161230d dot e // dot product, equivalent to mk.linalg.dot(d, e)
162231```
163232
164- See [ documentation] ( https://kotlin.github.io/multik ) for other linear algebra methods.
165-
166233#### Aggregate functions
167234``` kotlin
168235mk.math.sum(c) // array-wise sum
@@ -230,18 +297,15 @@ a.inplace {
230297```
231298
232299## Building
233- Multik uses BLAS and LAPACK for implementing algebraic operations.
234- Therefore, you would need a C ++ compiler and gfortran.
300+ To build the entire project, you need to set up an environment for building ` multik-openblas ` :
301+ * JDK 1.8 or higher
302+ * _ JAVA_HOME_ environment - to search for jni files
303+ * Compilers _ gcc_ , _ g++_ , _ gfortran_ version 8 or higher.
304+ It is important that they are of the same version.
305+
235306Run ` ./gradlew assemble ` to build all modules.
236- * To build api module run ` ./gradlew multik-core:assemble ` .
237- * To build jvm module run ` ./gradlew multik-kotlin:assemble ` .
238- * To build native module run ` ./gradlew multik-openblas:assemble ` .
239- To reuse ` multik-openblas ` in the future, you must first build ` multik_jni ` and place the native library in
240- ` multik-openblas/build/libs `
241- * To build default module run ` ./gradlew multik-openblas:assemble ` then ` ./gradlew multik-default:assemble ` .
242-
243- ## Testing
244- ` ./gradlew test `
307+ If you don't need to build ` multik-openblas ` ,
308+ just disable the ` cmake_build ` task and build the module you need.
245309
246310## Contributing
247311There is an opportunity to contribute to the project:
0 commit comments