Tpetra::CrsGraph::getLocalDiagOffsets: Use LocalOrdinal instead of size_t for offsets
Created by: mhoemmen
@trilinos/tpetra
This doesn't block #212 (closed), but is related. In particular, #205 (closed) makes it easier to use whatever offset type we want in Tpetra, since the proposed search code is agnostic of the offset type.
Tpetra::CrsGraph::getLocalDiagOffsets
computes the offset of each row's diagonal entry. Tpetra uses this to speed up extracting the diagonal entries of a CrsMatrix, and the block diagonal entries of a BlockCrsMatrix.
getLocalDiagOffsets
computes offsets relative to each row. Thus, the type used to store offsets need only be able to represent the number of entries in a single row. If there are no duplicates in the row, LocalOrdinal
thus suffices. If LocalOrdinal
is 32 bits, this saves space and speeds up the computation.
There are no duplicates if the graph or matrix is fillComplete. Epetra never has duplicates in the graph, because insertion always merges; it never stores duplicates. #119 means that in Tpetra, it is technically possible to insert more duplicate entries in a row than the number of columns in the matrix. However, that is a weird edge case. Furthermore, there is no advantage to having a single type (currently size_t
) for offsets, independent of other template parameters, because the main customer (Ifpack2) of getLocalDiagOffsets
takes the same template parameters as Tpetra classes anyway.