10 #define DEVICE __device__ 18 template<typename Index>
22 template<
typename Index>
24 if (rowPtr_.size() == 0) {
27 return rowPtr_.size() - 1;
31 template<
typename Index>
33 std::set<Index> nodes;
35 for (Index ci = 0; ci < colInd_.size(); ++ci) {
36 nodes.insert(colInd_[ci]);
39 for (Index i = 0; i < rowPtr_.size() - 1; ++i) {
40 Index row_start = rowPtr_[i];
41 Index row_end = rowPtr_[i+1];
42 if (row_start != row_end) {
49 template<
typename Index>
55 LOG(warn,
"constructing from empty edge list");
60 for (
const auto &edge : es) {
62 const Index src =
static_cast<Index
>(edge.first);
63 const Index dst =
static_cast<Index
>(edge.second);
67 while (csr.
rowPtr_.size() != size_t(src + 1))
71 assert(src >= csr.
rowPtr_.size());
77 if (
nullptr != edgeFilter && edgeFilter(edge)) {
92 template<
typename Index>
uint64_t num_nodes() const
number of unique row/col indices
Definition: coo-impl.hpp:32
HOST DEVICE uint64_t num_rows() const
number of matrix rows
Definition: coo-impl.hpp:23
a read-only view of a COO suitable for passing to a GPU kernel by value.
Definition: coo.hpp:25
#define DEVICE
Definition: coo-impl.hpp:13
COOView< Index > view() const
create a COOView for this COO
Definition: coo-impl.hpp:93
Vector< Index > rowInd_
non-zero row indices
Definition: coo.hpp:58
PANGOLIN_BEGIN_NAMESPACE()
std::vector< Edge > EdgeList
Definition: edge_list.hpp:9
const Index * colInd_
non-zero column indices
Definition: coo.hpp:34
#define LOG(level,...)
Definition: logger.hpp:25
A COO matrix backed by CUDA Unified Memory, with a CSR rowPtr.
Definition: coo.hpp:18
Vector< Index > rowPtr_
offset in col_ that each row starts at
Definition: coo.hpp:56
Vector< Index > colInd_
non-zero column indices
Definition: coo.hpp:57
uint64_t nnz_
number of non-zeros
Definition: coo.hpp:28
const Index * rowInd_
non-zero row indices
Definition: coo.hpp:33
static COO< Index > from_edgelist(const EdgeList &es, bool(*edgeFilter)(const Edge &)=nullptr)
Definition: coo-impl.hpp:50
uint64_t num_rows_
length of rowOffset - 1
Definition: coo.hpp:29
const Index * rowPtr_
offset in col_ that each row starts at
Definition: coo.hpp:32
#define PANGOLIN_END_NAMESPACE()
#define HOST
Definition: coo-impl.hpp:12
std::pair< Uint, Uint > Edge
Definition: edge.hpp:14