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/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 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-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 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-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt b/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt index 8766f2e5f..234435b29 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt +++ b/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt @@ -9,7 +9,10 @@ import kscience.kmath.structures.BufferFactory 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> { /** @@ -83,9 +86,16 @@ public interface MatrixContext> : SpaceOperations, out M : Matrix> : MatrixContext { /** - * The ring context for matrix elements + * The ring over matrix elements. */ public val elementContext: R 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 df4e4de09..c96e55be6 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/VirtualMatrix.kt +++ b/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/VirtualMatrix.kt @@ -1,5 +1,10 @@ package kscience.kmath.linear +/** + * 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, diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/nd/Structure2D.kt b/kmath-core/src/commonMain/kotlin/kscience/kmath/nd/Structure2D.kt index 32e0704fc..e2694309a 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/nd/Structure2D.kt +++ b/kmath-core/src/commonMain/kotlin/kscience/kmath/nd/Structure2D.kt @@ -86,3 +86,10 @@ public fun NDStructure.as2D(): Structure2D = if (shape.size == 2) Structure2DWrapper(this) else error("Can't create 2d-structure from ${shape.size}d-structure") + +/** + * Alias for [Structure2D] with more familiar name. + * + * @param T the type of items in the matrix. + */ +public typealias Matrix = Structure2D 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. */ 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") > } > ```