kumulant

DenseMatrix

@Serializable(with = DenseMatrixSerializer::class)
@SerialName(value = "DenseMatrix")
class DenseMatrix : MatrixView(source)

Dense row-major matrix backed by a single contiguous DoubleArray of length rows * cols. Element (i, j) lives at data[i * cols + j].

Flat layout buys three properties: one heap allocation rather than rows separate row arrays; cache-friendly sweeps across row boundaries; the SIMD primitives in the internal Primitives.kt can stream long runs without re-fetching row references on each iteration.

The on-the-wire form is a 2D Array<DoubleArray> for readability when inspecting JSON / CBOR payloads. The in-memory form is flat. The custom DenseMatrixSerializer bridges the two; encoding writes a 2D array, decoding reads one back and packs it into the flat backing.

Mutation is internal; DenseMatrix is effectively immutable from outside the kumulant module.

Constructors

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

Types

Link copied to clipboard
object Companion

Factory entrypoints for DenseMatrix.

Properties

Link copied to clipboard
open override val cols: Int

Number of columns.

Link copied to clipboard
open override val rows: Int

Number of rows.

Functions

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

Read entry at row i, column j.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toArray(): Array<DoubleArray>

Materialise into a fresh row-major Array<DoubleArray>. Always allocates; the result is independent of any internal storage.

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

DenseMatrix

constructor(rows: Int, cols: Int = rows)(source)

cols

open override val cols: Int(source)

Number of columns.

equals

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

get

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

Read entry at row i, column j.

hashCode

open override fun hashCode(): Int(source)

rows

open override val rows: Int(source)

Number of rows.

toArray

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

Materialise into a fresh row-major Array<DoubleArray>. Always allocates; the result is independent of any internal storage.

toString

open override fun toString(): String(source)