diff --git a/core/matrix/csr_lookup.hpp b/core/matrix/csr_lookup.hpp index 52045bc113b..6de3265ff21 100644 --- a/core/matrix/csr_lookup.hpp +++ b/core/matrix/csr_lookup.hpp @@ -316,17 +316,7 @@ struct device_sparsity_lookup { GKO_ATTRIBUTES GKO_INLINE IndexType lookup_search(IndexType col) const { - // binary search through the column indices - auto length = row_nnz; - IndexType offset{}; - while (length > 0) { - auto half_length = length / 2; - auto mid = offset + half_length; - // this finds the first index with column index >= col - auto pred = local_cols[mid] >= col; - length = pred ? half_length : length - (half_length + 1); - offset = pred ? offset : mid + 1; - } + const auto offset = lookup_search_unsafe(col); return offset < row_nnz && local_cols[offset] == col ? offset : invalid_index();