columnView
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.
copy
An independent copy of the logical entries. Sparse storage keeps its pattern, including stored zeros; dense views and custom matrices produce owning dense storage. No backing arrays are shared.
An independent copy of the logical entries. Sparse storage keeps its pattern, including stored zeros; dense views and custom vectors produce owning dense storage. No backing arrays are shared.
copyFrom
Copies source into this matrix, requiring equal shapes before writing. Inputs may share storage; overlapping or opaque sources are snapshotted first. Entries outside a destination view are untouched.
Sparse destinations retain a sparse source's pattern and stored zeros. Other sources store nonzero entries and negative zeros. Structural changes replace sparse buffers; equal patterns reuse them.
Copies source into this vector, requiring equal sizes before writing. Inputs may share storage; overlapping or opaque sources are snapshotted first. Dense views retain their offsets and strides.
Sparse destinations retain a sparse source's pattern and stored zeros. Other sources store nonzero entries and negative zeros. Structural changes replace sparse buffers; equal patterns reuse them.
forEachColumns
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.
forEachStored
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.
Visit each stored entry as (index, value), in ascending index order for any storage. A SparseVector may present numerical zeros as stored, and any other Vector has every index visited.
norm
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.
Uses the default koblas engine for dense and packed sparse reductions and portable readers for custom matrices. Views exclude padding and sparse operands are never densified. Rounding and non-finite behavior follow the selected implementation.
Throws
Vector norm of type: Norm.One sums absolute values, Norm.Two is the Euclidean norm, and Norm.Infinity and Norm.MaxAbs select the maximum absolute value. An empty vector has norm zero.
Uses the default koblas engine for dense and packed sparse storage, preserving dense offsets and strides. Sparse vectors visit only stored values; custom vectors use portable fallbacks. Norm.Two rescales to avoid unnecessary overflow and underflow. Rounding and non-finite behavior follow the selected implementation, including KoblasEngine.iamax for the infinity norm over built-in storage.
Throws
if type is Norm.Frobenius, which is a matrix norm.
sum
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.
Dense views address only their logical entries. Sparse matrices visit only stored entries without densifying; custom matrices are read through Matrix.get. Summation order and rounding depend on the storage and default koblas engine.
Throws
if axis is neither zero nor one.
Plain sum of the entries. Distinct from asum, which sums their absolute values.
Dense and sparse storage reach KoblasEngine.sum, with sparse vectors summing only their packed stored entries. Other implementations are read through Vector.get.
transpose
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.