summaryrefslogtreecommitdiff
path: root/src/Gudhi_stat/test/persistence_lanscapes_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Gudhi_stat/test/persistence_lanscapes_test.cpp')
-rw-r--r--src/Gudhi_stat/test/persistence_lanscapes_test.cpp43
1 files changed, 27 insertions, 16 deletions
diff --git a/src/Gudhi_stat/test/persistence_lanscapes_test.cpp b/src/Gudhi_stat/test/persistence_lanscapes_test.cpp
index 9b9f9d7b..957ddbfb 100644
--- a/src/Gudhi_stat/test/persistence_lanscapes_test.cpp
+++ b/src/Gudhi_stat/test/persistence_lanscapes_test.cpp
@@ -43,18 +43,18 @@ double epsilon = 0.0000005;
BOOST_AUTO_TEST_CASE(check_construction_of_landscape)
{
- Persistence_landscape p( "data/file_with_diagram" );
-
+ std::vector< std::pair< double , double > > diag = read_standard_file( "data/file_with_diagram" );
+ Persistence_landscape p( diag );
Persistence_landscape q;
- q.load_landscape_from_file( "data/file_with_landscape_from_file_with_diagram" );
-
+ q.load_landscape_from_file( "data/file_with_landscape_from_file_with_diagram" );
BOOST_CHECK( p == q );
}
BOOST_AUTO_TEST_CASE(check_computations_of_integrals)
{
- Persistence_landscape p( "data/file_with_diagram" );
+ std::vector< std::pair< double , double > > diag = read_standard_file( "data/file_with_diagram" );
+ Persistence_landscape p( diag );
double integral = p.compute_integral_of_landscape();
//cerr << integral << " " << 2.34992 << endl;
BOOST_CHECK( fabs( integral - 2.34992 ) <= 0.00001 );
@@ -63,7 +63,8 @@ BOOST_AUTO_TEST_CASE(check_computations_of_integrals)
BOOST_AUTO_TEST_CASE(check_computations_of_integrals_for_each_level_separatelly)
{
- Persistence_landscape p( "data/file_with_diagram" );
+ std::vector< std::pair< double , double > > diag = read_standard_file( "data/file_with_diagram" );
+ Persistence_landscape p( diag );
std::vector< double > integrals_fir_different_levels;
integrals_fir_different_levels.push_back( 0.216432 );
@@ -106,7 +107,8 @@ BOOST_AUTO_TEST_CASE(check_computations_of_integrals_for_each_level_separatelly)
BOOST_AUTO_TEST_CASE(check_computations_of_integrals_of_powers_of_landscape)
{
- Persistence_landscape p( "data/file_with_diagram" );
+ std::vector< std::pair< double , double > > diag = read_standard_file( "data/file_with_diagram" );
+ Persistence_landscape p( diag );
std::vector<double> integrals_fir_different_powers;
integrals_fir_different_powers.push_back( 17.1692 );
@@ -124,7 +126,8 @@ BOOST_AUTO_TEST_CASE(check_computations_of_integrals_of_powers_of_landscape)
BOOST_AUTO_TEST_CASE(check_computations_of_values_on_different_points)
{
- Persistence_landscape p( "data/file_with_diagram" );
+ std::vector< std::pair< double , double > > diag = read_standard_file( "data/file_with_diagram" );
+ Persistence_landscape p( diag );
BOOST_CHECK( fabs( p.compute_value_at_a_given_point(1,0.0) ) <= 0.00001 );
@@ -144,7 +147,8 @@ BOOST_AUTO_TEST_CASE(check_computations_of_values_on_different_points)
BOOST_AUTO_TEST_CASE(check_computations_sum_differences_and_multiplications)
{
- Persistence_landscape p( "data/file_with_diagram" );
+ std::vector< std::pair< double , double > > diag = read_standard_file( "data/file_with_diagram" );
+ Persistence_landscape p( diag );
Persistence_landscape second;
second.load_landscape_from_file("data/file_with_landscape_from_file_with_diagram_1" );
@@ -171,7 +175,8 @@ BOOST_AUTO_TEST_CASE(check_computations_sum_differences_and_multiplications)
BOOST_AUTO_TEST_CASE(check_computations_of_maxima_and_norms)
{
- Persistence_landscape p( "data/file_with_diagram" );
+ std::vector< std::pair< double , double > > diag = read_standard_file( "data/file_with_diagram" );
+ Persistence_landscape p( diag );
Persistence_landscape second;
second.load_landscape_from_file("data/file_with_landscape_from_file_with_diagram_1" );
Persistence_landscape sum = p + second;
@@ -187,8 +192,10 @@ BOOST_AUTO_TEST_CASE(check_computations_of_maxima_and_norms)
BOOST_AUTO_TEST_CASE(check_computations_of_averages)
{
- Persistence_landscape p( "data/file_with_diagram" );
- Persistence_landscape q( "data/file_with_diagram_1" );
+ std::vector< std::pair< double , double > > diag = read_standard_file( "data/file_with_diagram" );
+ Persistence_landscape p( diag );
+ std::vector< std::pair< double , double > > diag2 = read_standard_file( "data/file_with_diagram_1" );
+ Persistence_landscape q( diag2 );
Persistence_landscape av;
av.compute_average( {&p,&q} );
@@ -202,8 +209,10 @@ BOOST_AUTO_TEST_CASE(check_computations_of_averages)
BOOST_AUTO_TEST_CASE(check_computations_of_distances)
{
- Persistence_landscape p( "data/file_with_diagram" );
- Persistence_landscape q( "data/file_with_diagram_1" );
+ std::vector< std::pair< double , double > > diag = read_standard_file( "data/file_with_diagram" );
+ Persistence_landscape p( diag );
+ std::vector< std::pair< double , double > > diag2 = read_standard_file( "data/file_with_diagram_1" );
+ Persistence_landscape q( diag2 );
BOOST_CHECK( fabs( p.distance( q )- 25.5824) <= 0.00005 );
BOOST_CHECK( fabs( p.distance( q , 2) - 2.12636 ) <= 0.00001 );
BOOST_CHECK( fabs( p.distance( q , std::numeric_limits<double>::max() )-0.359068 ) <= 0.00001 );
@@ -212,8 +221,10 @@ BOOST_AUTO_TEST_CASE(check_computations_of_distances)
BOOST_AUTO_TEST_CASE(check_computations_of_scalar_product)
{
- Persistence_landscape p( "data/file_with_diagram" );
- Persistence_landscape q( "data/file_with_diagram_1" );
+ std::vector< std::pair< double , double > > diag = read_standard_file( "data/file_with_diagram" );
+ Persistence_landscape p( diag );
+ std::vector< std::pair< double , double > > diag2 = read_standard_file( "data/file_with_diagram_1" );
+ Persistence_landscape q( diag2 );
BOOST_CHECK( fabs( p.compute_scalar_product( q ) - 0.754498 ) <= 0.00001 );
}