Replace ?: with set merging

This commit is contained in:
Iaroslav 2020-09-14 19:53:31 +07:00
parent d088fdf77c
commit 1c495759cd
No known key found for this signature in database
GPG Key ID: 46E15E4A31B3BCD7

View File

@ -23,7 +23,7 @@ class EjmlMatrix(val origin: SimpleMatrix, features: Set<MatrixFeature>? = null)
override val shape: IntArray
get() = intArrayOf(origin.numRows(), origin.numCols())
override val features: Set<MatrixFeature> = features ?: hashSetOf(
override val features: Set<MatrixFeature> = hashSetOf(
object : DeterminantFeature<Double> {
override val determinant: Double
get() = origin.determinant()
@ -50,7 +50,7 @@ class EjmlMatrix(val origin: SimpleMatrix, features: Set<MatrixFeature>? = null)
override val p: FeaturedMatrix<Double>
get() = lup.first
}
)
).addAll(features)
override fun suggestFeature(vararg features: MatrixFeature): FeaturedMatrix<Double> =
EjmlMatrix(origin, this.features + features)