summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile24
-rw-r--r--ripser.cpp45
-rw-r--r--ripser.xcodeproj/project.pbxproj1
3 files changed, 43 insertions, 27 deletions
diff --git a/Makefile b/Makefile
index 893d776..8569d34 100644
--- a/Makefile
+++ b/Makefile
@@ -1,24 +1,8 @@
-build: ripser
+build: ripser-representatives
-all: ripser ripser-coeff ripser-reduction ripser-coeff-reduction ripser-debug
-
-
-ripser: ripser.cpp
- c++ -std=c++11 ripser.cpp -o ripser -Ofast -D NDEBUG
-
-ripser-coeff: ripser.cpp
- c++ -std=c++11 ripser.cpp -o ripser-coeff -Ofast -D NDEBUG -D USE_COEFFICIENTS
-
-ripser-reduction: ripser.cpp
- c++ -std=c++11 ripser.cpp -o ripser-reduction -Ofast -D NDEBUG -D ASSEMBLE_REDUCTION_MATRIX
-
-ripser-coeff-reduction: ripser.cpp
- c++ -std=c++11 ripser.cpp -o ripser-coeff-reduction -Ofast -D NDEBUG -D USE_COEFFICIENTS -D ASSEMBLE_REDUCTION_MATRIX
-
-ripser-debug: ripser.cpp
- c++ -std=c++11 ripser.cpp -o ripser-debug -g
-
+ripser-representatives: ripser.cpp
+ c++ -std=c++11 ripser.cpp -o ripser-representatives -Ofast -D NDEBUG -D _USE_COEFFICIENTS -D ASSEMBLE_REDUCTION_MATRIX -D USE_GOOGLE_HASHMAP
clean:
- rm -f ripser ripser-coeff ripser-reduction ripser-coeff-reduction ripser-debug
+ rm -f ripser-representatives
diff --git a/ripser.cpp b/ripser.cpp
index bc97752..548cff7 100644
--- a/ripser.cpp
+++ b/ripser.cpp
@@ -36,6 +36,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <sstream>
#include <unordered_map>
+#include "prettyprint.hpp"
+
#ifdef USE_GOOGLE_HASHMAP
#include <sparsehash/sparse_hash_map>
template <class Key, class T> class hash_map : public google::sparse_hash_map<Key, T> {
@@ -634,14 +636,27 @@ public:
factor_column_to_add = modulus - get_coefficient(pivot);
} else {
#ifdef PRINT_PERSISTENCE_PAIRS
- value_t death = get_diameter(pivot);
- if (diameter != death) {
+ value_t death = get_diameter(pivot);
+ if (diameter != death) {
#ifdef INDICATE_PROGRESS
- std::cout << "\033[K";
+ std::cout << "\033[K";
#endif
- std::cout << " [" << diameter << "," << death << ")" << std::endl
- << std::flush;
- }
+ // std::cout << " [" << diameter << "," << death << ")" << std::endl << std::flush;
+ std::cout << " [" << diameter << "," << death << "): {";
+ auto cocycle = working_reduction_column;
+ diameter_entry_t e;
+ while (get_index(e = get_pivot(cocycle, modulus)) != -1) {
+ vertices.clear();
+ get_simplex_vertices(get_index(e), dim, n, std::back_inserter(vertices));
+ std::cout << vertices;
+#ifdef USE_COEFFICIENTS
+ std::cout << ":" << get_coefficient(pivot);
+#endif
+ cocycle.pop();
+ if (get_index(e = get_pivot(cocycle, modulus)) != -1) std::cout << ", ";
+ }
+ std::cout << "}" << std::endl;
+ }
#endif
pivot_column_index.insert(
std::make_pair(get_index(pivot), index_column_to_reduce));
@@ -680,7 +695,23 @@ public:
}
} else {
#ifdef PRINT_PERSISTENCE_PAIRS
- std::cout << " [" << diameter << ", )" << std::endl << std::flush;
+#ifdef INDICATE_PROGRESS
+ std::cout << "\033[K";
+#endif
+ // std::cout << " [" << diameter << ", )" << std::endl << std::flush;
+ std::cout << " [" << diameter << ", ): {";
+ auto cocycle = working_reduction_column;
+ while (get_index(pivot = get_pivot(cocycle, modulus)) != -1) {
+ vertices.clear();
+ get_simplex_vertices(get_index(pivot), dim, n, std::back_inserter(vertices));
+ std::cout << vertices;
+#ifdef USE_COEFFICIENTS
+ std::cout << ":" << get_coefficient(pivot);
+#endif
+ cocycle.pop();
+ if (get_index(pivot = get_pivot(cocycle, modulus)) != -1) std::cout << ", ";
+ }
+ std::cout << "}" << std::endl;
#endif
break;
}
diff --git a/ripser.xcodeproj/project.pbxproj b/ripser.xcodeproj/project.pbxproj
index 24c7d8b..3578fa0 100644
--- a/ripser.xcodeproj/project.pbxproj
+++ b/ripser.xcodeproj/project.pbxproj
@@ -217,6 +217,7 @@
_FILE_FORMAT_LOWER_DISTANCE_MATRIX,
_FILE_FORMAT_POINT_CLOUD,
_USE_COEFFICIENTS,
+ ASSEMBLE_REDUCTION_MATRIX,
INDICATE_PROGRESS,
);
PRODUCT_NAME = "$(TARGET_NAME)";