From bd178d77babd7fe6a21786860aeb7fdbe584b8ad Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 17 Jan 2021 02:38:48 +0700 Subject: [PATCH 01/10] Add transposeConjugate function for Complex and Double (conjugate values are not cached). Minor refactoring of MatrixContext and API reference changes --- .../kscience/kmath/linear/FeaturedMatrix.kt | 35 ++++++++++++++----- .../kscience/kmath/linear/MatrixContext.kt | 16 ++++++--- .../kscience/kmath/linear/VirtualMatrix.kt | 9 +++-- .../kscience/kmath/structures/Structure2D.kt | 2 +- 4 files changed, 46 insertions(+), 16 deletions(-) diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt b/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt index 119f5d844..bbe2a0b61 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt +++ b/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt @@ -1,6 +1,8 @@ package kscience.kmath.linear +import kscience.kmath.operations.Complex import kscience.kmath.operations.Ring +import kscience.kmath.operations.conjugate import kscience.kmath.structures.Matrix import kscience.kmath.structures.Structure2D import kscience.kmath.structures.asBuffer @@ -70,7 +72,7 @@ public fun > GenericMatrixContext.one(rows: Int, c /** - * A virtual matrix of zeroes + * Returns virtual matrix of zeroes. */ public fun > GenericMatrixContext.zero(rows: Int, columns: Int): FeaturedMatrix = VirtualMatrix(rows, columns) { _, _ -> elementContext.zero } @@ -78,12 +80,27 @@ public fun > GenericMatrixContext.zero(rows: Int, public class TransposedFeature(public val original: Matrix) : MatrixFeature /** - * Create a virtual transposed matrix without copying anything. `A.transpose().transpose() === A` + * Create a virtual transposed matrix without copying anything. `A.transpose().transpose() === A`. */ -public fun Matrix.transpose(): Matrix { - return getFeature>()?.original ?: VirtualMatrix( - colNum, - rowNum, - setOf(TransposedFeature(this)) - ) { i, j -> get(j, i) } -} \ No newline at end of file +public fun Matrix.transpose(): Matrix = getFeature>()?.original ?: VirtualMatrix( + colNum, + rowNum, + setOf(TransposedFeature(this)), +) { i, j -> get(j, i) } + +/** + * Returns Hermitian conjugate of this matrix (i.e., just transposes it). + * + * + */ +public fun Matrix.transposeConjugate(): Matrix = transpose() + +/** + * Returns Hermitian conjugate of this matrix (i.e., transposes it and replaces each element with its conjugate). + * + * @return the Hermitian conjugate of this matrix. + */ +public fun Matrix.transposeConjugate(): Matrix { + val t = transpose() + return VirtualMatrix(t.rowNum, t.colNum) { i, j -> t[i,j].conjugate } +} diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt b/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt index 8c28a240f..c61eb7eb9 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt +++ b/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt @@ -10,7 +10,10 @@ import kscience.kmath.structures.Matrix import kscience.kmath.structures.asSequence /** - * Basic operations on matrices. Operates on [Matrix] + * Basic operations on matrices. Operates on [Matrix]. + * + * @param T the type of items in the matrices. + * @param M the type of operated matrices. */ public interface MatrixContext> : SpaceOperations> { /** @@ -84,9 +87,16 @@ public interface MatrixContext> : SpaceOperations, out M : Matrix> : MatrixContext { /** - * The ring context for matrix elements + * The ring over matrix elements. */ public val elementContext: R @@ -133,8 +143,6 @@ public interface GenericMatrixContext, out M : Matrix> : public override fun multiply(a: Matrix, k: Number): M = produce(a.rowNum, a.colNum) { i, j -> elementContext { a[i, j] * k } } - public operator fun Number.times(matrix: FeaturedMatrix): M = multiply(matrix, this) - public override operator fun Matrix.times(value: T): M = produce(rowNum, colNum) { i, j -> elementContext { get(i, j) * value } } } diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/VirtualMatrix.kt b/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/VirtualMatrix.kt index e0a1d0026..8b7eaa3e7 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/VirtualMatrix.kt +++ b/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/VirtualMatrix.kt @@ -2,17 +2,22 @@ package kscience.kmath.linear import kscience.kmath.structures.Matrix +/** + * The matrix where each element is evaluated each time when is being accessed. + * + * @property generator the function that provides elements. + */ public class VirtualMatrix( override val rowNum: Int, override val colNum: Int, override val features: Set = emptySet(), - public val generator: (i: Int, j: Int) -> T + public val generator: (i: Int, j: Int) -> T, ) : FeaturedMatrix { public constructor( rowNum: Int, colNum: Int, vararg features: MatrixFeature, - generator: (i: Int, j: Int) -> T + generator: (i: Int, j: Int) -> T, ) : this( rowNum, colNum, diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/Structure2D.kt b/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/Structure2D.kt index bac7d3389..7131a02e0 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/Structure2D.kt +++ b/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/Structure2D.kt @@ -72,6 +72,6 @@ else /** * Alias for [Structure2D] with more familiar name. * - * @param T the type of items. + * @param T the type of items in the matrix. */ public typealias Matrix = Structure2D From 6636b228f3fb21e90d1239acf6145784af8a3073 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 17 Jan 2021 18:59:20 +0700 Subject: [PATCH 02/10] Add missing JvmName annotations --- .../commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt b/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt index bbe2a0b61..4a1eef318 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt +++ b/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt @@ -93,6 +93,7 @@ public fun Matrix.transpose(): Matrix = getFeature.transposeConjugate(): Matrix = transpose() /** @@ -100,6 +101,7 @@ public fun Matrix.transposeConjugate(): Matrix = transpose() * * @return the Hermitian conjugate of this matrix. */ +@JvmName("transposeConjugateComplex") public fun Matrix.transposeConjugate(): Matrix { val t = transpose() return VirtualMatrix(t.rowNum, t.colNum) { i, j -> t[i,j].conjugate } From 3f00410fc1a5b3501ad0eba531596de8e211a979 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 17 Jan 2021 19:12:14 +0700 Subject: [PATCH 03/10] Add missing import --- .../commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt b/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt index 4a1eef318..f154a6115 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt +++ b/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt @@ -6,6 +6,7 @@ import kscience.kmath.operations.conjugate import kscience.kmath.structures.Matrix import kscience.kmath.structures.Structure2D import kscience.kmath.structures.asBuffer +import kotlin.jvm.JvmName import kotlin.math.sqrt /** From f1b319f73de90b13adf88491ae6cf4a838f84822 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Tue, 19 Jan 2021 00:14:12 +0700 Subject: [PATCH 04/10] Minor: micro-optimize getFeature function, reformat --- .../kotlin/kscience/kmath/linear/FeaturedMatrix.kt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt b/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt index f154a6115..61dbdf721 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt +++ b/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt @@ -60,8 +60,9 @@ public inline fun Matrix<*>.hasFeature(): Boolean = /** * Get the first feature matching given class. Does not guarantee that matrix has only one feature matching the criteria */ +@Suppress("UNCHECKED_CAST") public inline fun Matrix<*>.getFeature(): T? = - features.filterIsInstance().firstOrNull() + features.find { it is T }?.let { it as T } /** * Diagonal matrix of ones. The matrix is virtual no actual matrix is created @@ -78,7 +79,12 @@ public fun > GenericMatrixContext.one(rows: Int, c public fun > GenericMatrixContext.zero(rows: Int, columns: Int): FeaturedMatrix = VirtualMatrix(rows, columns) { _, _ -> elementContext.zero } -public class TransposedFeature(public val original: Matrix) : MatrixFeature +/** + * Matrices with this feature were transposed previosly and hold the reference to their original. + * + * @property original the matrix before transposition. + */ +public inline class TransposedFeature(public val original: Matrix) : MatrixFeature /** * Create a virtual transposed matrix without copying anything. `A.transpose().transpose() === A`. @@ -105,5 +111,5 @@ public fun Matrix.transposeConjugate(): Matrix = transpose() @JvmName("transposeConjugateComplex") public fun Matrix.transposeConjugate(): Matrix { val t = transpose() - return VirtualMatrix(t.rowNum, t.colNum) { i, j -> t[i,j].conjugate } + return VirtualMatrix(t.rowNum, t.colNum) { i, j -> t[i, j].conjugate } } From 6d118fc84195e2b3c37fbff8403ffc692823f973 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Tue, 19 Jan 2021 00:15:09 +0700 Subject: [PATCH 05/10] Minor: fix a typo --- .../commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt b/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt index 61dbdf721..54e4c3777 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt +++ b/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt @@ -80,7 +80,7 @@ public fun > GenericMatrixContext.zero(rows: Int, VirtualMatrix(rows, columns) { _, _ -> elementContext.zero } /** - * Matrices with this feature were transposed previosly and hold the reference to their original. + * Matrices with this feature were transposed previously and hold the reference to their original. * * @property original the matrix before transposition. */ From 7418228d08be2693fdd10bceadf1af967ef45379 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Tue, 19 Jan 2021 00:27:28 +0700 Subject: [PATCH 06/10] Update KDoc comments --- .../kotlin/kscience/kmath/linear/FeaturedMatrix.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt b/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt index 54e4c3777..38c81b646 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt +++ b/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt @@ -74,7 +74,14 @@ public fun > GenericMatrixContext.one(rows: Int, c /** - * Returns virtual matrix of zeroes. + * Returns a [VirtualMatrix] of zeroes. + * + * @param T the type of matrix's items. + * @param R the type of ring over the matrix's items. + * @receiver the matrix context to provide the [R] ring. + * @param rows the count of rows. + * @param columns the count of columns. + * @return a new virtual matrix. */ public fun > GenericMatrixContext.zero(rows: Int, columns: Int): FeaturedMatrix = VirtualMatrix(rows, columns) { _, _ -> elementContext.zero } @@ -82,6 +89,7 @@ public fun > GenericMatrixContext.zero(rows: Int, /** * Matrices with this feature were transposed previously and hold the reference to their original. * + * @param T the type of matrices' items. * @property original the matrix before transposition. */ public inline class TransposedFeature(public val original: Matrix) : MatrixFeature From 6aeccef88937eabba9056dad58b881eebfa55289 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Thu, 11 Feb 2021 15:20:29 +0700 Subject: [PATCH 07/10] Fix benchmarks again --- .../kotlin/kscience/kmath/benchmarks/BufferBenchmark.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/BufferBenchmark.kt b/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/BufferBenchmark.kt index 42a03bc53..e14b393e2 100644 --- a/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/BufferBenchmark.kt +++ b/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/BufferBenchmark.kt @@ -1,7 +1,7 @@ package kscience.kmath.benchmarks -import kscience.kmath.operations.Complex -import kscience.kmath.operations.complex +import kscience.kmath.complex.Complex +import kscience.kmath.complex.complex import kscience.kmath.structures.MutableBuffer import kscience.kmath.structures.RealBuffer import org.openjdk.jmh.annotations.Benchmark From f054a4c039c4d402807352466fdd38e1de3d40d6 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Thu, 11 Feb 2021 23:34:48 +0700 Subject: [PATCH 08/10] Fix JVM signature of generated invoke method --- .../jvmMain/kotlin/kscience/kmath/asm/internal/AsmBuilder.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kmath-ast/src/jvmMain/kotlin/kscience/kmath/asm/internal/AsmBuilder.kt b/kmath-ast/src/jvmMain/kotlin/kscience/kmath/asm/internal/AsmBuilder.kt index 93d8d1143..cd1236b70 100644 --- a/kmath-ast/src/jvmMain/kotlin/kscience/kmath/asm/internal/AsmBuilder.kt +++ b/kmath-ast/src/jvmMain/kotlin/kscience/kmath/asm/internal/AsmBuilder.kt @@ -83,7 +83,7 @@ internal class AsmBuilder( ACC_PUBLIC or ACC_FINAL, "invoke", getMethodDescriptor(tType, MAP_TYPE), - "(L${MAP_TYPE.internalName}<${SYMBOL_TYPE.descriptor}${if (Modifier.isFinal(classOfT.modifiers)) "" else "+"}${tType.descriptor}>;)${tType.descriptor}", + "(L${MAP_TYPE.internalName}<${SYMBOL_TYPE.descriptor}+${tType.descriptor}>;)${tType.descriptor}", null, ).instructionAdapter { invokeMethodVisitor = this From 0e42cc9f5c5252a8e956ca61581d87f1ac374416 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Thu, 11 Feb 2021 23:35:45 +0700 Subject: [PATCH 09/10] Update README --- README.md | 4 ++-- kmath-ast/README.md | 8 ++++---- kmath-ast/docs/README-TEMPLATE.md | 2 +- kmath-complex/README.md | 6 +++--- kmath-core/README.md | 6 +++--- kmath-for-real/README.md | 6 +++--- kmath-functions/README.md | 6 +++--- kmath-nd4j/README.md | 6 +++--- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index d47016a2a..586d2185f 100644 --- a/README.md +++ b/README.md @@ -257,8 +257,8 @@ repositories { } dependencies { - api("kscience.kmath:kmath-core:0.2.0-dev-6") - // api("kscience.kmath:kmath-core-jvm:0.2.0-dev-6") for jvm-specific version + api("kscience.kmath:kmath-core:0.2.0-dev-7") + // api("kscience.kmath:kmath-core-jvm:0.2.0-dev-7") for jvm-specific version } ``` diff --git a/kmath-ast/README.md b/kmath-ast/README.md index 8499f7171..c54c4afb1 100644 --- a/kmath-ast/README.md +++ b/kmath-ast/README.md @@ -12,7 +12,7 @@ This subproject implements the following features: > #### Artifact: > -> This module artifact: `kscience.kmath:kmath-ast:0.2.0-dev-6`. +> This module artifact: `kscience.kmath:kmath-ast:0.2.0-dev-7`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-ast/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-ast/_latestVersion) > @@ -30,7 +30,7 @@ This subproject implements the following features: > } > > dependencies { -> implementation 'kscience.kmath:kmath-ast:0.2.0-dev-6' +> implementation 'kscience.kmath:kmath-ast:0.2.0-dev-7' > } > ``` > **Gradle Kotlin DSL:** @@ -44,7 +44,7 @@ This subproject implements the following features: > } > > dependencies { -> implementation("kscience.kmath:kmath-ast:0.2.0-dev-6") +> implementation("kscience.kmath:kmath-ast:0.2.0-dev-7") > } > ``` @@ -75,7 +75,7 @@ import kscience.kmath.expressions.Symbol; public final class AsmCompiledExpression_45045_0 implements Expression { private final Object[] constants; - public final Double invoke(Map arguments) { + public final Double invoke(Map arguments) { return (Double)((Function2)this.constants[0]).invoke((Double)MapIntrinsics.getOrFail(arguments, "x"), 2); } diff --git a/kmath-ast/docs/README-TEMPLATE.md b/kmath-ast/docs/README-TEMPLATE.md index 3227a2ad3..ebaa6246a 100644 --- a/kmath-ast/docs/README-TEMPLATE.md +++ b/kmath-ast/docs/README-TEMPLATE.md @@ -33,7 +33,7 @@ import kscience.kmath.expressions.Symbol; public final class AsmCompiledExpression_45045_0 implements Expression { private final Object[] constants; - public final Double invoke(Map arguments) { + public final Double invoke(Map arguments) { return (Double)((Function2)this.constants[0]).invoke((Double)MapIntrinsics.getOrFail(arguments, "x"), 2); } diff --git a/kmath-complex/README.md b/kmath-complex/README.md index eecb6b205..8e5320225 100644 --- a/kmath-complex/README.md +++ b/kmath-complex/README.md @@ -8,7 +8,7 @@ Complex and hypercomplex number systems in KMath: > #### Artifact: > -> This module artifact: `kscience.kmath:kmath-complex:0.2.0-dev-6`. +> This module artifact: `kscience.kmath:kmath-complex:0.2.0-dev-7`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-complex/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-complex/_latestVersion) > @@ -26,7 +26,7 @@ Complex and hypercomplex number systems in KMath: > } > > dependencies { -> implementation 'kscience.kmath:kmath-complex:0.2.0-dev-6' +> implementation 'kscience.kmath:kmath-complex:0.2.0-dev-7' > } > ``` > **Gradle Kotlin DSL:** @@ -40,6 +40,6 @@ Complex and hypercomplex number systems in KMath: > } > > dependencies { -> implementation("kscience.kmath:kmath-complex:0.2.0-dev-6") +> implementation("kscience.kmath:kmath-complex:0.2.0-dev-7") > } > ``` diff --git a/kmath-core/README.md b/kmath-core/README.md index 504171fe2..a38b3acaa 100644 --- a/kmath-core/README.md +++ b/kmath-core/README.md @@ -15,7 +15,7 @@ performance calculations to code generation. > #### Artifact: > -> This module artifact: `kscience.kmath:kmath-core:0.2.0-dev-6`. +> This module artifact: `kscience.kmath:kmath-core:0.2.0-dev-7`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-core/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-core/_latestVersion) > @@ -33,7 +33,7 @@ performance calculations to code generation. > } > > dependencies { -> implementation 'kscience.kmath:kmath-core:0.2.0-dev-6' +> implementation 'kscience.kmath:kmath-core:0.2.0-dev-7' > } > ``` > **Gradle Kotlin DSL:** @@ -47,6 +47,6 @@ performance calculations to code generation. > } > > dependencies { -> implementation("kscience.kmath:kmath-core:0.2.0-dev-6") +> implementation("kscience.kmath:kmath-core:0.2.0-dev-7") > } > ``` diff --git a/kmath-for-real/README.md b/kmath-for-real/README.md index 9b191121d..c291be3a1 100644 --- a/kmath-for-real/README.md +++ b/kmath-for-real/README.md @@ -7,7 +7,7 @@ > #### Artifact: > -> This module artifact: `kscience.kmath:kmath-for-real:0.2.0-dev-6`. +> This module artifact: `kscience.kmath:kmath-for-real:0.2.0-dev-7`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-for-real/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-for-real/_latestVersion) > @@ -25,7 +25,7 @@ > } > > dependencies { -> implementation 'kscience.kmath:kmath-for-real:0.2.0-dev-6' +> implementation 'kscience.kmath:kmath-for-real:0.2.0-dev-7' > } > ``` > **Gradle Kotlin DSL:** @@ -39,6 +39,6 @@ > } > > dependencies { -> implementation("kscience.kmath:kmath-for-real:0.2.0-dev-6") +> implementation("kscience.kmath:kmath-for-real:0.2.0-dev-7") > } > ``` diff --git a/kmath-functions/README.md b/kmath-functions/README.md index 3e3d96fe9..f5462e09f 100644 --- a/kmath-functions/README.md +++ b/kmath-functions/README.md @@ -10,7 +10,7 @@ Functions and interpolations: > #### Artifact: > -> This module artifact: `kscience.kmath:kmath-functions:0.2.0-dev-6`. +> This module artifact: `kscience.kmath:kmath-functions:0.2.0-dev-7`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-functions/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-functions/_latestVersion) > @@ -28,7 +28,7 @@ Functions and interpolations: > } > > dependencies { -> implementation 'kscience.kmath:kmath-functions:0.2.0-dev-6' +> implementation 'kscience.kmath:kmath-functions:0.2.0-dev-7' > } > ``` > **Gradle Kotlin DSL:** @@ -42,6 +42,6 @@ Functions and interpolations: > } > > dependencies { -> implementation("kscience.kmath:kmath-functions:0.2.0-dev-6") +> implementation("kscience.kmath:kmath-functions:0.2.0-dev-7") > } > ``` diff --git a/kmath-nd4j/README.md b/kmath-nd4j/README.md index 5ef42bab3..9011ef3c5 100644 --- a/kmath-nd4j/README.md +++ b/kmath-nd4j/README.md @@ -9,7 +9,7 @@ This subproject implements the following features: > #### Artifact: > -> This module artifact: `kscience.kmath:kmath-nd4j:0.2.0-dev-6`. +> This module artifact: `kscience.kmath:kmath-nd4j:0.2.0-dev-7`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-nd4j/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-nd4j/_latestVersion) > @@ -27,7 +27,7 @@ This subproject implements the following features: > } > > dependencies { -> implementation 'kscience.kmath:kmath-nd4j:0.2.0-dev-6' +> implementation 'kscience.kmath:kmath-nd4j:0.2.0-dev-7' > } > ``` > **Gradle Kotlin DSL:** @@ -41,7 +41,7 @@ This subproject implements the following features: > } > > dependencies { -> implementation("kscience.kmath:kmath-nd4j:0.2.0-dev-6") +> implementation("kscience.kmath:kmath-nd4j:0.2.0-dev-7") > } > ``` From acfff40d965634c19d42462295daa1f778e8c89f Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sat, 13 Feb 2021 21:05:01 +0700 Subject: [PATCH 10/10] Fix my mistakes in descriptions of core algebraic structures --- .../kscience/kmath/operations/Algebra.kt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt b/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt index f3a87d644..14006ea10 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt +++ b/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt @@ -95,8 +95,8 @@ public interface Algebra { public inline operator fun , R> A.invoke(block: A.() -> R): R = run(block) /** - * Represents "semispace", i.e. algebraic structure with associative binary operation called "addition" as well as - * multiplication by scalars. + * Represents linear space without neutral element, i.e. algebraic structure with associative, binary operation [add] + * and scalar multiplication [multiply]. * * @param T the type of element of this semispace. */ @@ -208,10 +208,10 @@ public interface SpaceOperations : Algebra { } /** - * Represents linear space, i.e. algebraic structure with associative binary operation called "addition" and its neutral - * element as well as multiplication by scalars. + * Represents linear space with neutral element, i.e. algebraic structure with associative, binary operation [add] and + * scalar multiplication [multiply]. * - * @param T the type of element of this group. + * @param T the type of element of this semispace. */ public interface Space : SpaceOperations { /** @@ -221,8 +221,8 @@ public interface Space : SpaceOperations { } /** - * Represents semiring, i.e. algebraic structure with two associative binary operations called "addition" and - * "multiplication". + * Represents rng, i.e. algebraic structure with associative, binary, commutative operation [add] and associative, + * operation [multiply] distributive over [add]. * * @param T the type of element of this semiring. */ @@ -270,8 +270,8 @@ public interface Ring : Space, RingOperations { } /** - * Represents semifield, i.e. algebraic structure with three operations: associative "addition" and "multiplication", - * and "division". + * Represents field without identity elements, i.e. algebraic structure with associative, binary, commutative operations + * [add] and [multiply]; binary operation [divide] as multiplication of left operand by reciprocal of right one. * * @param T the type of element of this semifield. */