Skip to content
This repository has been archived by the owner on Nov 17, 2021. It is now read-only.

Commit

Permalink
comply with Firmware style requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilritz authored and jkflying committed Aug 10, 2020
1 parent f981cea commit 25c0455
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions matrix/SparseVector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ class SparseVector {
static constexpr size_t _indices[N] {Idxs...};

static constexpr bool duplicateIndices() {
for (size_t i = 0; i < N; i++)
for (size_t j = 0; j < i; j++)
if (_indices[i] == _indices[j])
for (size_t i = 0; i < N; i++) {
for (size_t j = 0; j < i; j++) {
if (_indices[i] == _indices[j]) {
return true;
}
}
}
return false;
}
static constexpr size_t findMaxIndex() {
Expand All @@ -42,7 +45,7 @@ class SparseVector {
return maxIndex;
}

static_assert(duplicateIndices() == false, "Duplicate indices");
static_assert(!duplicateIndices(), "Duplicate indices");
static_assert(N < M, "More entries than elements, use a dense vector");
static_assert(N > 0, "A sparse vector needs at least one element");
static_assert(findMaxIndex() < M, "Largest entry doesn't fit in sparse vector");
Expand Down

0 comments on commit 25c0455

Please sign in to comment.