diff options
author | Gard Spreemann <gspreemann@gmail.com> | 2018-11-06 09:54:13 +0100 |
---|---|---|
committer | Gard Spreemann <gspreemann@gmail.com> | 2018-11-06 09:54:13 +0100 |
commit | de85c55789660b213112770ec73bcf03d23ffaa4 (patch) | |
tree | 6bbf039881962e0a31f53ae5a07d662f83749061 /include/gudhi_laplacian/sparse_row.hpp | |
parent | 639ade38182887fbf77319d4b97eca4a310db55f (diff) |
Renaming.
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); - } - } - } -} |