diff --git a/kmath-core/src/commonMain/kotlin/scientifik/kmath/linear/Matrix.kt b/kmath-core/src/commonMain/kotlin/scientifik/kmath/linear/Matrix.kt index 2a5765e30..35ad86379 100644 --- a/kmath-core/src/commonMain/kotlin/scientifik/kmath/linear/Matrix.kt +++ b/kmath-core/src/commonMain/kotlin/scientifik/kmath/linear/Matrix.kt @@ -66,6 +66,11 @@ interface MatrixSpace> : Space> { } } +/** + * A marker interface representing some matrix feature like diagonal, sparce, zero, etc. Features used to optimize matrix + * operations performance in some cases. + */ +interface MatrixFeature /** * Specialized 2-d structure @@ -91,6 +96,8 @@ interface Matrix> : NDStructure, SpaceElement get(i, j) } } + val features: Set + companion object { fun real(rows: Int, columns: Int, initializer: (Int, Int) -> Double) = MatrixSpace.real(rows, columns).produce(rows, columns, initializer) @@ -147,7 +154,8 @@ data class StructureMatrixSpace>( data class StructureMatrix>( override val context: StructureMatrixSpace, - val structure: NDStructure + val structure: NDStructure, + override val features: Set = emptySet() ) : Matrix { init { if (structure.shape.size != 2 || structure.shape[0] != context.rowNum || structure.shape[1] != context.colNum) {