summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjan.reininghaus <jan.reininghaus@8e3bb3c2-eed4-f18f-5264-0b6c94e6926d>2013-04-23 15:26:20 +0000
committerjan.reininghaus <jan.reininghaus@8e3bb3c2-eed4-f18f-5264-0b6c94e6926d>2013-04-23 15:26:20 +0000
commitbf7cdc36a86cb252097f559e977bec48ab802666 (patch)
treef04efaf8425cdde70a31c16e78cc78a2f8c25fa9 /src
parent3cf63b2f122f1fd9a967ee9dc7a21436f4a94077 (diff)
new representation type vector_list
git-svn-id: https://phat.googlecode.com/svn/trunk@39 8e3bb3c2-eed4-f18f-5264-0b6c94e6926d
Diffstat (limited to 'src')
-rw-r--r--src/phat.cpp13
-rw-r--r--src/self_test.cpp15
2 files changed, 24 insertions, 4 deletions
diff --git a/src/phat.cpp b/src/phat.cpp
index 2b48088..448e0bb 100644
--- a/src/phat.cpp
+++ b/src/phat.cpp
@@ -20,6 +20,7 @@
#include <phat/representations/vector_vector.h>
#include <phat/representations/vector_set.h>
+#include <phat/representations/vector_list.h>
#include <phat/representations/sparse_pivot_column.h>
#include <phat/representations/full_pivot_column.h>
#include <phat/representations/bit_tree_pivot_column.h>
@@ -30,7 +31,7 @@
#include <phat/algorithms/chunk_reduction.h>
-enum Representation_type {VECTOR_VECTOR, VECTOR_SET, SPARSE_PIVOT_COLUMN, FULL_PIVOT_COLUMN, BIT_TREE_PIVOT_COLUMN};
+enum Representation_type {VECTOR_VECTOR, VECTOR_SET, SPARSE_PIVOT_COLUMN, FULL_PIVOT_COLUMN, BIT_TREE_PIVOT_COLUMN, VECTOR_LIST};
enum Algorithm_type {STANDARD, TWIST, ROW, CHUNK };
void print_help() {
@@ -43,7 +44,7 @@ void print_help() {
std::cerr << "--help -- prints this screen" << std::endl;
std::cerr << "--verbose -- verbose output" << std::endl;
std::cerr << "--dualize -- use dualization approach" << std::endl;
- std::cerr << "--vector_vector, --vector_set, --full_pivot_column, --sparse_pivot_column, --bit_tree_pivot_column -- selects a representation data structure for boundary matrices (default is '--bit_tree_pivot_column')" << std::endl;
+ std::cerr << "--vector_vector, --vector_set, --vector_list, --full_pivot_column, --sparse_pivot_column, --bit_tree_pivot_column -- selects a representation data structure for boundary matrices (default is '--bit_tree_pivot_column')" << std::endl;
std::cerr << "--standard, --twist, --chunk, --row -- selects a reduction algorithm (default is '--chunk')" << std::endl;
}
@@ -68,6 +69,7 @@ void parse_command_line( int argc, char** argv, bool& use_binary, Representation
else if( option == "--dualize" ) dualize = true;
else if( option == "--vector_vector" ) rep_type = VECTOR_VECTOR;
else if( option == "--vector_set" ) rep_type = VECTOR_SET;
+ else if( option == "--vector_list" ) rep_type = VECTOR_LIST;
else if( option == "--full_pivot_column" ) rep_type = FULL_PIVOT_COLUMN;
else if( option == "--bit_tree_pivot_column" ) rep_type = BIT_TREE_PIVOT_COLUMN;
else if( option == "--sparse_pivot_column" ) rep_type = SPARSE_PIVOT_COLUMN;
@@ -157,6 +159,13 @@ int main( int argc, char** argv )
case ROW: CALL_GENERIC_CODE(phat::vector_set, phat::row_reduction) break;
case CHUNK: CALL_GENERIC_CODE(phat::vector_set, phat::chunk_reduction) break;
} break;
+
+ case VECTOR_LIST: switch( reduction ) {
+ case STANDARD: CALL_GENERIC_CODE(phat::vector_list, phat::standard_reduction) break;
+ case TWIST: CALL_GENERIC_CODE(phat::vector_list, phat::twist_reduction) break;
+ case ROW: CALL_GENERIC_CODE(phat::vector_list, phat::row_reduction) break;
+ case CHUNK: CALL_GENERIC_CODE(phat::vector_list, phat::chunk_reduction) break;
+ } break;
case FULL_PIVOT_COLUMN: switch( reduction ) {
case STANDARD: CALL_GENERIC_CODE(phat::full_pivot_column, phat::standard_reduction) break;
diff --git a/src/self_test.cpp b/src/self_test.cpp
index 9ce44bc..e3aaa32 100644
--- a/src/self_test.cpp
+++ b/src/self_test.cpp
@@ -20,6 +20,7 @@
#include <phat/representations/vector_vector.h>
#include <phat/representations/vector_set.h>
+#include <phat/representations/vector_list.h>
#include <phat/representations/sparse_pivot_column.h>
#include <phat/representations/full_pivot_column.h>
#include <phat/representations/bit_tree_pivot_column.h>
@@ -38,6 +39,7 @@ int main( int argc, char** argv )
typedef phat::bit_tree_pivot_column BitTree;
typedef phat::vector_vector Vec_vec;
typedef phat::vector_set Vec_set;
+ typedef phat::vector_list Vec_list;
std::cout << "Reading test data " << test_data << " in binary format ..." << std::endl;
phat::boundary_matrix< Full > boundary_matrix;
@@ -74,6 +76,11 @@ int main( int argc, char** argv )
phat::boundary_matrix< Vec_set > vec_set_boundary_matrix = boundary_matrix;
phat::compute_persistence_pairs< phat::chunk_reduction >( vec_set_pairs, vec_set_boundary_matrix );
+ std::cout << "Running Chunk - Vec_list ..." << std::endl;
+ phat::persistence_pairs vec_list_pairs;
+ phat::boundary_matrix< Vec_list > vec_list_boundary_matrix = boundary_matrix;
+ phat::compute_persistence_pairs< phat::chunk_reduction >( vec_list_pairs, vec_list_boundary_matrix );
+
if( sparse_pairs != full_pairs ) {
std::cerr << "Error: sparse and full differ!" << std::endl;
error = true;
@@ -90,8 +97,12 @@ int main( int argc, char** argv )
std::cerr << "Error: vec_set and bit_tree differ!" << std::endl;
error = true;
}
- if( bit_tree_pairs != sparse_pairs ) {
- std::cerr << "Error: bit_tree and sparse differ!" << std::endl;
+ if( bit_tree_pairs != vec_list_pairs ) {
+ std::cerr << "Error: bit_tree and vec_list differ!" << std::endl;
+ error = true;
+ }
+ if( vec_list_pairs != sparse_pairs ) {
+ std::cerr << "Error: vec_list and sparse differ!" << std::endl;
error = true;
}