MCPcopy Create free account
hub / github.com/ComputationalRobotics/XM-code / COOsort

Function COOsort

XM/include/Sparse/sparseformat.h:17–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15// COOsort
16template <typename T>
17inline void COOsort(
18 int* row_ids, int* col_ids, T* vals, const size_l nnz
19) {
20 // Use zip_iterator to create tuples (row, col, val) for sorting
21 auto begin = thrust::make_zip_iterator(thrust::make_tuple(thrust::device_pointer_cast(row_ids), thrust::device_pointer_cast(col_ids), thrust::device_pointer_cast(vals)));
22 auto end = thrust::make_zip_iterator(thrust::make_tuple(thrust::device_pointer_cast(row_ids + nnz), thrust::device_pointer_cast(col_ids + nnz), thrust::device_pointer_cast(vals + nnz)));
23
24 // Sort by row first, then by column for identical rows
25 thrust::sort(begin, end, thrust::less<thrust::tuple<int, int, T>>());
26 return;
27}
28
29// convert CSC format in cusparse to CSR format in cusparse
30// this routine needs additional memories on device

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected