Static
identityCalls callback
for each value in the matrix that is not zero.
The callback can return:
false
to stop the iteration immediatelyReturns the non-zero elements of the matrix in coordinates (COO) or CSR format.
COO (Coordinate) format:
Stores the non-zero elements as three arrays: rows
, columns
, and values
, where each index corresponds to a non-zero entry at (row, column) with the given value.
CSR (Compressed Sparse Row) format: Stores the matrix using three arrays:
rows
: Row pointer array of length numRows + 1
, where each entry indicates the start of a row in the columns
and values
arrays.columns
: Column indices of non-zero elements.values
: Non-zero values.
This format is efficient for row slicing and matrix-vector multiplication.Optional
options: { csr?: boolean; sort?: boolean } = {}Options for output format and sorting.
Optional
csr?: booleanIf true, returns the result in CSR format. Otherwise, returns COO format.
Optional
sort?: booleanIf true, sorts the non-zero elements by their indices.
If csr
is not specified, returns an object with Float64Array rows
, columns
, and values
(COO format).
If csr
is true, returns { rows, columns, values }
in CSR format.
Test if a matrix is consider banded using a threshold
Matrix multiplication, does not modify the current instance.
returns a new matrix instance.
Calls callback
for each value in the matrix that is not zero.
Unlike forEachNonZero
, the callback's return value has no effect.
Optional
sort: boolean = falseStatic
absStatic
acosStatic
acoshStatic
addStatic
andStatic
asinStatic
asinhStatic
atanStatic
atanhStatic
cbrtStatic
ceilStatic
clz32Static
cosStatic
coshStatic
divStatic
divideStatic
expStatic
expm1Static
eyeStatic
floorStatic
froundStatic
leftStatic
logStatic
log10Static
log1pStatic
log2Static
modStatic
modulusStatic
mulStatic
multiplyStatic
notStatic
orStatic
rightStatic
roundStatic
signStatic
signStatic
sinStatic
sinhStatic
sqrtStatic
subStatic
subtractStatic
tanStatic
tanhStatic
truncStatic
xorStatic
zero
Search for the wither band in the main diagonals