From 3145aa8c43e298bd0b735a5ac155027ccb4deca5 Mon Sep 17 00:00:00 2001 From: Ulrich Bauer Date: Wed, 21 Jun 2017 21:16:56 +0200 Subject: fixed output of coefficients for representative cocycles --- ripser.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ripser.cpp b/ripser.cpp index 228198e..4a87927 100644 --- a/ripser.cpp +++ b/ripser.cpp @@ -90,6 +90,10 @@ bool is_prime(const coefficient_t n) { return true; } +coefficient_t normalize(const coefficient_t n, const coefficient_t modulus) { + return n > modulus/2 ? n - modulus : n; +} + std::vector multiplicative_inverse_vector(const coefficient_t m) { std::vector inverse(m); inverse[1] = 1; @@ -638,8 +642,9 @@ void compute_pairs(std::vector& columns_to_reduce, hash_map& columns_to_reduce, hash_map Date: Wed, 21 Jun 2017 21:28:42 +0200 Subject: post merge fix: added back vertices_of_simplex --- ripser.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ripser.cpp b/ripser.cpp index eb7281c..cd8f83b 100644 --- a/ripser.cpp +++ b/ripser.cpp @@ -424,6 +424,13 @@ public: } return out; } + + std::vector vertices_of_simplex(const index_t simplex_index, const index_t dim) { + std::vector vertices(dim + 1); + get_simplex_vertices(simplex_index, dim, n, + vertices.begin()); + return vertices; + } value_t compute_diameter(const index_t index, index_t dim) const { value_t diam = -std::numeric_limits::infinity(); @@ -643,7 +650,7 @@ public: auto cocycle = reduction_column; diameter_entry_t e; while (get_index(e = get_pivot(cocycle, modulus)) != -1) { - std::cout << vertices_of_simplex(get_index(pivot), dim, n, binomial_coeff) << ":" << normalize(get_coefficient(e), modulus); + std::cout << vertices_of_simplex(get_index(pivot), dim) << ":" << normalize(get_coefficient(e), modulus); cocycle.pop(); if (get_index(pivot = get_pivot(cocycle, modulus)) != -1) std::cout << ", "; } @@ -664,7 +671,7 @@ public: auto cocycle = reduction_column; diameter_entry_t e; while (get_index(e = get_pivot(cocycle, modulus)) != -1) { - std::cout << vertices_of_simplex(get_index(e), dim, n, binomial_coeff) << ":" << normalize(get_coefficient(e), modulus); + std::cout << vertices_of_simplex(get_index(e), dim) << ":" << normalize(get_coefficient(e), modulus); cocycle.pop(); if (get_index(e = get_pivot(cocycle, modulus)) != -1) std::cout << ", "; } -- cgit v1.2.3