-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
397 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...etbrains/kotlinx/multik/api/Statistics.kt → ...ins/kotlinx/multik/api/stat/Statistics.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...default/src/iosMain/kotlin/org.jetbrains.kotlinx.multik.default/stat/DefaultStatistics.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* 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.default.stat | ||
|
||
import org.jetbrains.kotlinx.multik.api.stat.Statistics | ||
import org.jetbrains.kotlinx.multik.kotlin.stat.KEStatistics | ||
import org.jetbrains.kotlinx.multik.ndarray.data.* | ||
|
||
public actual object DefaultStatistics : Statistics { | ||
|
||
actual override fun <T : Number, D : Dimension> median(a: MultiArray<T, D>): Double? = KEStatistics.median(a) | ||
|
||
actual override fun <T : Number, D : Dimension> average(a: MultiArray<T, D>, weights: MultiArray<T, D>?): Double = | ||
KEStatistics.average(a, weights) | ||
|
||
actual override fun <T : Number, D : Dimension> mean(a: MultiArray<T, D>): Double = KEStatistics.mean(a) | ||
|
||
actual override fun <T : Number, D : Dimension, O : Dimension> mean(a: MultiArray<T, D>, axis: Int): NDArray<Double, O> = | ||
KEStatistics.mean(a, axis) | ||
|
||
actual override fun <T : Number> meanD2(a: MultiArray<T, D2>, axis: Int): NDArray<Double, D1> = mean(a, axis) | ||
|
||
actual override fun <T : Number> meanD3(a: MultiArray<T, D3>, axis: Int): NDArray<Double, D2> = mean(a, axis) | ||
|
||
actual override fun <T : Number> meanD4(a: MultiArray<T, D4>, axis: Int): NDArray<Double, D3> = mean(a, axis) | ||
|
||
actual override fun <T : Number> meanDN(a: MultiArray<T, DN>, axis: Int): NDArray<Double, D4> = mean(a, axis) | ||
} |
30 changes: 30 additions & 0 deletions
30
...-default/src/jsMain/kotlin/org.jetbrains.kotlinx.multik.default/stat/DefaultStatistics.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* 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.default.stat | ||
|
||
import org.jetbrains.kotlinx.multik.api.stat.Statistics | ||
import org.jetbrains.kotlinx.multik.kotlin.stat.KEStatistics | ||
import org.jetbrains.kotlinx.multik.ndarray.data.* | ||
|
||
public actual object DefaultStatistics : Statistics { | ||
|
||
actual override fun <T : Number, D : Dimension> median(a: MultiArray<T, D>): Double? = KEStatistics.median(a) | ||
|
||
actual override fun <T : Number, D : Dimension> average(a: MultiArray<T, D>, weights: MultiArray<T, D>?): Double = | ||
KEStatistics.average(a, weights) | ||
|
||
actual override fun <T : Number, D : Dimension> mean(a: MultiArray<T, D>): Double = KEStatistics.mean(a) | ||
|
||
actual override fun <T : Number, D : Dimension, O : Dimension> mean(a: MultiArray<T, D>, axis: Int): NDArray<Double, O> = | ||
KEStatistics.mean(a, axis) | ||
|
||
actual override fun <T : Number> meanD2(a: MultiArray<T, D2>, axis: Int): NDArray<Double, D1> = mean(a, axis) | ||
|
||
actual override fun <T : Number> meanD3(a: MultiArray<T, D3>, axis: Int): NDArray<Double, D2> = mean(a, axis) | ||
|
||
actual override fun <T : Number> meanD4(a: MultiArray<T, D4>, axis: Int): NDArray<Double, D3> = mean(a, axis) | ||
|
||
actual override fun <T : Number> meanDN(a: MultiArray<T, DN>, axis: Int): NDArray<Double, D4> = mean(a, axis) | ||
} |
31 changes: 31 additions & 0 deletions
31
...default/src/jvmMain/kotlin/org/jetbrains/kotlinx/multik/default/stat/DefaultStatistics.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* 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.default.stat | ||
|
||
import org.jetbrains.kotlinx.multik.api.stat.Statistics | ||
import org.jetbrains.kotlinx.multik.kotlin.stat.KEStatistics | ||
import org.jetbrains.kotlinx.multik.ndarray.data.* | ||
import org.jetbrains.kotlinx.multik.openblas.stat.NativeStatistics | ||
|
||
public actual object DefaultStatistics : Statistics { | ||
|
||
actual override fun <T : Number, D : Dimension> median(a: MultiArray<T, D>): Double? = NativeStatistics.median(a) | ||
|
||
actual override fun <T : Number, D : Dimension> average(a: MultiArray<T, D>, weights: MultiArray<T, D>?): Double = | ||
KEStatistics.average(a, weights) | ||
|
||
actual override fun <T : Number, D : Dimension> mean(a: MultiArray<T, D>): Double = KEStatistics.mean(a) | ||
|
||
actual override fun <T : Number, D : Dimension, O : Dimension> mean(a: MultiArray<T, D>, axis: Int): NDArray<Double, O> = | ||
KEStatistics.mean(a, axis) | ||
|
||
actual override fun <T : Number> meanD2(a: MultiArray<T, D2>, axis: Int): NDArray<Double, D1> = mean(a, axis) | ||
|
||
actual override fun <T : Number> meanD3(a: MultiArray<T, D3>, axis: Int): NDArray<Double, D2> = mean(a, axis) | ||
|
||
actual override fun <T : Number> meanD4(a: MultiArray<T, D4>, axis: Int): NDArray<Double, D3> = mean(a, axis) | ||
|
||
actual override fun <T : Number> meanDN(a: MultiArray<T, DN>, axis: Int): NDArray<Double, D4> = mean(a, axis) | ||
} |
31 changes: 31 additions & 0 deletions
31
...ault/src/nativeMain/kotlin/org.jetbrains.kotlinx.multik.default/stat/DefaultStatistics.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* 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.default.stat | ||
|
||
import org.jetbrains.kotlinx.multik.api.stat.Statistics | ||
import org.jetbrains.kotlinx.multik.kotlin.stat.KEStatistics | ||
import org.jetbrains.kotlinx.multik.ndarray.data.* | ||
import org.jetbrains.kotlinx.multik.openblas.stat.NativeStatistics | ||
|
||
public actual object DefaultStatistics : Statistics { | ||
|
||
actual override fun <T : Number, D : Dimension> median(a: MultiArray<T, D>): Double? = NativeStatistics.median(a) | ||
|
||
actual override fun <T : Number, D : Dimension> average(a: MultiArray<T, D>, weights: MultiArray<T, D>?): Double = | ||
KEStatistics.average(a, weights) | ||
|
||
actual override fun <T : Number, D : Dimension> mean(a: MultiArray<T, D>): Double = KEStatistics.mean(a) | ||
|
||
actual override fun <T : Number, D : Dimension, O : Dimension> mean(a: MultiArray<T, D>, axis: Int): NDArray<Double, O> = | ||
KEStatistics.mean(a, axis) | ||
|
||
actual override fun <T : Number> meanD2(a: MultiArray<T, D2>, axis: Int): NDArray<Double, D1> = mean(a, axis) | ||
|
||
actual override fun <T : Number> meanD3(a: MultiArray<T, D3>, axis: Int): NDArray<Double, D2> = mean(a, axis) | ||
|
||
actual override fun <T : Number> meanD4(a: MultiArray<T, D4>, axis: Int): NDArray<Double, D3> = mean(a, axis) | ||
|
||
actual override fun <T : Number> meanDN(a: MultiArray<T, DN>, axis: Int): NDArray<Double, D4> = mean(a, axis) | ||
} |
5 changes: 3 additions & 2 deletions
5
multik-kotlin/src/commonMain/kotlin/org/jetbrains/kotlinx/multik/kotlin/KEEngine.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
#include "JniStat.h" | ||
#include "mk_stat.h" | ||
|
||
/* | ||
* Class: org_jetbrains_kotlinx_multik_openblas_stat_JniStat | ||
* Method: median | ||
* Signature: (Ljava/lang/Object;II)D | ||
*/ | ||
JNIEXPORT jdouble JNICALL Java_org_jetbrains_kotlinx_multik_openblas_stat_JniStat_median | ||
(JNIEnv *env, jobject jobj, jobject jarr, jint size, jint type) { | ||
|
||
void *varr = env->GetPrimitiveArrayCritical((jarray)jarr, nullptr); | ||
|
||
double ret = array_median(varr, size, type); | ||
|
||
env->ReleasePrimitiveArrayCritical((jarray)jarr, varr, 0); | ||
|
||
return ret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.