class RealMatrix: Any

Real matrix of double values.

Fields

Name Description
val entries: Array<DoubleArray>

entry values of matrix whereby each DoubleArray represents a row

val entriesFlattened: DoubleArray

entry values of the matrix flattened to one DoubleArray

val rowDimension: /** number of rows */

number of rows

val columnDimension: /** number of columns */

number of columns

val dimension: /** dimension of matrix as (rowDimension, columnDimension) */

dimension of matrix as (rowDimension, columnDimension)

Constructors

<init>

constructor(matrix: CMRealMatrix)

Parameters

Name Description
matrix: CMRealMatrix

<init>

constructor(matrix: DoubleArray, columnDimension: Int)

Parameters

Name Description
matrix: DoubleArray
columnDimension: Int

<init>

constructor(rowVectors: List<RealVector>)

Parameters

Name Description
rowVectors: List<RealVector>

<init>

constructor(rows: Array<DoubleArray>)

Real matrix of double values.

Parameters

Name Description
rows: Array<DoubleArray>

the rows of the matrix represented as DoubleArray

Methods

get

operator fun get(rowIndex: Int): DoubleArray

Parameters

Name Description
rowIndex: Int

ReturnValue

Name Description
DoubleArray

containsNaN

fun containsNaN(): ()

Returns true, if any value of the vector is NaN.

ReturnValue

Name Description
()

getRow

fun getRow(rowIndex: Int): DoubleArray

Returns the row of rowIndex as double array.

Parameters

Name Description
rowIndex: Int

ReturnValue

Name Description
DoubleArray

getRowMatrix

fun getRowMatrix(rowIndex: Int): RealMatrix

Returns the row of rowIndex as a real matrix.

Parameters

Name Description
rowIndex: Int

ReturnValue

Name Description
RealMatrix

getRowVector

fun getRowVector(rowIndex: Int): RealVector

Returns the row of rowIndex as real vector.

Parameters

Name Description
rowIndex: Int

ReturnValue

Name Description
RealVector

getColumn

fun getColumn(columnIndex: Int): DoubleArray

Returns the column of columnIndex as double array.

Parameters

Name Description
columnIndex: Int

ReturnValue

Name Description
DoubleArray

getColumnMatrix

fun getColumnMatrix(columnIndex: Int): RealMatrix

Returns the column of columnIndex as a real matrix.

Parameters

Name Description
columnIndex: Int

ReturnValue

Name Description
RealMatrix

getColumnVector

fun getColumnVector(columnIndex: Int): RealVector

Returns the column of columnIndex as real vector.

Parameters

Name Description
columnIndex: Int

ReturnValue

Name Description
RealVector

getSubMatrix

fun getSubMatrix(selectedRows: IntArray, selectedColumns: IntArray): RealMatrix

Returns a submatrix of the complete matrix by only selecting the selectedRows and selectedColumns.

Parameters

Name Description
selectedRows: IntArray

selected row indices

selectedColumns: IntArray

selected column indices

ReturnValue

Name Description
RealMatrix

submatrix

getSubMatrix

fun getSubMatrix(selectedRows: IntRange, selectedColumns: IntRange): (selectedRows: IntRange, selectedColumns: IntRange)

Returns a submatrix of the complete matrix by only selecting the selectedRows and selectedColumns.

Parameters

Name Description
selectedRows: IntRange

selected row indices

selectedColumns: IntRange

selected column indices

ReturnValue

Name Description
(selectedRows: IntRange, selectedColumns: IntRange)

submatrix

multiply

fun multiply(other: RealMatrix): RealMatrix

Returns this matrix multiplied with other (return = this x other).

Parameters

Name Description
other: RealMatrix

ReturnValue

Name Description
RealMatrix

multiply

fun multiply(vector: RealVector): RealVector

Returns this matrix multiplied with a vector (return = this x vector).

Parameters

Name Description
vector: RealVector

ReturnValue

Name Description
RealVector

preMultiply

fun preMultiply(other: RealMatrix): RealMatrix

Returns the other matrix multiplied with this (return = other x this).

Parameters

Name Description
other: RealMatrix

ReturnValue

Name Description
RealMatrix

preMultiply

fun preMultiply(vector: RealVector): (vector: RealVector)

Returns a vector multiplied with this matrix (return = vector x this).

Parameters

Name Description
vector: RealVector

ReturnValue

Name Description
(vector: RealVector)

scalarMultiply

fun scalarMultiply(factor: Double): RealMatrix

Returns this matrix multiplied with a scalar factor.

Parameters

Name Description
factor: Double

ReturnValue

Name Description
RealMatrix

scalarAdd

fun scalarAdd(summand: Double): RealMatrix

Returns this matrix multiplied with a scalar summand.

Parameters

Name Description
summand: Double

ReturnValue

Name Description
RealMatrix

transpose

fun transpose(): RealMatrix

Returns the transposed matrix of this matrix.

ReturnValue

Name Description
RealMatrix

inverse

fun inverse(): RealMatrix

Returns the inverse matrix of this matrix.

ReturnValue

Name Description
RealMatrix

normalize

fun normalize(rowIndex: Int, columnIndex: Int): RealMatrix

Parameters

Name Description
rowIndex: Int
columnIndex: Int

ReturnValue

Name Description
RealMatrix

hashCode

fun hashCode(): Int

ReturnValue

Name Description
Int

equals

fun equals(other: Any?): Boolean

Parameters

Name Description
other: Any?

ReturnValue

Name Description
Boolean

toDoubleArray

fun toDoubleArray(): DoubleArray

ReturnValue

Name Description
DoubleArray

toDoubleList

fun toDoubleList(): List<Double>

ReturnValue

Name Description
List<Double>

toRealMatrixCM

fun toRealMatrixCM(): CMRealMatrix

Conversion to adapted Real Matrix class from Apache Commons Math.

ReturnValue

Name Description
CMRealMatrix

toString

fun toString(): String

ReturnValue

Name Description
String

Extensions

appendColumn

fun RealMatrix.appendColumn(newColumn: DoubleArray): RealMatrix

Appends a newColumn to a RealMatrix.

Receiver

Name Description
RealMatrix

Parameters

Name Description
newColumn: DoubleArray

ReturnValue

Name Description
RealMatrix

appendRow

fun RealMatrix.appendRow(newRow: DoubleArray): RealMatrix

Appends a newRow to a RealMatrix.

Receiver

Name Description
RealMatrix

Parameters

Name Description
newRow: DoubleArray

ReturnValue

Name Description
RealMatrix

CompanionObject

RealMatrix

class RealMatrix: Any

Real matrix of double values.

Methods

of

fun of(columnVectors: List<RealVector>): RealMatrix

Creates a RealMatrix from a list of column RealVector.

Parameters

Name Description
columnVectors: List<RealVector>

list of column vectors that must have the same dimension

ReturnValue

Name Description
RealMatrix

of

fun of(vectors: List<Vector3D>): RealMatrix

Creates a RealMatrix from a list of 3D vectors

Parameters

Name Description
vectors: List<Vector3D>

list of 3D vectors whereby each vector will be represented as a row

ReturnValue

Name Description
RealMatrix

ofIdentity

fun ofIdentity(dimension: Int): RealMatrix

Creates an identity RealMatrix of the dimension.

Parameters

Name Description
dimension: Int

ReturnValue

Name Description
RealMatrix

ofDiagonal

fun ofDiagonal(diagonal: RealVector): RealMatrix

Creates a RealMatrix with diagonal entries.

Parameters

Name Description
diagonal: RealVector

entry values for matrix diagonal

ReturnValue

Name Description
RealMatrix