DenseMatrix
Mutable column-major matrix, including borrowed rectangles of another matrix or buffer. Entry A(i, j) is at offset + i + j * leadingDimension in values. Factories allocate or borrow storage; view shares it. Equality and hashing use logical entries, including signed zeros and NaNs. Serialization writes only the logical rectangle and decodes it into independent compact storage. Do not use the matrix as a hash-map key while mutating its entries.
Functions
columnView
A writable view of column, indexed from zero within this matrix. Changes through the vector update the matrix. The view borrows storage; use Vector.copy for an independent result.
equals
forEachColumns
Visits writable column views in column order, including empty columns. Returns no new matrix.
get
hashCode
set
toArray
Materialise into a fresh Array<DoubleArray> of rows, independent of the internal storage.
toString
view
Borrows a rectangle without copying. Mutations through either reference are shared. Offsets and extents are relative to this matrix; nested views retain its leading dimension. Empty rectangles at either boundary are valid and access no entries.
A writable vector view of column. Mutations update this matrix; the vector's indices are local rows. Built-in containers return DenseVector or SparseVector; other implementations use Matrix.get and Matrix.set. Use Vector.copy for independent storage.
Visits writable column views in column order, including empty columns. Mutations through a callback's vector update this matrix. Concrete containers retain their dense or sparse callback type for calls to KoblasEngine; through Matrix, callbacks use the generic Vector contract. Returns no new matrix.
Visits stored entries as (row, column, value), columns first and rows ascending within each column. SparseMatrix visits only stored positions, including stored zeros; other implementations visit every entry. Dense views report local indices and exclude padding. Empty matrices invoke no callbacks.
Matrix norm of type: Norm.Frobenius is the rescaled square root of the sum of squared entries, Norm.One is the largest absolute column sum, Norm.Infinity is the largest absolute row sum, and Norm.MaxAbs is the maximum absolute entry. A matrix with either dimension empty has norm zero.
Plain sum of all entries. Dense storage uses KoblasEngine.sum through the default koblas engine, sparse storage sums only its stored values, and custom matrices are read through Matrix.get. An empty matrix sums to zero. Summation order and rounding depend on the storage and engine.
Sums along axis into a fresh dense vector: axis = 0 reduces rows and returns Matrix.cols column sums; axis = 1 reduces columns and returns Matrix.rows row sums. A zero-length reduced dimension contributes zero to each result. The result owns its storage.
Fresh transposed matrix. Sparse storage remains CSC and preserves stored zeros; other implementations produce dense storage. Views transpose only their logical entries. For products, prefer the transpose flags on KoblasEngine.gemv and KoblasEngine.gemm to avoid materializing the transpose.