Matrix

@Serializable
class Matrix(val rows: Int, val cols: Int)(source)

Represents a two-dimensional matrix with support for basic operations such as indexing, copying, and mathematical computations.

Constructors

Link copied to clipboard
constructor(rows: Int, cols: Int)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val cols: Int

The number of columns in the matrix.

Link copied to clipboard
Link copied to clipboard
val rows: Int

The number of rows in the matrix.

Functions

Link copied to clipboard

Calculates the mean of each column in the matrix and returns the result as a new single-row matrix.

Link copied to clipboard
fun copy(): Matrix
Link copied to clipboard
operator fun get(row: Int, column: Int): Double
Link copied to clipboard
fun isSymmetric(matrix: Matrix, tolerance: Double = 1.0E-10): Boolean

Checks if the given matrix is symmetric within a specified tolerance.

Link copied to clipboard
operator fun Matrix.minus(other: Matrix): Matrix

operator fun Matrix.minus(other: SparseMatrix): Matrix

Extension function to subtract a SparseMatrix from a Matrix.

Link copied to clipboard

Multiplies two matrices and returns the resulting matrix.

Link copied to clipboard
operator fun Matrix.plus(other: SparseMatrix): Matrix

Extension function to add a Matrix to a SparseMatrix.

Link copied to clipboard
operator fun set(row: Int, column: Int, value: Double)
Link copied to clipboard
operator fun times(other: Matrix): Matrix

Multiplies this matrix with another matrix and returns the resulting matrix.

Link copied to clipboard

Extension function to convert a dense Matrix to a SparseMatrix.

Link copied to clipboard

Returns a new matrix that is the transpose of this matrix.