Class ComplexSparseElementSearch
java.lang.Object
org.flag4j.operations.sparse.coo.complex.ComplexSparseElementSearch
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
matrixBinarySearch
(CooCMatrix src, int rowKey, int colKey) Preforms a binary search along the row and column indices of the non-zero values of a sparse matrix for the location of an entry with the specified target indices.static int[]
matrixFindRowStartEnd
(CooCMatrix src, int rowKey) Finds the indices of the first and last non-zero element in the specified row of a sparse matrix.
-
Constructor Details
-
ComplexSparseElementSearch
private ComplexSparseElementSearch()
-
-
Method Details
-
matrixBinarySearch
Preforms a binary search along the row and column indices of the non-zero values of a sparse matrix for the location of an entry with the specified target indices.- Parameters:
src
- Source matrix to search within.rowKey
- Target row index.colKey
- Target col index.- Returns:
- The location of the non-zero element (within the non-zero values array of
src
) with the specified row and column indices. If this value does not exist, then(-(insertion point) - 1)
will be returned. The insertion point is defined as the point at which the value, with the row and column key, would be inserted into the array: the index of the first element greater than the key, orsrc.entries.length
if all elements in the array are less than the specified key. Note that this guarantees that the return value will be >= 0 if and only if the key is found.
-
matrixFindRowStartEnd
Finds the indices of the first and last non-zero element in the specified row of a sparse matrix. If there is no non-zero element in the sparse matrix at the specified row, negative values will be returned.- Parameters:
src
- The source sparse matrix to search within.rowKey
- Index of the row to search for within the row indices of thesrc
matrix.- Returns:
- If it exists, the first and last index of the non-zero element in the sparse matrix which has the specified
rowKey
as its row index.
-