IVSparse  v1.0
A sparse matrix compression library.
CSC_Vector.hpp
Go to the documentation of this file.
1 
9 #pragma once
10 
11 namespace IVSparse {
12 
19 template <typename T, typename indexT, bool columnMajor>
20 class SparseMatrix<T, indexT, 1, columnMajor>::Vector {
21  private:
22  //* Private Class Variables *//
23 
24  size_t size = 0; // size of the vector in bytes
25 
26  T *vals = nullptr; // values of the vector
27  indexT *innerIdx = nullptr; // inner indices of the vector
28 
29  uint32_t length = 0; // length of the vector
30  uint32_t nnz = 0; // number of non-zero elements in the vector
31 
32  //* Private Class Methods *//
33 
34  // User checks to confirm a valid vector
35  void userChecks();
36 
37  // Calculates the size of the vector in bytes
38  void calculateCompSize();
39 
40  public:
41  //* Constructors & Destructor *//
44 
50  Vector(){};
51 
59  Vector(IVSparse::SparseMatrix<T, indexT, 1, columnMajor> &mat, uint32_t vec);
60 
66 
70  ~Vector();
71 
73 
74  //* Getters *//
77 
82  T coeff(uint32_t index);
83 
87  size_t byteSize();
88 
92  uint32_t innerSize();
93 
97  uint32_t outerSize();
98 
102  uint32_t nonZeros();
103 
107  uint32_t getLength();
108 
112  T *getValues() const;
113 
117  indexT *getInnerIndices() const;
118 
120 
121  //* Utility Methods *//
124 
129  void print();
130 
132 
133  //* Operator Overloads *//
134 
135  // Coefficient Access Operator
136  T operator[](uint32_t index);
137 
138  // Assignment Operator
141 
142  // Equality Operator
143  bool operator==(
145 
146  // Inequality Operator
147  bool operator!=(
149 
150 }; // class Vector
151 
152 } // namespace IVSparse
Definition: IVCSC_Vector.hpp:25
Definition: CSC_SparseMatrix.hpp:24
uint32_t innerSize() const
Definition: IVSparse_Base_Methods.hpp:33
uint32_t nonZeros() const
Definition: IVSparse_Base_Methods.hpp:39
size_t byteSize() const
Definition: IVSparse_Base_Methods.hpp:42
uint32_t outerSize() const
Definition: IVSparse_Base_Methods.hpp:36
Definition: IVCSC_SparseMatrix.hpp:29
T coeff(uint32_t row, uint32_t col)
Definition: IVCSC_Methods.hpp:17
void print()
Definition: IVCSC_Methods.hpp:97