@@ -58,21 +58,13 @@ struct ElementLT final {
5858 const uint64_t rank;
5959};
6060
61- // / The type of callback functions which receive an element.
62- template <typename V>
63- using ElementConsumer =
64- const std::function<void (const std::vector<uint64_t > &, V)> &;
65-
6661// / A memory-resident sparse tensor in coordinate-scheme representation
67- // / (a collection of `Element`s). This data structure is used as
68- // / an intermediate representation; e.g., for reading sparse tensors
69- // / from external formats into memory, or for certain conversions between
70- // / different `SparseTensorStorage` formats.
62+ // / (a collection of `Element`s). This data structure is used as an
63+ // / intermediate representation, e.g., for reading sparse tensors from
64+ // / external formats into memory.
7165template <typename V>
7266class SparseTensorCOO final {
7367public:
74- using const_iterator = typename std::vector<Element<V>>::const_iterator;
75-
7668 // / Constructs a new coordinate-scheme sparse tensor with the given
7769 // / sizes and an optional initial storage capacity.
7870 explicit SparseTensorCOO (const std::vector<uint64_t > &dimSizes,
@@ -106,7 +98,7 @@ class SparseTensorCOO final {
10698 // / Returns the `operator<` closure object for the COO's element type.
10799 ElementLT<V> getElementLT () const { return ElementLT<V>(getRank ()); }
108100
109- // / Adds an element to the tensor. This method invalidates all iterators.
101+ // / Adds an element to the tensor.
110102 void add (const std::vector<uint64_t > &dimCoords, V val) {
111103 const uint64_t *base = coordinates.data ();
112104 const uint64_t size = coordinates.size ();
@@ -135,12 +127,9 @@ class SparseTensorCOO final {
135127 elements.push_back (addedElem);
136128 }
137129
138- const_iterator begin () const { return elements.cbegin (); }
139- const_iterator end () const { return elements.cend (); }
140-
141130 // / Sorts elements lexicographically by coordinates. If a coordinate
142131 // / is mapped to multiple values, then the relative order of those
143- // / values is unspecified. This method invalidates all iterators.
132+ // / values is unspecified.
144133 void sort () {
145134 if (isSorted)
146135 return ;
0 commit comments