diff options
Diffstat (limited to 'include/gudhi_laplacian/sparse_row.hpp')
-rw-r--r-- | include/gudhi_laplacian/sparse_row.hpp | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/include/gudhi_laplacian/sparse_row.hpp b/include/gudhi_laplacian/sparse_row.hpp deleted file mode 100644 index 9896625..0000000 --- a/include/gudhi_laplacian/sparse_row.hpp +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once - -#include <vector> -#include <algorithm> -#include <utility> -#include <type_traits> - -namespace Gudhi_laplacian -{ - template <typename T> - using Sparse_row = std::vector<std::pair<unsigned int, T> >; - - template <typename T> - void compress_sparse_row(Sparse_row<T> & row) - { - static_assert(std::is_arithmetic<T>::value, "Only arithmetic types are supported."); - - Sparse_row<T> tmp(row); - row.clear(); - std::sort(tmp.begin(), tmp.end()); - for (auto it = tmp.cbegin(); it != tmp.cend(); ++it) - { - if (row.empty()) - { - if (it->second != T()) - { - row.push_back(*it); - } - } - else if (it->first == row.back().first) - { - T x = row.back().second + it->second; - if (x == T()) - { - row.pop_back(); - } - else - { - row.back().second = x; - } - } - else if (it->second != T()) - { - row.push_back(*it); - } - } - } -} |