diff --git a/orx-math/src/commonMain/kotlin/matrix/Matrix.kt b/orx-math/src/commonMain/kotlin/matrix/Matrix.kt index f6b3f2b1..e675461c 100644 --- a/orx-math/src/commonMain/kotlin/matrix/Matrix.kt +++ b/orx-math/src/commonMain/kotlin/matrix/Matrix.kt @@ -1,5 +1,7 @@ package org.openrndr.extra.math.matrix +import kotlinx.serialization.Serializable + /** * Represents a two-dimensional matrix with support for basic operations such as indexing, * copying, and mathematical computations. @@ -7,6 +9,7 @@ package org.openrndr.extra.math.matrix * @property rows The number of rows in the matrix. * @property cols The number of columns in the matrix. */ +@Serializable class Matrix(val rows: Int, val cols: Int) { val data = Array(rows) { DoubleArray(cols) } diff --git a/orx-math/src/commonMain/kotlin/matrix/SparseMatrix.kt b/orx-math/src/commonMain/kotlin/matrix/SparseMatrix.kt index 96ff8381..0557ff55 100644 --- a/orx-math/src/commonMain/kotlin/matrix/SparseMatrix.kt +++ b/orx-math/src/commonMain/kotlin/matrix/SparseMatrix.kt @@ -1,5 +1,6 @@ package org.openrndr.extra.math.matrix +import kotlinx.serialization.Serializable import kotlin.math.abs import kotlin.math.sqrt @@ -37,6 +38,7 @@ private fun countNonZeroElements(matrix: Matrix): Int { * @property columnIndices Array containing the column indices of the non-zero values. * @property rowPointers Array containing the starting position of each row in the values array. */ +@Serializable class SparseMatrix( val rows: Int, val cols: Int,