From bf7cdc36a86cb252097f559e977bec48ab802666 Mon Sep 17 00:00:00 2001 From: "jan.reininghaus" Date: Tue, 23 Apr 2013 15:26:20 +0000 Subject: new representation type vector_list git-svn-id: https://phat.googlecode.com/svn/trunk@39 8e3bb3c2-eed4-f18f-5264-0b6c94e6926d --- build/Visual Studio/phat/phat.vcxproj | 1 + build/Visual Studio/phat/phat.vcxproj.filters | 3 +++ build/Visual Studio/self_test/self_test.vcxproj | 1 + build/Visual Studio/self_test/self_test.vcxproj.filters | 3 +++ build/Visual Studio/simple_example/simple_example.vcxproj | 1 + .../simple_example/simple_example.vcxproj.filters | 3 +++ include/phat/helpers/misc.h | 1 + src/phat.cpp | 13 +++++++++++-- src/self_test.cpp | 15 +++++++++++++-- 9 files changed, 37 insertions(+), 4 deletions(-) diff --git a/build/Visual Studio/phat/phat.vcxproj b/build/Visual Studio/phat/phat.vcxproj index ca58b33..ecc0202 100644 --- a/build/Visual Studio/phat/phat.vcxproj +++ b/build/Visual Studio/phat/phat.vcxproj @@ -187,6 +187,7 @@ + diff --git a/build/Visual Studio/phat/phat.vcxproj.filters b/build/Visual Studio/phat/phat.vcxproj.filters index f4b3561..34e8745 100644 --- a/build/Visual Studio/phat/phat.vcxproj.filters +++ b/build/Visual Studio/phat/phat.vcxproj.filters @@ -77,5 +77,8 @@ Header Files\representations + + Header Files\representations + \ No newline at end of file diff --git a/build/Visual Studio/self_test/self_test.vcxproj b/build/Visual Studio/self_test/self_test.vcxproj index 0a32e26..0123001 100644 --- a/build/Visual Studio/self_test/self_test.vcxproj +++ b/build/Visual Studio/self_test/self_test.vcxproj @@ -187,6 +187,7 @@ + diff --git a/build/Visual Studio/self_test/self_test.vcxproj.filters b/build/Visual Studio/self_test/self_test.vcxproj.filters index 1cd56f6..fca436c 100644 --- a/build/Visual Studio/self_test/self_test.vcxproj.filters +++ b/build/Visual Studio/self_test/self_test.vcxproj.filters @@ -77,5 +77,8 @@ Header Files\representations + + Header Files\representations + \ No newline at end of file diff --git a/build/Visual Studio/simple_example/simple_example.vcxproj b/build/Visual Studio/simple_example/simple_example.vcxproj index fc90660..0dad008 100644 --- a/build/Visual Studio/simple_example/simple_example.vcxproj +++ b/build/Visual Studio/simple_example/simple_example.vcxproj @@ -187,6 +187,7 @@ + diff --git a/build/Visual Studio/simple_example/simple_example.vcxproj.filters b/build/Visual Studio/simple_example/simple_example.vcxproj.filters index 9ed24d8..6d666a3 100644 --- a/build/Visual Studio/simple_example/simple_example.vcxproj.filters +++ b/build/Visual Studio/simple_example/simple_example.vcxproj.filters @@ -77,5 +77,8 @@ Header Files\representations + + Header Files\representations + \ No newline at end of file diff --git a/include/phat/helpers/misc.h b/include/phat/helpers/misc.h index 93af132..423da4f 100644 --- a/include/phat/helpers/misc.h +++ b/include/phat/helpers/misc.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include 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 #include +#include #include #include #include @@ -30,7 +31,7 @@ #include -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 #include +#include #include #include #include @@ -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; } -- cgit v1.2.3