kmath/kmath-nd4j
Alexander Nozik 67994d35d9 Merge branch 'dev' into dev-0.4
# Conflicts:
#	CHANGELOG.md
#	build.gradle.kts
#	examples/src/main/kotlin/space/kscience/kmath/operations/mixedNDOperations.kt
#	kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt
#	kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/Float64LinearSpace.kt
#	kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LupDecomposition.kt
#	kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Float64FieldND.kt
#	kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/euclidean2d/Circle2D.kt
#	kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/euclidean2d/Float64Space2D.kt
#	kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/euclidean3d/Float64Space3D.kt
#	kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/vectorPrecision.kt
#	kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jTensorAlgebra.kt
#	kmath-tensorflow/src/main/kotlin/space/kscience/kmath/tensorflow/DoubleTensorFlowAlgebra.kt
#	kmath-tensors/src/commonMain/kotlin/space/kscience/kmath/tensors/core/DoubleTensorAlgebra.kt
#	kmath-tensors/src/commonMain/kotlin/space/kscience/kmath/tensors/core/IntTensorAlgebra.kt
#	kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorFieldOpsND.kt
2023-08-12 21:38:43 +03:00
..
docs Improve Dokka configuration 2021-03-22 20:41:18 +07:00
src Merge branch 'dev' into dev-0.4 2023-08-12 21:38:43 +03:00
build.gradle.kts Refactor for build tools 0.13.0 2022-09-04 20:59:30 +03:00
README.md Move annotations to base package. Fix series 2023-04-07 19:55:34 +03:00

Module kmath-nd4j

ND4J based implementations of KMath abstractions.

Artifact:

The Maven coordinates of this project are space.kscience:kmath-nd4j:0.4.0-dev-1.

Gradle Groovy:

repositories {
    maven { url 'https://repo.kotlin.link' }
    mavenCentral()
}

dependencies {
    implementation 'space.kscience:kmath-nd4j:0.4.0-dev-1'
}

Gradle Kotlin DSL:

repositories {
    maven("https://repo.kotlin.link")
    mavenCentral()
}

dependencies {
    implementation("space.kscience:kmath-nd4j:0.4.0-dev-1")
}

Examples

NDStructure wrapper for INDArray:

import org.nd4j.linalg.factory.*
import scientifik.kmath.nd4j.*
import scientifik.kmath.structures.*

val array = Nd4j.ones(2, 2).asDoubleStructure()
println(array[0, 0]) // 1.0
array[intArrayOf(0, 0)] = 24.0
println(array[0, 0]) // 24.0

Fast element-wise and in-place arithmetics for INDArray:

import org.nd4j.linalg.factory.*
import scientifik.kmath.nd4j.*
import scientifik.kmath.operations.*

val field = DoubleNd4jArrayField(intArrayOf(2, 2))
val array = Nd4j.rand(2, 2).asDoubleStructure()

val res = field {
    (25.0 / array + 20) * 4
}

println(res.ndArray)
// [[  250.6449,  428.5840], 
//  [  269.7913,  202.2077]]

Contributed by Iaroslav Postovalov.