mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-17 05:00:35 +08:00
add possibility to iterate over SparseVector data at runtime (#143)
This commit is contained in:
+11
-1
@@ -60,7 +60,7 @@ private:
|
||||
}
|
||||
|
||||
public:
|
||||
static constexpr size_t non_zeros() {
|
||||
constexpr size_t non_zeros() const {
|
||||
return N;
|
||||
}
|
||||
|
||||
@@ -94,6 +94,16 @@ public:
|
||||
return _data[compressed_index];
|
||||
}
|
||||
|
||||
inline Type atCompressedIndex(size_t i) const {
|
||||
assert(i < N);
|
||||
return _data[i];
|
||||
}
|
||||
|
||||
inline Type& atCompressedIndex(size_t i) {
|
||||
assert(i < N);
|
||||
return _data[i];
|
||||
}
|
||||
|
||||
void setZero() {
|
||||
for (size_t i = 0; i < N; i++) {
|
||||
_data[i] = Type(0);
|
||||
|
||||
Reference in New Issue
Block a user