IVSparse  v1.0
A sparse matrix compression library.
VCSC_Iterator.hpp
Go to the documentation of this file.
1 
9 #pragma once
10 
11 namespace IVSparse {
12 
21 template <typename T, typename indexT, bool columnMajor>
22 class SparseMatrix<T, indexT, 2, columnMajor>::InnerIterator {
23  private:
24  //* Private Class Variables *//
25 
26  indexT outer = 0; // Outer dimension
27  indexT index = 0; // Current index
28  indexT newIndex = 0; // Next index
29  T *val = nullptr; // Current value
30 
31  T *vals = nullptr; // Pointer to values
32  indexT *counts = nullptr; // Pointer to counts
33  indexT *indices = nullptr; // Pointer to indices
34 
35  indexT valsSize = 0; // Number of unique values
36  indexT indexSize = 0; // Number of indices
37 
38  indexT count = 0; // Current count
39  indexT countIndex = 0; // Current count of indices
40 
41  //* Private Class Methods *//
42 
43  public:
44  //* Constructors & Destructor *//
47 
53  InnerIterator(){};
54 
61  InnerIterator(SparseMatrix<T, indexT, 2, columnMajor> &mat, uint32_t col);
62 
68  InnerIterator(SparseMatrix<T, indexT, 2, columnMajor>::Vector &vec);
69 
71 
72  //* Getters *//
75 
80  indexT getIndex();
81 
85  indexT outerDim();
86 
90  indexT row();
91 
95  indexT col();
96 
100  T value();
101 
107  void coeff(T newValue);
108 
114 
115  //* Operator Overloads *//
116 
117  // Prefix increment operator
118  void __attribute__((hot)) operator++();
119 
120  // Equality operator
121  bool operator==(const InnerIterator &other);
122 
123  // Inequality operator
124  bool operator!=(const InnerIterator &other);
125 
126  // Less than operator
127  bool operator<(const InnerIterator &other);
128 
129  // Greater than operator
130  bool operator>(const InnerIterator &other);
131 
132  // Boolean operator
133  inline __attribute__((hot)) operator bool() { return countIndex < indexSize; }
134 
135  // Dereference operator
136  T &operator*();
137 
138 }; // End of VCSC Inner Iterator Class
139 
140 } // namespace IVSparse
T coeff(uint32_t row, uint32_t col)
Definition: IVCSC_Methods.hpp:17