diff options
author | Ulrich Bauer <mail@ulrich-bauer.org> | 2021-01-04 15:47:41 +0100 |
---|---|---|
committer | Ulrich Bauer <mail@ulrich-bauer.org> | 2021-01-04 15:47:41 +0100 |
commit | 4fc9585997bea869a97ad86f5f2afec7c57b58f5 (patch) | |
tree | 6d939d009e8d56bfa0a9abe5f5a677fc8cdc0c45 | |
parent | e098021c075095c4ad3f40848d985bdcd49bf582 (diff) |
more efficient coboundary enumerators
-rw-r--r-- | ripser.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -854,13 +854,17 @@ public: const ripser& _parent) : idx_below(get_index(_simplex)), idx_above(0), k(_dim + 1), vertices(_dim + 1), simplex(_simplex), modulus(_parent.modulus), dist(_parent.dist), - binomial_coeff(_parent.binomial_coeff) { + binomial_coeff(_parent.binomial_coeff), + neighbor_it(_dim + 1), neighbor_end(_dim + 1) { + _parent.get_simplex_vertices(idx_below, _dim, _parent.n, vertices.rbegin()); - for (auto v : vertices) { - neighbor_it.push_back(dist.neighbors[v].rbegin()); - neighbor_end.push_back(dist.neighbors[v].rend()); + for (size_t i = 0; i <= _dim; ++i) { + auto v = vertices[i]; + neighbor_it[i] = dist.neighbors[v].rbegin(); + neighbor_end[i] = dist.neighbors[v].rend(); } + } bool has_next(bool all_cofacets = true) { |