koblas

DenseMatrix

@Serializable
@SerialName(value = "DenseMatrix")
class DenseMatrix : MatrixStorage, DenseMatrixRegion(source)

Types

Link copied to clipboard
object Companion

Factories for dense matrices.

Properties

cols

open override val cols: Int(source)

leadingDimension

open override val leadingDimension: Int(source)

Distance between consecutive column starts.

offset

open override val offset: Int(source)

Buffer index of the first entry, or an in-bounds buffer boundary for an empty region.

rows

open override val rows: Int(source)

values

open override val values: DoubleArray(source)

Functions

equals

open operator override fun equals(other: Any?): Boolean(source)

get

open operator override fun get(i: Int, j: Int): Double(source)

The entry at row (i), column (j). Throws IndexOutOfBoundsException outside the shape, whatever the storage.

hashCode

open override fun hashCode(): Int(source)

set

open operator override fun set(i: Int, j: Int, v: Double)(source)

Writes (v) at row (i), column (j).

toArray

open override fun toArray(): Array<DoubleArray>(source)

Materialise into a fresh Array<DoubleArray> of rows, independent of the internal storage.

toString

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

Column j as a fresh vector, copied rather than viewed.

Link copied to clipboard

Makes the stored entries match what structure promises, in place.

Link copied to clipboard
@JvmName(name = "subtract")
operator fun DenseMatrix.minus(other: DenseMatrix): DenseMatrix

A - B, allocating. axpy with alpha = -1.0 accumulates into an existing operand.

Link copied to clipboard
@JvmName(name = "add")
operator fun DenseMatrix.plus(other: DenseMatrix): DenseMatrix

A + B, allocating. axpy accumulates into an existing operand.

Link copied to clipboard

Row i as a fresh vector, gathered across the backing. Prefer column where the algorithm allows.

Link copied to clipboard
@JvmName(name = "multiply")
operator fun DenseMatrix.times(other: DenseMatrix): DenseMatrix

A * B (BLAS dgemm), allocating. gemm accumulates into an existing C instead.

@JvmName(name = "multiply")
operator fun DenseMatrix.times(x: DenseVector): DenseVector

Matrix-vector product into a fresh dense result.

@JvmName(name = "multiply")
operator fun DenseMatrix.times(other: SparseMatrix): DenseMatrix

A * B for a dense left operand and sparse right operand, allocating dense storage.

@JvmName(name = "multiply")
operator fun DenseMatrix.times(alpha: Double): DenseMatrix

alpha * A, allocating. scale multiplies in place.

@JvmName(name = "multiplyMatrices")
operator fun Matrix.times(other: Matrix): Matrix

Allocating product through koblas: two sparse operands give CSC storage, any other pairing dense.

Link copied to clipboard

Fresh transposed matrix, with the active backend (koblas). For products, prefer the transpose flags on gemv and gemm, which read the original storage without copying. See DenseBlas.transpose.

Link copied to clipboard
@JvmName(name = "negate")
operator fun DenseMatrix.unaryMinus(): DenseMatrix

-A, allocating.

Link copied to clipboard
open fun view(rowOffset: Int = 0, columnOffset: Int = 0, rows: Int = this.rows - rowOffset, cols: Int = this.cols - columnOffset): DenseMatrixView

Borrows a rectangle without copying. Mutations through either reference are shared. Offsets and extents are relative to this region; a nested view retains the parent's leading dimension. Empty rectangles at either boundary are valid and access no entries.