Skip to content

Commit 82c36a6

Browse files
authored
Merge pull request #122 from Kotlin/v0.2.0
V0.2.0
2 parents af126cd + fedaba3 commit 82c36a6

File tree

94 files changed

+885
-194
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+885
-194
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
same "printed page" as the copyright notice for easier
188188
identification within third-party archives.
189189

190-
Copyright 2000-2021 JetBrains s.r.o.
190+
Copyright 2000-2022 JetBrains s.r.o.
191191

192192
Licensed under the Apache License, Version 2.0 (the "License");
193193
you may not use this file except in compliance with the License.

README.md

Lines changed: 85 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
Multidimensional array library for Kotlin.
99

1010
## Modules
11-
* multik-core — contains ndarrays, methods called on them and [math], [stat] and [linalg] interfaces.
12-
* multik-default — implementation including `jvm` and `native` for performance.
13-
* multik-kotlin — implementation of [math], [stat] and [linalg] interfaces on JVM.
14-
* multik-openblas — implementation of [math], [stat] and [linalg] interfaces in native code using OpenBLAS.
11+
* `multik-core` — contains ndarrays, methods called on them and [math], [stat] and [linalg] interfaces.
12+
* `multik-default` — implementation including `multik-kotlin` and `multik-openblas` for performance.
13+
* `multik-kotlin` — implementation of [math], [stat] and [linalg] interfaces on JVM.
14+
* `multik-openblas` — implementation of [math], [stat] and [linalg] interfaces in native code using OpenBLAS.
1515

1616
## Using in your projects
17+
### Gradle
1718
In your Gradle build script:
1819
1. Add the Maven Central Repository.
1920
2. Add the `org.jetbrains.kotlinx:multik-core:$multik_version` api dependency.
@@ -27,8 +28,8 @@ repositories {
2728
}
2829
2930
dependencies {
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

4142
dependencies {
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

49112
Visit [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
157226
a.sin() // element-wise sin, equivalent to mk.math.sin(a)
158227
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)
161230
d 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
168235
mk.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+
235306
Run `./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
247311
There is an opportunity to contribute to the project:

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44
import java.time.Duration
55

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
kotlin.code.style=official
2-
multik_version=0.2.0-dev-4
2+
multik_version=0.2.0
33

44
# Kotlin
55
systemProp.kotlin_version=1.7.10
66
group=org.jetbrains.kotlinx
77

88
# Dependencies
99
systemProp.nexus_version=1.1.0
10-
systemProp.dokka_version=1.6.0
10+
systemProp.dokka_version=1.7.10
1111
openblas_version=0.3.19
1212
common_csv_version=1.9.0
1313

gradle/publish.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

55

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Thu Apr 09 14:05:51 MSK 2020
2-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
2+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
33
distributionBase=GRADLE_USER_HOME
44
distributionPath=wrapper/dists
55
zipStorePath=wrapper/dists

multik-core/build.gradle.kts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

55
plugins {
@@ -87,15 +87,22 @@ kotlin {
8787

8888
tasks.dokkaHtml.configure {
8989
outputDirectory.set(rootProject.buildDir.resolve("dokka"))
90+
suppressObviousFunctions.set(true)
91+
suppressInheritedMembers.set(true)
9092

9193
dokkaSourceSets {
9294
configureEach {
93-
includeNonPublic.set(false)
94-
skipEmptyPackages.set(false)
95+
documentedVisibilities.set(
96+
setOf(
97+
org.jetbrains.dokka.DokkaConfiguration.Visibility.PUBLIC,
98+
org.jetbrains.dokka.DokkaConfiguration.Visibility.PROTECTED
99+
)
100+
)
101+
skipDeprecated.set(false)
95102
jdkVersion.set(8)
96103
noStdlibLink.set(false)
97104
noJdkLink.set(false)
98-
samples.from(files("src/test/kotlin/samples/creation.kt"))
105+
samples.from(files("src/commonTest/kotlin/samples/creation.kt"))
99106
}
100107
}
101108
}

0 commit comments

Comments
 (0)