From b17e55afc11caff584573a9b3b2f86493b9642b8 Mon Sep 17 00:00:00 2001 From: "jan.reininghaus" Date: Wed, 30 Apr 2014 08:57:41 +0000 Subject: new vector_heap Representation git-svn-id: https://phat.googlecode.com/svn/trunk@164 8e3bb3c2-eed4-f18f-5264-0b6c94e6926d --- src/benchmark.cpp | 10 ++++++++-- src/phat.cpp | 7 +++++-- src/self_test.cpp | 15 +++++++++++++-- 3 files changed, 26 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/benchmark.cpp b/src/benchmark.cpp index c1d897b..3abb4cd 100644 --- a/src/benchmark.cpp +++ b/src/benchmark.cpp @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -38,7 +39,7 @@ #include -enum Representation_type {VECTOR_VECTOR, VECTOR_SET, SPARSE_PIVOT_COLUMN, HEAP_PIVOT_COLUMN, FULL_PIVOT_COLUMN, BIT_TREE_PIVOT_COLUMN, VECTOR_LIST}; +enum Representation_type { VECTOR_VECTOR, VECTOR_HEAP, VECTOR_SET, SPARSE_PIVOT_COLUMN, HEAP_PIVOT_COLUMN, FULL_PIVOT_COLUMN, BIT_TREE_PIVOT_COLUMN, VECTOR_LIST }; enum Algorithm_type {STANDARD, TWIST, ROW, CHUNK, CHUNK_SEQUENTIAL, SPECTRAL_SEQUENCE}; enum Ansatz_type {PRIMAL, DUAL}; @@ -53,7 +54,7 @@ void print_help() { std::cerr << "--help -- prints this screen" << std::endl; std::cerr << "--dualize -- use only dualization approach" << std::endl; std::cerr << "--primal -- use only primal approach" << std::endl; - std::cerr << "--vector_vector, --vector_set, --vector_list, --full_pivot_column, --sparse_pivot_column, --heap_pivot_column, --bit_tree_pivot_column -- use only a subset of representation data structures for boundary matrices" << std::endl; + std::cerr << "--vector_vector, --vector_heap, --vector_set, --vector_list, --full_pivot_column, --sparse_pivot_column, --heap_pivot_column, --bit_tree_pivot_column -- use only a subset of representation data structures for boundary matrices" << std::endl; std::cerr << "--standard, --twist, --chunk, --chunk_sequential, --spectral_sequence, --row -- use only a subset of reduction algorithms" << std::endl; } @@ -75,6 +76,7 @@ void parse_command_line( int argc, char** argv, bool& latex_tables_output, bool& else if( argument == "--latex" ) latex_tables_output = true; else if( argument == "--binary" ) use_binary = true; else if( argument == "--vector_vector" ) representations.push_back( VECTOR_VECTOR ); + else if( argument == "--vector_heap" ) representations.push_back( VECTOR_HEAP ); else if( argument == "--vector_set" ) representations.push_back( VECTOR_SET ); else if( argument == "--vector_list" ) representations.push_back( VECTOR_LIST ); else if( argument == "--full_pivot_column" ) representations.push_back( FULL_PIVOT_COLUMN ); @@ -98,6 +100,7 @@ void parse_command_line( int argc, char** argv, bool& latex_tables_output, bool& if( representations.empty() == true ) { representations.push_back( VECTOR_VECTOR ); + representations.push_back( VECTOR_HEAP ); representations.push_back( VECTOR_SET ); representations.push_back( VECTOR_LIST ); representations.push_back( FULL_PIVOT_COLUMN ); @@ -238,6 +241,7 @@ int main( int argc, char** argv ) std::cout << input_filename << ","; switch( representation ) { case VECTOR_VECTOR: COMPUTE(vector_vector) break; + case VECTOR_HEAP: COMPUTE( vector_heap ) break; case VECTOR_SET: COMPUTE(vector_set) break; case VECTOR_LIST: COMPUTE(vector_list) break; case FULL_PIVOT_COLUMN: COMPUTE(full_pivot_column) break; @@ -262,6 +266,7 @@ int main( int argc, char** argv ) Representation_type representation = representations[ idx_representation ]; switch( representation ) { case VECTOR_VECTOR: std::cout << "& V "; break; + case VECTOR_HEAP: std::cout << "& H "; break; case VECTOR_SET: std::cout << "& S "; break; case VECTOR_LIST: std::cout << "& L "; break; case FULL_PIVOT_COLUMN: std::cout << "& P-F "; break; @@ -293,6 +298,7 @@ int main( int argc, char** argv ) Representation_type representation = representations[ idx_representation ]; switch( representation ) { case VECTOR_VECTOR: COMPUTE_LATEX( vector_vector ) break; + case VECTOR_HEAP: COMPUTE_LATEX( vector_heap ) break; case VECTOR_SET: COMPUTE_LATEX( vector_set ) break; case VECTOR_LIST: COMPUTE_LATEX( vector_list ) break; case FULL_PIVOT_COLUMN: COMPUTE_LATEX( full_pivot_column ) break; diff --git a/src/phat.cpp b/src/phat.cpp index 8fcd42c..b099b59 100644 --- a/src/phat.cpp +++ b/src/phat.cpp @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -34,7 +35,7 @@ #include -enum Representation_type {VECTOR_VECTOR, VECTOR_SET, SPARSE_PIVOT_COLUMN, FULL_PIVOT_COLUMN, BIT_TREE_PIVOT_COLUMN, VECTOR_LIST, HEAP_PIVOT_COLUMN}; +enum Representation_type { VECTOR_VECTOR, VECTOR_HEAP, VECTOR_SET, SPARSE_PIVOT_COLUMN, FULL_PIVOT_COLUMN, BIT_TREE_PIVOT_COLUMN, VECTOR_LIST, HEAP_PIVOT_COLUMN }; enum Algorithm_type {STANDARD, TWIST, ROW, CHUNK, CHUNK_SEQUENTIAL, SPECTRAL_SEQUENCE }; void print_help() { @@ -47,7 +48,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, --vector_list, --full_pivot_column, --sparse_pivot_column, --heap_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_heap, --vector_set, --vector_list, --full_pivot_column, --sparse_pivot_column, --heap_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, --chunk_sequential, --spectral_sequence, --row -- selects a reduction algorithm (default is '--twist')" << std::endl; } @@ -71,6 +72,7 @@ void parse_command_line( int argc, char** argv, bool& use_binary, Representation else if( option == "--binary" ) use_binary = true; else if( option == "--dualize" ) dualize = true; else if( option == "--vector_vector" ) representation = VECTOR_VECTOR; + else if( option == "--vector_heap" ) representation = VECTOR_HEAP; else if( option == "--vector_set" ) representation = VECTOR_SET; else if( option == "--vector_list" ) representation = VECTOR_LIST; else if( option == "--full_pivot_column" ) representation = FULL_PIVOT_COLUMN; @@ -177,6 +179,7 @@ int main( int argc, char** argv ) switch( representation ) { case VECTOR_VECTOR: COMPUTE_PAIRING(vector_vector) break; + case VECTOR_HEAP: COMPUTE_PAIRING( vector_heap ) break; case VECTOR_SET: COMPUTE_PAIRING(vector_set) break; case VECTOR_LIST: COMPUTE_PAIRING(vector_list) break; case FULL_PIVOT_COLUMN: COMPUTE_PAIRING(full_pivot_column) break; diff --git a/src/self_test.cpp b/src/self_test.cpp index 02bca5e..249b9b2 100644 --- a/src/self_test.cpp +++ b/src/self_test.cpp @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -41,6 +42,7 @@ int main( int argc, char** argv ) typedef phat::full_pivot_column Full; typedef phat::bit_tree_pivot_column BitTree; typedef phat::vector_vector Vec_vec; + typedef phat::vector_heap Vec_heap; typedef phat::vector_set Vec_set; typedef phat::vector_list Vec_list; @@ -79,6 +81,11 @@ int main( int argc, char** argv ) phat::boundary_matrix< Vec_vec > vec_vec_boundary_matrix = boundary_matrix; phat::compute_persistence_pairs< phat::chunk_reduction >( vec_vec_pairs, vec_vec_boundary_matrix ); + std::cout << "Running Chunk - Vec_heap ..." << std::endl; + phat::persistence_pairs vec_heap_pairs; + phat::boundary_matrix< Vec_heap > vec_heap_boundary_matrix = boundary_matrix; + phat::compute_persistence_pairs< phat::chunk_reduction >( vec_heap_pairs, vec_heap_boundary_matrix ); + std::cout << "Running Chunk - Vec_set ..." << std::endl; phat::persistence_pairs vec_set_pairs; phat::boundary_matrix< Vec_set > vec_set_boundary_matrix = boundary_matrix; @@ -101,8 +108,12 @@ int main( int argc, char** argv ) std::cerr << "Error: full and vec_vec differ!" << std::endl; error = true; } - if( vec_vec_pairs != vec_set_pairs ) { - std::cerr << "Error: vec_vec and vec_set differ!" << std::endl; + if( vec_vec_pairs != vec_heap_pairs ) { + std::cerr << "Error: vec_vec and vec_heap differ!" << std::endl; + error = true; + } + if( vec_heap_pairs != vec_set_pairs ) { + std::cerr << "Error: vec_heap and vec_set differ!" << std::endl; error = true; } if( vec_set_pairs != bit_tree_pairs ) { -- cgit v1.2.3