16 template <
typename T,
typename indexT, u
int8_t compressionLevel,
bool columnMajor>
22 assert((vec < matrix.outerDim && vec >= 0) &&
"Vector index out of bounds");
28 data = (
void *)0xFFFFFFFFFFFFFFFF;
29 endPtr = (
void *)0xFFFFFFFFFFFFFFFF;
43 data = (uint8_t *)data +
sizeof(T);
46 indexWidth = *(uint8_t *)data;
47 data = (uint8_t *)data +
sizeof(uint8_t);
54 template <
typename T,
typename indexT, u
int8_t compressionLevel,
bool columnMajor>
62 data = vector.
begin();
65 if (data ==
nullptr) {
72 data = (uint8_t *)data +
sizeof(T);
75 endPtr = vector.
end();
78 indexWidth = *(uint8_t *)data;
79 data = (uint8_t *)data +
sizeof(uint8_t);
88 template <
typename T,
typename indexT, u
int8_t compressionLevel,
bool columnMajor>
94 template <
typename T,
typename indexT, u
int8_t compressionLevel,
bool columnMajor>
100 template <
typename T,
typename indexT, u
int8_t compressionLevel,
bool columnMajor>
106 template <
typename T,
typename indexT, u
int8_t compressionLevel,
bool columnMajor>
112 template <
typename T,
typename indexT, u
int8_t compressionLevel,
bool columnMajor>
118 template <
typename T,
typename indexT, u
int8_t compressionLevel,
bool columnMajor>
120 if constexpr (!columnMajor) {
128 template <
typename T,
typename indexT, u
int8_t compressionLevel,
bool columnMajor>
130 if constexpr (!columnMajor) {
140 template <
typename T,
typename indexT, u
int8_t compressionLevel,
bool columnMajor>
142 switch (indexWidth) {
144 newIndex =
static_cast<indexT
>(*
static_cast<uint8_t *
>(data));
147 newIndex =
static_cast<indexT
>(*
static_cast<uint16_t *
>(data));
150 newIndex =
static_cast<indexT
>(*
static_cast<uint32_t *
>(data));
153 newIndex =
static_cast<indexT
>(*
static_cast<uint64_t *
>(data));
161 template <
typename T,
typename indexT, u
int8_t compressionLevel,
bool columnMajor>
162 T &SparseMatrix<T, indexT, compressionLevel, columnMajor>::InnerIterator::operator*() {
167 template <
typename T,
typename indexT, u
int8_t compressionLevel,
bool columnMajor>
168 bool SparseMatrix<T, indexT, compressionLevel, columnMajor>::InnerIterator::operator==(
const InnerIterator &other) {
169 return data == other.getIndex();
173 template <
typename T,
typename indexT, u
int8_t compressionLevel,
bool columnMajor>
174 bool SparseMatrix<T, indexT, compressionLevel, columnMajor>::InnerIterator::operator!=(
const InnerIterator &other) {
175 return data != other.getIndex();
179 template <
typename T,
typename indexT, u
int8_t compressionLevel,
bool columnMajor>
180 bool SparseMatrix<T, indexT, compressionLevel, columnMajor>::InnerIterator::operator<(
const InnerIterator &other) {
181 return data < other.getIndex();
185 template <
typename T,
typename indexT, u
int8_t compressionLevel,
bool columnMajor>
186 bool SparseMatrix<T, indexT, compressionLevel, columnMajor>::InnerIterator::operator>(
const InnerIterator &other) {
187 return data > other.getIndex();
191 template <
typename T,
typename indexT, u
int8_t compressionLevel,
bool columnMajor>
192 void SparseMatrix<T, indexT, compressionLevel, columnMajor>::InnerIterator::operator++() {
193 data = (uint8_t *)data + indexWidth;
199 if (data >= (uint8_t *)endPtr - indexWidth) [[unlikely]] {
203 data = (uint8_t *)data + indexWidth;
207 data = (uint8_t *)data +
sizeof(T);
210 indexWidth = *(uint8_t *)data;
211 data = (uint8_t *)data +
sizeof(uint8_t);
void coeff(T newValue)
Definition: IVCSC_Iterator_Methods.hpp:113
T value()
Definition: IVCSC_Iterator_Methods.hpp:101
indexT row()
Definition: IVCSC_Iterator_Methods.hpp:119
indexT col()
Definition: IVCSC_Iterator_Methods.hpp:129
indexT outerDim()
Definition: IVCSC_Iterator_Methods.hpp:95
indexT getIndex()
Definition: IVCSC_Iterator_Methods.hpp:107
InnerIterator()
Definition: IVCSC_Iterator.hpp:57
bool isNewRun()
Definition: IVCSC_Iterator_Methods.hpp:89
Definition: IVCSC_Vector.hpp:25
void * end()
Definition: IVCSC_Vector_Methods.hpp:177
void * begin()
Definition: IVCSC_Vector_Methods.hpp:171
Definition: IVCSC_SparseMatrix.hpp:29
void * vectorPointer(uint32_t vec)
Definition: IVCSC_Methods.hpp:36
size_t getVectorSize(uint32_t vec) const
Definition: IVCSC_Methods.hpp:57