-
Notifications
You must be signed in to change notification settings - Fork 578
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tpetra: Add findRelOffset to fix #205
Tpetra::Details::findRelOffset is a new function (free function, not method) that finds the relative offset of an index in a row of a sparse graph or matrix, given an array of column indices in that row. The array may be either a rank-1 Kokkos::View or a raw 1-D array. The function lives in tpetra/core/src/Tpetra_Util.hpp. This fixes #205. I mean for the new function to replace or implement Tpetra::CrsGraph::find{Local,Global}Index. The function optimizes for the case where the input array to search is sorted, by using binary search in that case. This should make its performance comparable to that of Tpetra::CrsGraph::findLocalIndex or Epetra_CrsGraph::FindMyIndexLoc. I also added a test for this function. The test builds and passes. Note that it carefully exercises both the sorted and unsorted cases. Next step, not yet implemented is to optimize for the case of short rows, by using linear search in that case. This should actually improve on both Epetra and Tpetra, and possibly address #118.
- Loading branch information
Mark Hoemmen
committed
Mar 17, 2016
1 parent
53a1e00
commit ec4a3fa
Showing
3 changed files
with
424 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.