Merge branch 'dev' into altavir/tensor-algebra
This commit is contained in:
commit
9ef32db236
21
CHANGELOG.md
21
CHANGELOG.md
@ -4,27 +4,28 @@
|
|||||||
### Added
|
### Added
|
||||||
- `fun` annotation for SAM interfaces in library
|
- `fun` annotation for SAM interfaces in library
|
||||||
- Explicit `public` visibility for all public APIs
|
- Explicit `public` visibility for all public APIs
|
||||||
- Better trigonometric and hyperbolic functions for `AutoDiffField` (https://github.com/mipt-npm/kmath/pull/140).
|
- Better trigonometric and hyperbolic functions for `AutoDiffField` (https://github.com/mipt-npm/kmath/pull/140)
|
||||||
- Automatic README generation for features (#139)
|
- Automatic README generation for features (#139)
|
||||||
- Native support for `memory`, `core` and `dimensions`
|
- Native support for `memory`, `core` and `dimensions`
|
||||||
- `kmath-ejml` to supply EJML SimpleMatrix wrapper (https://github.com/mipt-npm/kmath/pull/136).
|
- `kmath-ejml` to supply EJML SimpleMatrix wrapper (https://github.com/mipt-npm/kmath/pull/136)
|
||||||
- A separate `Symbol` entity, which is used for global unbound symbol.
|
- A separate `Symbol` entity, which is used for global unbound symbol.
|
||||||
- A `Symbol` indexing scope.
|
- A `Symbol` indexing scope.
|
||||||
- Basic optimization API for Commons-math.
|
- Basic optimization API for Commons-math.
|
||||||
- Chi squared optimization for array-like data in CM
|
- Chi squared optimization for array-like data in CM
|
||||||
- `Fitting` utility object in prob/stat
|
- `Fitting` utility object in prob/stat
|
||||||
- ND4J support module submitting `NDStructure` and `NDAlgebra` over `INDArray`.
|
- ND4J support module submitting `NDStructure` and `NDAlgebra` over `INDArray`
|
||||||
- Coroutine-deterministic Monte-Carlo scope with a random number generator.
|
- Coroutine-deterministic Monte-Carlo scope with a random number generator
|
||||||
- Some minor utilities to `kmath-for-real`.
|
- Some minor utilities to `kmath-for-real`
|
||||||
- Generic operation result parameter to `MatrixContext`
|
- Generic operation result parameter to `MatrixContext`
|
||||||
|
- New `MatrixFeature` interfaces for matrix decompositions
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Package changed from `scientifik` to `kscience.kmath`.
|
- Package changed from `scientifik` to `kscience.kmath`
|
||||||
- Gradle version: 6.6 -> 6.7.1
|
- Gradle version: 6.6 -> 6.8
|
||||||
- Minor exceptions refactor (throwing `IllegalArgumentException` by argument checks instead of `IllegalStateException`)
|
- Minor exceptions refactor (throwing `IllegalArgumentException` by argument checks instead of `IllegalStateException`)
|
||||||
- `Polynomial` secondary constructor made function.
|
- `Polynomial` secondary constructor made function
|
||||||
- Kotlin version: 1.3.72 -> 1.4.20
|
- Kotlin version: 1.3.72 -> 1.4.21
|
||||||
- `kmath-ast` doesn't depend on heavy `kotlin-reflect` library.
|
- `kmath-ast` doesn't depend on heavy `kotlin-reflect` library
|
||||||
- Full autodiff refactoring based on `Symbol`
|
- Full autodiff refactoring based on `Symbol`
|
||||||
- `kmath-prob` renamed to `kmath-stat`
|
- `kmath-prob` renamed to `kmath-stat`
|
||||||
- Grid generators moved to `kmath-for-real`
|
- Grid generators moved to `kmath-for-real`
|
||||||
|
@ -43,7 +43,7 @@ public class BufferMatrix<T : Any>(
|
|||||||
if (this === other) return true
|
if (this === other) return true
|
||||||
|
|
||||||
return when (other) {
|
return when (other) {
|
||||||
is NDStructure<*> -> NDStructure.equals(this, other)
|
is NDStructure<*> -> NDStructure.contentEquals(this, other)
|
||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ public interface NDStructure<T> {
|
|||||||
/**
|
/**
|
||||||
* Indicates whether some [NDStructure] is equal to another one.
|
* Indicates whether some [NDStructure] is equal to another one.
|
||||||
*/
|
*/
|
||||||
public fun equals(st1: NDStructure<*>, st2: NDStructure<*>): Boolean {
|
public fun contentEquals(st1: NDStructure<*>, st2: NDStructure<*>): Boolean {
|
||||||
if (st1 === st2) return true
|
if (st1 === st2) return true
|
||||||
|
|
||||||
// fast comparison of buffers if possible
|
// fast comparison of buffers if possible
|
||||||
@ -275,7 +275,7 @@ public abstract class NDBuffer<T> : NDStructure<T> {
|
|||||||
override fun elements(): Sequence<Pair<IntArray, T>> = strides.indices().map { it to this[it] }
|
override fun elements(): Sequence<Pair<IntArray, T>> = strides.indices().map { it to this[it] }
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
return NDStructure.equals(this, other as? NDStructure<*> ?: return false)
|
return NDStructure.contentEquals(this, other as? NDStructure<*> ?: return false)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
|
@ -24,7 +24,7 @@ public class LazyNDStructure<T>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override fun equals(other: Any?): Boolean {
|
public override fun equals(other: Any?): Boolean {
|
||||||
return NDStructure.equals(this, other as? NDStructure<*> ?: return false)
|
return NDStructure.contentEquals(this, other as? NDStructure<*> ?: return false)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun hashCode(): Int {
|
public override fun hashCode(): Int {
|
||||||
|
@ -3,6 +3,7 @@ package kscience.kmath.ejml
|
|||||||
import kscience.kmath.linear.*
|
import kscience.kmath.linear.*
|
||||||
import kscience.kmath.misc.UnstableKMathAPI
|
import kscience.kmath.misc.UnstableKMathAPI
|
||||||
import kscience.kmath.structures.Matrix
|
import kscience.kmath.structures.Matrix
|
||||||
|
import kscience.kmath.structures.NDStructure
|
||||||
import kscience.kmath.structures.RealBuffer
|
import kscience.kmath.structures.RealBuffer
|
||||||
import org.ejml.dense.row.factory.DecompositionFactory_DDRM
|
import org.ejml.dense.row.factory.DecompositionFactory_DDRM
|
||||||
import org.ejml.simple.SimpleMatrix
|
import org.ejml.simple.SimpleMatrix
|
||||||
@ -15,7 +16,7 @@ import kotlin.reflect.cast
|
|||||||
* @property origin the underlying [SimpleMatrix].
|
* @property origin the underlying [SimpleMatrix].
|
||||||
* @author Iaroslav Postovalov
|
* @author Iaroslav Postovalov
|
||||||
*/
|
*/
|
||||||
public inline class EjmlMatrix(
|
public class EjmlMatrix(
|
||||||
public val origin: SimpleMatrix,
|
public val origin: SimpleMatrix,
|
||||||
) : Matrix<Double> {
|
) : Matrix<Double> {
|
||||||
public override val rowNum: Int get() = origin.numRows()
|
public override val rowNum: Int get() = origin.numRows()
|
||||||
@ -76,4 +77,14 @@ public inline class EjmlMatrix(
|
|||||||
}?.let { type.cast(it) }
|
}?.let { type.cast(it) }
|
||||||
|
|
||||||
public override operator fun get(i: Int, j: Int): Double = origin[i, j]
|
public override operator fun get(i: Int, j: Int): Double = origin[i, j]
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (other !is Matrix<*>) return false
|
||||||
|
return NDStructure.contentEquals(this, other)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int = origin.hashCode()
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user