summaryrefslogtreecommitdiff
path: root/src/Persistent_cohomology
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-06-18 14:49:07 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-06-18 14:49:07 +0000
commit669459903831d01ac1399c2d0fd2111d00392a1b (patch)
treee073865b8245272626a5066ea9524a01d4f5a170 /src/Persistent_cohomology
parent4f18bf5115955c764f4eb15cd600a776f1a4d9ce (diff)
parentd7c885fc4eaa06be6e6b57b8c3bd622b82a20c77 (diff)
Backmerge of last trunk modifications
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alphashapes@625 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 8729c94e37923be0bbf943513025e7362807f041
Diffstat (limited to 'src/Persistent_cohomology')
-rw-r--r--src/Persistent_cohomology/example/CMakeLists.txt5
-rw-r--r--src/Persistent_cohomology/example/rips_multifield_persistence.cpp2
-rw-r--r--src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h26
-rw-r--r--src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Field_Zp.h3
-rw-r--r--src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Multi_field.h5
-rw-r--r--src/Persistent_cohomology/test/CMakeLists.txt44
-rw-r--r--src/Persistent_cohomology/test/README6
-rw-r--r--src/Persistent_cohomology/test/persistent_cohomology_unit_test.cpp5
-rw-r--r--src/Persistent_cohomology/test/persistent_cohomology_unit_test_multi_field.cpp89
-rw-r--r--src/Persistent_cohomology/test/simplex_tree_file_for_multi_field_unit_test.txt58
-rw-r--r--src/Persistent_cohomology/test/simplex_tree_file_for_multi_field_unit_test.txt.REMOVED.git-id1
11 files changed, 142 insertions, 102 deletions
diff --git a/src/Persistent_cohomology/example/CMakeLists.txt b/src/Persistent_cohomology/example/CMakeLists.txt
index 3697a419..9487cce6 100644
--- a/src/Persistent_cohomology/example/CMakeLists.txt
+++ b/src/Persistent_cohomology/example/CMakeLists.txt
@@ -9,7 +9,6 @@ if (NOT MSVC)
add_executable(rips_persistence rips_persistence.cpp)
target_link_libraries(rips_persistence ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY})
- add_test(rips_persistence_2 ${CMAKE_CURRENT_BINARY_DIR}/rips_persistence ${CMAKE_SOURCE_DIR}/data/points/Kl.txt -r 0.25 -d 3 -p 2 -m 100)
add_test(rips_persistence_3 ${CMAKE_CURRENT_BINARY_DIR}/rips_persistence ${CMAKE_SOURCE_DIR}/data/points/Kl.txt -r 0.25 -d 3 -p 3 -m 100)
add_executable(persistence_from_file persistence_from_file.cpp)
@@ -23,14 +22,14 @@ if (NOT MSVC)
add_executable(rips_multifield_persistence rips_multifield_persistence.cpp )
target_link_libraries(rips_multifield_persistence ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES})
- add_test(rips_multifield_persistence_2_3 ${CMAKE_CURRENT_BINARY_DIR}/rips_multifield_persistence ${CMAKE_SOURCE_DIR}/data/points/Kl.txt -r 0.25 -d 3 -p 2 -q 3 -m 100)
add_test(rips_multifield_persistence_2_71 ${CMAKE_CURRENT_BINARY_DIR}/rips_multifield_persistence ${CMAKE_SOURCE_DIR}/data/points/Kl.txt -r 0.25 -d 3 -p 2 -q 71 -m 100)
add_executable ( performance_rips_persistence performance_rips_persistence.cpp )
target_link_libraries(performance_rips_persistence ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES})
if(CGAL_FOUND)
- add_definitions(-DDEBUG_TRACES)
+ # uncomment to display debug traces
+ # add_definitions(-DDEBUG_TRACES)
add_executable(alpha_shapes_persistence alpha_shapes_persistence.cpp)
target_link_libraries(alpha_shapes_persistence ${Boost_SYSTEM_LIBRARY} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES} ${CGAL_LIBRARY})
add_test(alpha_shapes_persistence_2_0_5 ${CMAKE_CURRENT_BINARY_DIR}/alpha_shapes_persistence ${CMAKE_SOURCE_DIR}/data/points/bunny_5000 2 0.5)
diff --git a/src/Persistent_cohomology/example/rips_multifield_persistence.cpp b/src/Persistent_cohomology/example/rips_multifield_persistence.cpp
index 2505897e..297a8f98 100644
--- a/src/Persistent_cohomology/example/rips_multifield_persistence.cpp
+++ b/src/Persistent_cohomology/example/rips_multifield_persistence.cpp
@@ -70,8 +70,6 @@ int main (int argc, char * argv[])
st.insert_graph(prox_graph); // insert the proximity graph in the simplex tree
st.expansion( dim_max ); // expand the graph until dimension dim_max
- std::cout << "st=" << st << std::endl;
-
// Sort the simplices in the order of the filtration
st.initialize_filtration();
diff --git a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h
index c42e4be4..b0d68f09 100644
--- a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h
+++ b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h
@@ -238,8 +238,8 @@ class Persistent_cohomology {
transverse_idx_(), // key -> row
persistent_pairs_(),
interval_length_policy(&cpx, 0),
- column_pool_(new boost::object_pool<Column>()), // memory pools for the CAM
- cell_pool_(new boost::object_pool<Cell>()) {
+ column_pool_(), // memory pools for the CAM
+ cell_pool_() {
Simplex_key idx_fil = 0;
for (auto & sh : cpx_->filtration_simplex_range()) {
cpx_->assign_key(sh, idx_fil);
@@ -273,9 +273,6 @@ class Persistent_cohomology {
transverse_ref.second.row_->clear();
delete transverse_ref.second.row_;
}
-// Clear the memory pools
- delete column_pool_;
- delete cell_pool_;
}
private:
@@ -528,8 +525,8 @@ class Persistent_cohomology {
Arith_element charac) {
Simplex_key key = cpx_->key(sigma);
// Create a column containing only one cell,
- Column * new_col = column_pool_->construct(Column(key));
- Cell * new_cell = cell_pool_->construct(Cell(key, x, new_col));
+ Column * new_col = column_pool_.construct(Column(key));
+ Cell * new_cell = cell_pool_.construct(Cell(key, x, new_col));
new_col->col_.push_back(*new_cell);
// and insert it in the matrix, in constant time thanks to the hint cam_.end().
// Indeed *new_col has the biggest lexicographic value because key is the
@@ -585,7 +582,7 @@ class Persistent_cohomology {
if (curr_col->col_.empty()) { // If the column is null
ds_repr_[curr_col->class_key_] = NULL;
- column_pool_->free(curr_col); // delete curr_col;
+ column_pool_.destroy(curr_col); // delete curr_col;
} else {
// Find whether the column obtained is already in the CAM
result_insert_cam = cam_.insert(*curr_col);
@@ -602,7 +599,7 @@ class Persistent_cohomology {
Simplex_key key_tmp = dsets_.find_set(curr_col->class_key_);
ds_repr_[key_tmp] = &(*(result_insert_cam.first));
result_insert_cam.first->class_key_ = key_tmp;
- column_pool_->free(curr_col); // delete curr_col;
+ column_pool_.destroy(curr_col); // delete curr_col;
}
}
} else {
@@ -634,7 +631,7 @@ class Persistent_cohomology {
++target_it;
} else {
if (target_it->key_ > other_it->first) {
- Cell * cell_tmp = cell_pool_->construct(Cell(other_it->first // key
+ Cell * cell_tmp = cell_pool_.construct(Cell(other_it->first // key
, coeff_field_.additive_identity(), &target));
cell_tmp->coefficient_ = coeff_field_.plus_times_equal(cell_tmp->coefficient_, other_it->second, w);
@@ -652,8 +649,7 @@ class Persistent_cohomology {
Cell * tmp_cell_ptr = &(*tmp_it);
target.col_.erase(tmp_it); // removed from column
- coeff_field_.clear_coefficient(tmp_cell_ptr->coefficient_);
- cell_pool_->free(tmp_cell_ptr); // delete from memory
+ cell_pool_.destroy(tmp_cell_ptr); // delete from memory
} else {
++target_it;
++other_it;
@@ -662,7 +658,7 @@ class Persistent_cohomology {
}
}
while (other_it != other.end()) {
- Cell * cell_tmp = cell_pool_->construct(Cell(other_it->first, coeff_field_.additive_identity(), &target));
+ Cell * cell_tmp = cell_pool_.construct(Cell(other_it->first, coeff_field_.additive_identity(), &target));
cell_tmp->coefficient_ = coeff_field_.plus_times_equal(cell_tmp->coefficient_, other_it->second, w);
target.col_.insert(target.col_.end(), *cell_tmp);
@@ -767,8 +763,8 @@ class Persistent_cohomology {
std::list<Persistent_interval> persistent_pairs_;
length_interval interval_length_policy;
- boost::object_pool<Column> * column_pool_;
- boost::object_pool<Cell> * cell_pool_;
+ boost::object_pool<Column> column_pool_;
+ boost::object_pool<Cell> cell_pool_;
};
/** @} */ // end defgroup persistent_cohomology
diff --git a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Field_Zp.h b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Field_Zp.h
index 5d0c9f9f..2349cdac 100644
--- a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Field_Zp.h
+++ b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Field_Zp.h
@@ -76,9 +76,6 @@ class Field_Zp {
return plus_times_equal(0, y, (Element)w);
}
- void clear_coefficient(Element x) {
- }
-
Element plus_equal(const Element& x, const Element& y) {
return plus_times_equal(x, y, (Element)1);
}
diff --git a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Multi_field.h b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Multi_field.h
index b43bb16e..c6fd5282 100644
--- a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Multi_field.h
+++ b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Multi_field.h
@@ -77,6 +77,7 @@ class Multi_field {
mpz_nextprime(tmp_prime, tmp_prime);
curr_prime = mpz_get_ui(tmp_prime);
}
+ mpz_clear(tmp_prime);
// set m to primorial(bound_prime)
prod_characteristics_ = 1;
for (auto p : primes_) {
@@ -102,10 +103,6 @@ class Multi_field {
}
}
- void clear_coefficient(Element & x) {
- mpz_clear(x.get_mpz_t());
- }
-
/** \brief Returns the additive idendity \f$0_{\Bbbk}\f$ of the field.*/
const Element& additive_identity() const {
return add_id_all;
diff --git a/src/Persistent_cohomology/test/CMakeLists.txt b/src/Persistent_cohomology/test/CMakeLists.txt
index 9dc19251..ed63a6ac 100644
--- a/src/Persistent_cohomology/test/CMakeLists.txt
+++ b/src/Persistent_cohomology/test/CMakeLists.txt
@@ -1,29 +1,39 @@
cmake_minimum_required(VERSION 2.6)
-project(GUDHITestSimplexTree)
+project(GUDHIPersistentCohomologyUT)
-if(NOT MSVC)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
- set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} --coverage")
- set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} --coverage")
+if (GCOVR_PATH)
+ # for gcovr to make coverage reports - Corbera Jenkins plugin
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage")
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fprofile-arcs -ftest-coverage")
+endif()
+if (GPROF_PATH)
+ # for gprof to make coverage reports - Jenkins
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg")
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -pg")
endif()
-add_executable ( persistent_cohomology_unit_test persistent_cohomology_unit_test.cpp )
-target_link_libraries(persistent_cohomology_unit_test ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
+add_executable ( PersistentCohomologyUT persistent_cohomology_unit_test.cpp )
+target_link_libraries(PersistentCohomologyUT ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
# Unitary tests
-add_test(persistent_cohomology_unit_test ${CMAKE_CURRENT_BINARY_DIR}/persistent_cohomology_unit_test ${CMAKE_SOURCE_DIR}/src/Persistent_cohomology/test/simplex_tree_file_for_unit_test.txt)
+add_test(NAME PersistentCohomologyUT
+ COMMAND ${CMAKE_CURRENT_BINARY_DIR}/PersistentCohomologyUT
+ ${CMAKE_SOURCE_DIR}/src/Persistent_cohomology/test/simplex_tree_file_for_unit_test.txt
+ # XML format for Jenkins xUnit plugin
+ --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/PersistentCohomologyUT.xml --log_level=test_suite --report_level=no)
if(GMPXX_FOUND AND GMP_FOUND)
- add_executable ( persistent_cohomology_unit_test_multi_field persistent_cohomology_unit_test_multi_field.cpp )
- target_link_libraries(persistent_cohomology_unit_test_multi_field ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES})
+ add_executable ( PersistentCohomologyMultiFieldUT persistent_cohomology_unit_test_multi_field.cpp )
+ target_link_libraries(PersistentCohomologyMultiFieldUT ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES})
- # Unitary tests
- add_test(persistent_cohomology_unit_test_multi_field ${CMAKE_CURRENT_BINARY_DIR}/persistent_cohomology_unit_test_multi_field ${CMAKE_SOURCE_DIR}/src/Persistent_cohomology/test/simplex_tree_file_for_multi_field_unit_test.txt)
-endif()
+ # Unitary tests
+ add_test(NAME PersistentCohomologyMultiFieldUT
+ COMMAND ${CMAKE_CURRENT_BINARY_DIR}/PersistentCohomologyMultiFieldUT
+ ${CMAKE_SOURCE_DIR}/src/Persistent_cohomology/test/simplex_tree_file_for_multi_field_unit_test.txt
+ # XML format for Jenkins xUnit plugin
+ --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/PersistentCohomologyMultiFieldUT.xml --log_level=test_suite --report_level=no)
-if (LCOV_PATH)
- # Lcov code coverage of unitary test
- add_test(src/Persistent_cohomology/lcov/coverage.log ${CMAKE_SOURCE_DIR}/scripts/check_code_coverage.sh ${CMAKE_SOURCE_DIR}/src/Persistent_cohomology)
endif()
-cpplint_add_tests("${CMAKE_SOURCE_DIR}/src/Persistent_cohomology/include/gudhi")
diff --git a/src/Persistent_cohomology/test/README b/src/Persistent_cohomology/test/README
index ddceac63..6c64b5fe 100644
--- a/src/Persistent_cohomology/test/README
+++ b/src/Persistent_cohomology/test/README
@@ -1,7 +1,9 @@
To compile:
***********
+cd /path-to-gudhi/
cmake .
+cd /path-to-test/
make
To launch with details:
@@ -9,13 +11,13 @@ To launch with details:
SINGLE FIELD
------------
-./persistent_cohomology_unit_test simplex_tree_file_for_unit_test.txt --report_level=detailed --log_level=all
+./PersistentCohomologyUT simplex_tree_file_for_unit_test.txt --report_level=detailed --log_level=all
==> echo $? returns 0 in case of success (non-zero otherwise)
MULTI FIELD
-----------
-./persistent_cohomology_unit_test_multi_field simplex_tree_file_for_multi_field_unit_test.txt --report_level=detailed --log_level=all
+./PersistentCohomologyMultiFieldUT simplex_tree_file_for_multi_field_unit_test.txt --report_level=detailed --log_level=all
==> echo $? returns 0 in case of success (non-zero otherwise)
diff --git a/src/Persistent_cohomology/test/persistent_cohomology_unit_test.cpp b/src/Persistent_cohomology/test/persistent_cohomology_unit_test.cpp
index 1e7a74a7..55bc7066 100644
--- a/src/Persistent_cohomology/test/persistent_cohomology_unit_test.cpp
+++ b/src/Persistent_cohomology/test/persistent_cohomology_unit_test.cpp
@@ -1,4 +1,4 @@
-#define BOOST_TEST_MODULE const_string test
+#define BOOST_TEST_MODULE persistent_cohomology test
#include <boost/test/included/unit_test.hpp>
#include <boost/system/error_code.hpp>
#include <boost/chrono/thread_clock.hpp>
@@ -22,8 +22,7 @@ using namespace boost::unit_test;
typedef Simplex_tree<> typeST;
std::string test_rips_persistence(int coefficient, int min_persistence) {
- // Check file name is given as parameter from CMakeLists.txt
- BOOST_CHECK(framework::master_test_suite().argc >= 2);
+ // file name is given as parameter from CMakeLists.txt
const std::string inputFile(framework::master_test_suite().argv[1]);
std::ifstream simplex_tree_stream;
diff --git a/src/Persistent_cohomology/test/persistent_cohomology_unit_test_multi_field.cpp b/src/Persistent_cohomology/test/persistent_cohomology_unit_test_multi_field.cpp
index e88add3a..18a4725e 100644
--- a/src/Persistent_cohomology/test/persistent_cohomology_unit_test_multi_field.cpp
+++ b/src/Persistent_cohomology/test/persistent_cohomology_unit_test_multi_field.cpp
@@ -1,4 +1,4 @@
-#define BOOST_TEST_MODULE const_string test
+#define BOOST_TEST_MODULE persistent_cohomology_multi_field test
#include <boost/test/included/unit_test.hpp>
#include <boost/system/error_code.hpp>
#include <boost/chrono/thread_clock.hpp>
@@ -23,8 +23,7 @@ using namespace boost::unit_test;
typedef Simplex_tree<> typeST;
std::string test_rips_persistence(int min_coefficient, int max_coefficient, int min_persistence) {
- // Check file name is given as parameter from CMakeLists.txt
- BOOST_CHECK(framework::master_test_suite().argc >= 2);
+ // file name is given as parameter from CMakeLists.txt
const std::string inputFile(framework::master_test_suite().argv[1]);
std::ifstream simplex_tree_stream;
@@ -38,9 +37,9 @@ std::string test_rips_persistence(int min_coefficient, int max_coefficient, int
<< " - filtration= " << st.filtration() << std::endl;
// Check
- BOOST_CHECK(st.num_simplices() == 6142604);
+ BOOST_CHECK(st.num_simplices() == 58);
BOOST_CHECK(st.dimension() == 3);
- BOOST_CHECK(st.filtration() == 0.249999);
+ BOOST_CHECK(st.filtration() == 0.4);
// Sort the simplices in the order of the filtration
st.initialize_filtration();
@@ -48,9 +47,9 @@ std::string test_rips_persistence(int min_coefficient, int max_coefficient, int
// Compute the persistence diagram of the complex
Persistent_cohomology<Simplex_tree<>, Multi_field> pcoh(st);
- pcoh.init_coefficients(min_coefficient, max_coefficient); // initializes the coefficient field for homology
+ pcoh.init_coefficients(min_coefficient, max_coefficient); // initializes the coefficient field for homology
// Check infinite rips
- pcoh.compute_persistent_cohomology(min_persistence); // Minimal lifetime of homology feature to be recorded.
+ pcoh.compute_persistent_cohomology(min_persistence); // Minimal lifetime of homology feature to be recorded.
std::ostringstream ossRips;
pcoh.output_diagram(ossRips);
@@ -60,68 +59,54 @@ std::string test_rips_persistence(int min_coefficient, int max_coefficient, int
}
void test_rips_persistence_in_dimension(int min_dimension, int max_dimension) {
- std::string value0(" 0 0 inf");
- std::string value1(" 1 0.0702103 inf");
- std::string value2("2 1 0.0702103 inf");
- std::string value3("2 2 0.159992 inf");
+ // there are 2 discontinued ensembles
+ std::string value0(" 0 0.25 inf");
+ std::string value1(" 1 0.4 inf");
+ // And a big hole - cut in 2 pieces after 0.3
+ std::string value2(" 0 0.2 0.3");
+
+ // For dim <= 1 =>
+ std::string value3(" 1 0.25 inf");
+ std::string value4(" 2 0.25 inf");
+ std::string value5(" 1 0.3 inf");
+ std::string value6(" 2 0.3 inf");
+ std::string value7(" 2 0.4 inf");
std::cout << "********************************************************************" << std::endl;
std::cout << "TEST OF RIPS_PERSISTENT_COHOMOLOGY_MULTI_FIELD MIN_DIM=" << min_dimension << " MAX_DIM=" << max_dimension << " MIN_PERS=0" << std::endl;
- std::string str_rips_persistence = test_rips_persistence(min_dimension, max_dimension, 1);
-
- BOOST_CHECK(str_rips_persistence.find(value0) != std::string::npos); // Check found
- BOOST_CHECK(str_rips_persistence.find(value1) != std::string::npos); // Check found
- BOOST_CHECK(str_rips_persistence.find(value2) != std::string::npos); // Check found
- BOOST_CHECK(str_rips_persistence.find(value3) != std::string::npos); // Check found
- std::cout << "str_rips_persistence=" << str_rips_persistence << std::endl;
-
- std::cout << "********************************************************************" << std::endl;
- std::cout << "TEST OF RIPS_PERSISTENT_COHOMOLOGY_MULTI_FIELD DIM=" << min_dimension << " MAX_DIM=" << max_dimension << " MIN_PERS=2" << std::endl;
-
- str_rips_persistence = test_rips_persistence(min_dimension, max_dimension, 2);
-
- BOOST_CHECK(str_rips_persistence.find(value0) != std::string::npos); // Check found
- BOOST_CHECK(str_rips_persistence.find(value1) != std::string::npos); // Check found
- BOOST_CHECK(str_rips_persistence.find(value2) != std::string::npos); // Check found
- BOOST_CHECK(str_rips_persistence.find(value3) != std::string::npos); // Check found
+ std::string str_rips_persistence = test_rips_persistence(min_dimension, max_dimension, static_cast<Filtration_value> (0.0));
std::cout << "str_rips_persistence=" << str_rips_persistence << std::endl;
- std::cout << "********************************************************************" << std::endl;
- std::cout << "TEST OF RIPS_PERSISTENT_COHOMOLOGY_MULTI_FIELD DIM=" << min_dimension << " MAX_DIM=" << max_dimension << " MIN_PERS=3" << std::endl;
-
- str_rips_persistence = test_rips_persistence(min_dimension, max_dimension, 3);
-
BOOST_CHECK(str_rips_persistence.find(value0) != std::string::npos); // Check found
BOOST_CHECK(str_rips_persistence.find(value1) != std::string::npos); // Check found
BOOST_CHECK(str_rips_persistence.find(value2) != std::string::npos); // Check found
- BOOST_CHECK(str_rips_persistence.find(value3) != std::string::npos); // Check found
- std::cout << "str_rips_persistence=" << str_rips_persistence << std::endl;
- std::cout << "********************************************************************" << std::endl;
- std::cout << "TEST OF RIPS_PERSISTENT_COHOMOLOGY_MULTI_FIELD DIM=" << min_dimension << " MAX_DIM=" << max_dimension << " MIN_PERS=Inf" << std::endl;
+ if ((min_dimension < 2) && (max_dimension < 2)) {
+ BOOST_CHECK(str_rips_persistence.find(value3) != std::string::npos); // Check found
+ BOOST_CHECK(str_rips_persistence.find(value4) != std::string::npos); // Check found
+ BOOST_CHECK(str_rips_persistence.find(value5) != std::string::npos); // Check found
+ BOOST_CHECK(str_rips_persistence.find(value6) != std::string::npos); // Check found
+ BOOST_CHECK(str_rips_persistence.find(value7) != std::string::npos); // Check found
+ } else {
+ BOOST_CHECK(str_rips_persistence.find(value3) == std::string::npos); // Check not found
+ BOOST_CHECK(str_rips_persistence.find(value4) == std::string::npos); // Check not found
+ BOOST_CHECK(str_rips_persistence.find(value5) == std::string::npos); // Check not found
+ BOOST_CHECK(str_rips_persistence.find(value6) == std::string::npos); // Check not found
+ BOOST_CHECK(str_rips_persistence.find(value7) == std::string::npos); // Check not found
+ }
- str_rips_persistence = test_rips_persistence(min_dimension, max_dimension, std::numeric_limits<int>::max());
-
- BOOST_CHECK(str_rips_persistence.find(value0) != std::string::npos); // Check found
- BOOST_CHECK(str_rips_persistence.find(value1) != std::string::npos); // Check found
- BOOST_CHECK(str_rips_persistence.find(value2) != std::string::npos); // Check found
- BOOST_CHECK(str_rips_persistence.find(value3) != std::string::npos); // Check found
- std::cout << "str_rips_persistence=" << str_rips_persistence << std::endl;
}
-BOOST_AUTO_TEST_CASE( rips_persistent_cohomology_multi_field_dim_1_2 )
-{
- test_rips_persistence_in_dimension(1, 2);
+BOOST_AUTO_TEST_CASE(rips_persistent_cohomology_multi_field_dim_1_2) {
+ test_rips_persistence_in_dimension(0, 1);
}
-BOOST_AUTO_TEST_CASE( rips_persistent_cohomology_multi_field_dim_2_3 )
-{
- test_rips_persistence_in_dimension(2, 3);
+BOOST_AUTO_TEST_CASE(rips_persistent_cohomology_multi_field_dim_2_3) {
+ test_rips_persistence_in_dimension(1, 3);
}
-BOOST_AUTO_TEST_CASE( rips_persistent_cohomology_multi_field_dim_1_5 )
-{
+BOOST_AUTO_TEST_CASE(rips_persistent_cohomology_multi_field_dim_1_5) {
test_rips_persistence_in_dimension(1, 5);
}
diff --git a/src/Persistent_cohomology/test/simplex_tree_file_for_multi_field_unit_test.txt b/src/Persistent_cohomology/test/simplex_tree_file_for_multi_field_unit_test.txt
new file mode 100644
index 00000000..ed2c0c3d
--- /dev/null
+++ b/src/Persistent_cohomology/test/simplex_tree_file_for_multi_field_unit_test.txt
@@ -0,0 +1,58 @@
+0 0 0.2
+0 3 0.2
+1 3 0 0.2
+0 6 0.2
+0 11 0.2
+1 11 6 0.2
+0 13 0.25
+0 14 0.25
+1 14 13 0.25
+0 15 0.25
+1 15 13 0.25
+1 15 14 0.25
+2 15 14 13 0.25
+0 1 0.3
+1 1 0 0.3
+0 2 0.3
+1 2 0 0.3
+1 2 1 0.3
+2 2 1 0 0.3
+0 4 0.3
+1 4 3 0.3
+0 5 0.3
+1 5 3 0.3
+1 5 4 0.3
+2 5 4 3 0.3
+0 9 0.3
+0 10 0.3
+1 10 2 0.3
+1 10 9 0.3
+1 11 9 0.3
+1 11 10 0.3
+2 11 10 9 0.3
+0 12 0.3
+1 12 2 0.3
+1 12 10 0.3
+2 12 10 2 0.3
+1 6 0 0.4
+1 6 1 0.4
+2 6 1 0 0.4
+0 7 0.4
+1 7 0 0.4
+1 7 1 0.4
+2 7 1 0 0.4
+1 7 6 0.4
+2 7 6 0 0.4
+2 7 6 1 0.4
+3 7 6 1 0 0.4
+0 8 0.4
+1 8 4 0.4
+1 8 5 0.4
+2 8 5 4 0.4
+1 9 4 0.4
+1 9 5 0.4
+2 9 5 4 0.4
+1 9 8 0.4
+2 9 8 4 0.4
+2 9 8 5 0.4
+3 9 8 5 4 0.4
diff --git a/src/Persistent_cohomology/test/simplex_tree_file_for_multi_field_unit_test.txt.REMOVED.git-id b/src/Persistent_cohomology/test/simplex_tree_file_for_multi_field_unit_test.txt.REMOVED.git-id
deleted file mode 100644
index 2dd38515..00000000
--- a/src/Persistent_cohomology/test/simplex_tree_file_for_multi_field_unit_test.txt.REMOVED.git-id
+++ /dev/null
@@ -1 +0,0 @@
-ce87199d425b05f51c74cbf635870bfa5abbc7a1 \ No newline at end of file