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 {
13 
20  template <typename T, typename indexT, bool columnMajor>
21  class SparseMatrix<T, indexT, 1, columnMajor>::Vector
22  {
23 
24  private:
25  //* Private Class Variables *//
26 
27  size_t size = 0; // size of the vector in bytes
28 
29  T *vals = nullptr; // values of the vector
30  indexT *innerIdx = nullptr; // inner indices of the vector
31 
32  uint32_t length = 0; // length of the vector
33  uint32_t nnz = 0; // number of non-zero elements in the vector
34 
35  //* Private Class Methods *//
36 
37  // User checks to confirm a valid vector
38  void userChecks();
39 
40  // Calculates the size of the vector in bytes
41  void calculateCompSize();
42 
43  public:
44  //* Constructors & Destructor *//
47 
53  Vector(){};
54 
61  Vector(IVSparse::SparseMatrix<T, indexT, 1, columnMajor> &mat, uint32_t vec);
62 
68 
72  ~Vector();
73 
75 
76  //* Getters *//
79 
84  T coeff(uint32_t index);
85 
89  size_t byteSize();
90 
94  uint32_t innerSize();
95 
99  uint32_t outerSize();
100 
104  uint32_t nonZeros();
105 
109  uint32_t getLength();
110 
114  T *getValues() const;
115 
119  indexT *getInnerIndices() const;
120 
122 
123  //* Utility Methods *//
126 
131  void print();
132 
134 
135  //* Operator Overloads *//
136 
137  // Coefficient Access Operator
138  T operator[](uint32_t index);
139 
140  // Assignment Operator
142 
143  // Equality Operator
144  bool operator==(typename SparseMatrix<T, indexT, 1, columnMajor>::Vector &vec);
145 
146  // Inequality Operator
147  bool operator!=(typename SparseMatrix<T, indexT, 1, columnMajor>::Vector &vec);
148 
149  }; // class Vector
150 
151 } // namespace IVSparse
Definition: IVCSC_Vector.hpp:27
Definition: CSC_SparseMatrix.hpp:24
uint32_t innerSize() const
Definition: IVSparse_Base_Methods.hpp:28
uint32_t nonZeros() const
Definition: IVSparse_Base_Methods.hpp:34
size_t byteSize() const
Definition: IVSparse_Base_Methods.hpp:37
uint32_t outerSize() const
Definition: IVSparse_Base_Methods.hpp:31
Definition: IVCSC_SparseMatrix.hpp:27
T coeff(uint32_t row, uint32_t col)
Definition: IVCSC_Methods.hpp:17
void print()
Definition: IVCSC_Methods.hpp:64