| 82 | |
| 83 | |
| 84 | bool SparseMatrix::add(uint8_t x, uint8_t y, float value) |
| 85 | { |
| 86 | int32_t pos = findPos(x, y); |
| 87 | // existing element |
| 88 | if (pos > -1) |
| 89 | { |
| 90 | _value[pos] += value; |
| 91 | if (_value[pos] == 0.0) removeElement(pos); |
| 92 | return true; |
| 93 | } |
| 94 | |
| 95 | // does not exist => new element ? |
| 96 | return newElement(x, y, value); |
| 97 | } |
| 98 | |
| 99 | |
| 100 | float SparseMatrix::get(uint8_t x, uint8_t y) |