summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjan.reininghaus <jan.reininghaus@8e3bb3c2-eed4-f18f-5264-0b6c94e6926d>2014-04-30 08:57:41 +0000
committerjan.reininghaus <jan.reininghaus@8e3bb3c2-eed4-f18f-5264-0b6c94e6926d>2014-04-30 08:57:41 +0000
commitb17e55afc11caff584573a9b3b2f86493b9642b8 (patch)
treeca11a9918cd94926ad933cf5198e1bad55343752 /src
parent8c0e068cb06022b63f36fc6d58c1368153532d43 (diff)
new vector_heap Representation
git-svn-id: https://phat.googlecode.com/svn/trunk@164 8e3bb3c2-eed4-f18f-5264-0b6c94e6926d
Diffstat (limited to 'src')
-rw-r--r--src/benchmark.cpp10
-rw-r--r--src/phat.cpp7
-rw-r--r--src/self_test.cpp15
3 files changed, 26 insertions, 6 deletions
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 <phat/compute_persistence_pairs.h>
#include <phat/representations/vector_vector.h>
+#include <phat/representations/vector_heap.h>
#include <phat/representations/vector_set.h>
#include <phat/representations/vector_list.h>
#include <phat/representations/sparse_pivot_column.h>
@@ -38,7 +39,7 @@
#include <iomanip>
-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 <phat/compute_persistence_pairs.h>
#include <phat/representations/vector_vector.h>
+#include <phat/representations/vector_heap.h>
#include <phat/representations/vector_set.h>
#include <phat/representations/vector_list.h>
#include <phat/representations/sparse_pivot_column.h>
@@ -34,7 +35,7 @@
#include <phat/helpers/dualize.h>
-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 <phat/compute_persistence_pairs.h>
#include <phat/representations/vector_vector.h>
+#include <phat/representations/vector_heap.h>
#include <phat/representations/vector_set.h>
#include <phat/representations/vector_list.h>
#include <phat/representations/sparse_pivot_column.h>
@@ -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 ) {