diff options
Diffstat (limited to 'include/gudhi_laplacian')
-rw-r--r-- | include/gudhi_laplacian/simplex_tree.hpp | 22 | ||||
-rw-r--r-- | include/gudhi_laplacian/sparse_vector.hpp (renamed from include/gudhi_laplacian/sparse_row.hpp) | 6 |
2 files changed, 14 insertions, 14 deletions
diff --git a/include/gudhi_laplacian/simplex_tree.hpp b/include/gudhi_laplacian/simplex_tree.hpp index 72cae62..dafcd06 100644 --- a/include/gudhi_laplacian/simplex_tree.hpp +++ b/include/gudhi_laplacian/simplex_tree.hpp @@ -8,7 +8,7 @@ #include <gudhi/Simplex_tree.h> -#include "sparse_row.hpp" +#include "sparse_vector.hpp" #include "misc.hpp" namespace Gudhi_laplacian @@ -62,10 +62,10 @@ namespace Gudhi_laplacian return stratification; } - Sparse_row<int> assemble_cbd_row(ST & st, ST::Simplex_handle s) + Sparse_vector<int> assemble_cbd_row(ST & st, ST::Simplex_handle s) { std::cerr << "WARNING: This function has not been tested much." << std::endl; - Sparse_row<int> ret; + Sparse_vector<int> ret; // This is a specialization of face_sign. int sign = (st.dimension(s) % 2 == 0) ? 1 : -1; @@ -79,9 +79,9 @@ namespace Gudhi_laplacian return ret; } - Sparse_row<double> assemble_laplacian_row(ST & st, const std::vector<std::vector<double> > & weights, ST::Simplex_handle s) + Sparse_vector<double> assemble_laplacian_row(ST & st, const std::vector<std::vector<double> > & weights, ST::Simplex_handle s) { - Sparse_row<double> row; + Sparse_vector<double> row; int dim = st.dimension(s); ST::Simplex_key s_key = ST::key(s); @@ -121,7 +121,7 @@ namespace Gudhi_laplacian bd_s_sign *= -1; } - compress_sparse_row(row); + compress_sparse_vector(row); return row; } @@ -156,7 +156,7 @@ namespace Gudhi_laplacian // For indices. for (auto it = stratification[d+1].cbegin(); it != stratification[d+1].cend(); ++it) { - Sparse_row<int> row = assemble_cbd_row(st, *it); + Sparse_vector<int> row = assemble_cbd_row(st, *it); assert(row.size() == d+2); for (auto jt = row.cbegin(); jt != row.cend(); ++jt) { @@ -167,7 +167,7 @@ namespace Gudhi_laplacian // For values. for (auto it = stratification[d+1].cbegin(); it != stratification[d+1].cend(); ++it) { - Sparse_row<int> row = assemble_cbd_row(st, *it); + Sparse_vector<int> row = assemble_cbd_row(st, *it); assert(row.size() == d+2); for (auto jt = row.cbegin(); jt != row.cend(); ++jt) { @@ -211,7 +211,7 @@ namespace Gudhi_laplacian // First traversal (counting). for (auto it = stratification[d].cbegin(); it != stratification[d].cend(); ++it) { - Sparse_row<double> row = assemble_laplacian_row(st, weights, *it); + Sparse_vector<double> row = assemble_laplacian_row(st, weights, *it); num_nonzero += row.size(); num_nonzero_row.push_back(row.size()); } @@ -223,7 +223,7 @@ namespace Gudhi_laplacian // Second traversal (indices). for (auto it = stratification[d].cbegin(); it != stratification[d].cend(); ++it) { - Sparse_row<double> row = assemble_laplacian_row(st, weights, *it); + Sparse_vector<double> row = assemble_laplacian_row(st, weights, *it); for (auto jt = row.cbegin(); jt != row.cend(); ++jt) { write_be<int32_t>(file, jt->first); @@ -233,7 +233,7 @@ namespace Gudhi_laplacian // Third traversal (values). for (auto it = stratification[d].cbegin(); it != stratification[d].cend(); ++it) { - Sparse_row<double> row = assemble_laplacian_row(st, weights, *it); + Sparse_vector<double> row = assemble_laplacian_row(st, weights, *it); for (auto jt = row.cbegin(); jt != row.cend(); ++jt) { write_be<double>(file, jt->second); diff --git a/include/gudhi_laplacian/sparse_row.hpp b/include/gudhi_laplacian/sparse_vector.hpp index 9896625..58dd40c 100644 --- a/include/gudhi_laplacian/sparse_row.hpp +++ b/include/gudhi_laplacian/sparse_vector.hpp @@ -8,14 +8,14 @@ namespace Gudhi_laplacian { template <typename T> - using Sparse_row = std::vector<std::pair<unsigned int, T> >; + using Sparse_vector = std::vector<std::pair<unsigned int, T> >; template <typename T> - void compress_sparse_row(Sparse_row<T> & row) + void compress_sparse_vector(Sparse_vector<T> & row) { static_assert(std::is_arithmetic<T>::value, "Only arithmetic types are supported."); - Sparse_row<T> tmp(row); + Sparse_vector<T> tmp(row); row.clear(); std::sort(tmp.begin(), tmp.end()); for (auto it = tmp.cbegin(); it != tmp.cend(); ++it) |