DynamicVector

Represents a column vector of doubles with dynamic (runtime-checked) dimensions. This is essentially a DynamicMatrix with a single column.

Constructors

Link copied to clipboard
constructor(data: DoubleArray)

Constructor to create a DynamicVector from an array of values.

constructor(data: Collection<Double>)

Constructor to create a DynamicVector from a collection of values.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The dimension (length) of this vector.

Link copied to clipboard
@get:JvmName(name = "inverse")
val inverse: DynamicMatrix

The inverse of this matrix. The matrix must be square and invertible. If the matrix is not square, use pseudoInverse instead.

Link copied to clipboard
@get:JvmName(name = "magnitude")
val magnitude: Double

Returns the Euclidean norm (magnitude) of this vector.

Link copied to clipboard
@get:JvmName(name = "norm")
val norm: Double

Returns the Frobenius norm of this matrix. The Frobenius norm is the square root of the sum of squares of all elements.

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
@get:JvmName(name = "pseudoInverse")
val pseudoInverse: DynamicMatrix

The pseudo-inverse of this matrix. The matrix must be square and invertible.

Link copied to clipboard
val size: Pair<Int, Int>

The size of the matrix.

Link copied to clipboard
@get:JvmName(name = "transpose")
val transpose: DynamicMatrix

The transpose of this matrix.

Functions

Link copied to clipboard

Returns the nth column of the matrix.

Link copied to clipboard
open override fun copy(): DynamicVector

Returns a copy of this vector.

Link copied to clipboard

Returns the diagonal elements of this matrix.

Link copied to clipboard
open operator fun div(scalar: Double): DynamicMatrix
open operator fun div(scalar: Number): DynamicMatrix

Divides this matrix by a scalar.

Link copied to clipboard
fun dot(other: DynamicVector): Double

Computes the dot product of this vector with another vector.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard

Computes the matrix exponential of this matrix, using the Padé approximant.

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

Returns the element at the given indices.

operator fun get(i: Int): Double

Returns the element at the given index.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

Returns the LDLT decomposition of this matrix. Only works for symmetric matrices.

Link copied to clipboard

Returns the LLT (Cholesky) decomposition of this matrix. Only works for symmetric, positive-definite matrices. Provides in-place rank-1 update/downdate methods.

Link copied to clipboard

Returns the LU decomposition of this matrix.

Link copied to clipboard
operator fun minus(other: DynamicMatrix): DynamicMatrix

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

operator fun minus(other: DynamicVector): DynamicVector

Subtracts another vector from this vector.

Link copied to clipboard

Returns a normalized (unit) vector in the same direction.

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

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

operator fun plus(other: DynamicVector): DynamicVector

Adds another vector to this vector.

Link copied to clipboard

Returns the QR decomposition of this matrix.

Link copied to clipboard

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.

operator fun set(i: Int, value: Double)

Sets the element at the given index.

Link copied to clipboard
fun slice(startRow: Int, endRow: Int, startCol: Int, endCol: Int): DynamicMatrix

Returns a submatrix of this matrix.

Link copied to clipboard
Link copied to clipboard
operator fun times(other: DynamicMatrix): DynamicMatrix

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

open operator override fun times(scalar: Double): DynamicVector
open operator override fun times(scalar: Number): DynamicVector

Multiplies this vector by a scalar.

Link copied to clipboard
fun <R : Nat, C : Nat> toSizedMatrix(rows: R, cols: C): Matrix<R, C>

Returns a Matrix with the same dimensions as this matrix. The dimensions are checked at runtime.

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

Negates all elements of this vector.