Matrix

class Matrix(data: Array<DoubleArray>)

Represents a matrix of doubles. Internally represented as a SimpleMatrix from EJML.

Constructors

Link copied to clipboard
constructor(data: Collection<Collection<Double>>)

Constructor to create a Matrix from a list of lists.

constructor(data: Array<DoubleArray>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The number of columns in the matrix.

Link copied to clipboard

The number of rows in the matrix.

Link copied to clipboard

The size of the matrix.

Functions

Link copied to clipboard
fun column(n: Int): Matrix

Returns the nth column of the matrix.

Link copied to clipboard

Returns the diagonal elements of this matrix.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
operator fun get(i: Int, j: Int): Double

Returns the element at the given indices.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
operator fun minus(other: Matrix): Matrix

Subtracts another matrix from this matrix. The matrices must have the same dimensions.

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

Adds another matrix to this matrix. The matrices must have the same dimensions.

Link copied to clipboard
fun row(n: Int): Matrix

Returns the nth row of the matrix.

Link copied to clipboard
operator fun set(i: Int, j: Int, value: Double)

Sets the element at the given indices to the given value.

Link copied to clipboard
fun solve(other: Matrix): Matrix
Link copied to clipboard
operator fun times(other: Matrix): Matrix

Multiplies this matrix by another matrix. The number of columns in this matrix must match the number of rows in the other matrix.

operator fun times(scalar: Double): Matrix
operator fun times(scalar: Int): Matrix

Multiplies this matrix by a scalar.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard

Returns the transpose of this matrix.

Link copied to clipboard
operator fun unaryMinus(): Matrix

Returns the matrix with all elements negated. This is equivalent to multiplying the matrix by -1.