Drop koma module, implement kmath-ejml module copying it, but for EJML SimpleMatrix #136

Merged
CommanderTvis merged 24 commits from ejml into dev 2020-10-01 21:30:40 +03:00
Showing only changes of commit 91d692381c - Show all commits

View File

@ -23,7 +23,7 @@ class EjmlMatrix(val origin: SimpleMatrix, features: Set<MatrixFeature>? = null)
override val shape: IntArray override val shape: IntArray
get() = intArrayOf(origin.numRows(), origin.numCols()) get() = intArrayOf(origin.numRows(), origin.numCols())
override val features: Set<MatrixFeature> = hashSetOf( override val features: Set<MatrixFeature> = setOf(
object : LUPDecompositionFeature<Double>, DeterminantFeature<Double> { object : LUPDecompositionFeature<Double>, DeterminantFeature<Double> {
override val determinant: Double override val determinant: Double
get() = origin.determinant() get() = origin.determinant()
@ -48,7 +48,7 @@ class EjmlMatrix(val origin: SimpleMatrix, features: Set<MatrixFeature>? = null)
override val p: FeaturedMatrix<Double> override val p: FeaturedMatrix<Double>
get() = lup.first get() = lup.first
} }
).addAll(features.orEmpty()) ) union features.orEmpty()
override fun suggestFeature(vararg features: MatrixFeature): FeaturedMatrix<Double> = override fun suggestFeature(vararg features: MatrixFeature): FeaturedMatrix<Double> =
EjmlMatrix(origin, this.features + features) EjmlMatrix(origin, this.features + features)
@ -56,6 +56,7 @@ class EjmlMatrix(val origin: SimpleMatrix, features: Set<MatrixFeature>? = null)
override operator fun get(i: Int, j: Int): Double = origin[i, j] override operator fun get(i: Int, j: Int): Double = origin[i, j]
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean {
if (other is EjmlMatrix) return origin.isIdentical(other.origin, 0.0)
return NDStructure.equals(this, other as? NDStructure<*> ?: return false) return NDStructure.equals(this, other as? NDStructure<*> ?: return false)
} }