StaticidentityCalls 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.Optionaloptions: { csr?: boolean; sort?: boolean } = {}Options for output format and sorting.
Optionalcsr?: booleanIf true, returns the result in CSR format. Otherwise, returns COO format.
Optionalsort?: 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.
Optionalsort: boolean = falseStaticabsStaticacosStaticacoshStaticaddStaticandStaticasinStaticasinhStaticatanStaticatanhStaticcbrtStaticceilStaticclz32StaticcosStaticcoshStaticdivStaticdivideStaticexpStaticexpm1StaticeyeStaticfloorStaticfroundStaticleftStaticlogStaticlog10Staticlog1pStaticlog2StaticmodStaticmodulusStaticmulStaticmultiplyStaticnotStaticorStaticrightStaticroundStaticsignStaticsignStaticsinStaticsinhStaticsqrtStaticsubStaticsubtractStatictanStatictanhStatictruncStaticxorStaticzero
Search for the wither band in the main diagonals