diff --git a/kmath-ejml/src/main/kotlin/scientifik/kmath/ejml/EjmlMatrix.kt b/kmath-ejml/src/main/kotlin/scientifik/kmath/ejml/EjmlMatrix.kt index 09b9c4fcd..4bf0a505f 100644 --- a/kmath-ejml/src/main/kotlin/scientifik/kmath/ejml/EjmlMatrix.kt +++ b/kmath-ejml/src/main/kotlin/scientifik/kmath/ejml/EjmlMatrix.kt @@ -23,7 +23,7 @@ class EjmlMatrix(val origin: SimpleMatrix, features: Set? = null) override val shape: IntArray get() = intArrayOf(origin.numRows(), origin.numCols()) - override val features: Set = hashSetOf( + override val features: Set = setOf( object : LUPDecompositionFeature, DeterminantFeature { override val determinant: Double get() = origin.determinant() @@ -48,7 +48,7 @@ class EjmlMatrix(val origin: SimpleMatrix, features: Set? = null) override val p: FeaturedMatrix get() = lup.first } - ).addAll(features.orEmpty()) + ) union features.orEmpty() override fun suggestFeature(vararg features: MatrixFeature): FeaturedMatrix = EjmlMatrix(origin, this.features + features) @@ -56,6 +56,7 @@ class EjmlMatrix(val origin: SimpleMatrix, features: Set? = null) override operator fun get(i: Int, j: Int): Double = origin[i, j] 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) }