diff options
Diffstat (limited to 'src/Gudhi_stat/utilities')
-rw-r--r-- | src/Gudhi_stat/utilities/CMakeLists.txt | 53 | ||||
-rw-r--r-- | src/Gudhi_stat/utilities/Hausdorff_subsampling.cpp | 138 | ||||
-rw-r--r-- | src/Gudhi_stat/utilities/Landscape_bootstrap.cpp | 186 | ||||
-rw-r--r-- | src/Gudhi_stat/utilities/Multiplicative_bootstrap.cpp | 70 | ||||
-rw-r--r-- | src/Gudhi_stat/utilities/permutation_test.cpp | 84 | ||||
-rw-r--r-- | src/Gudhi_stat/utilities/sliding_window_embedding.cpp | 39 |
6 files changed, 0 insertions, 570 deletions
diff --git a/src/Gudhi_stat/utilities/CMakeLists.txt b/src/Gudhi_stat/utilities/CMakeLists.txt deleted file mode 100644 index 235d5d2e..00000000 --- a/src/Gudhi_stat/utilities/CMakeLists.txt +++ /dev/null @@ -1,53 +0,0 @@ -cmake_minimum_required(VERSION 2.6) -project(GUDHI_STAT) - - - -#some stat libraries: -add_executable ( permutation_test permutation_test.cpp ) -target_link_libraries(permutation_test ${Boost_SYSTEM_LIBRARY}) - -#add_executable ( topological_process topological_process.cpp ) -#target_link_libraries(topological_process ${Boost_SYSTEM_LIBRARY}) - -#add_executable ( topological_process_2 topological_process_2.cpp ) -#target_link_libraries(topological_process_2 ${Boost_SYSTEM_LIBRARY}) - -add_executable ( Hausdorff_subsampling Hausdorff_subsampling.cpp ) -if (TBB_FOUND) -target_link_libraries(Hausdorff_subsampling ${TBB_LIBRARIES}) -endif(TBB_FOUND) -target_link_libraries(Hausdorff_subsampling ${Boost_SYSTEM_LIBRARY}) - - -add_executable ( Landscape_bootstrap Landscape_bootstrap.cpp ) -if (TBB_FOUND) -target_link_libraries(Landscape_bootstrap ${TBB_LIBRARIES}) -endif(TBB_FOUND) -target_link_libraries(Landscape_bootstrap ${Boost_SYSTEM_LIBRARY}) - - -add_executable ( Multiplicative_bootstrap Multiplicative_bootstrap.cpp ) -if (TBB_FOUND) -target_link_libraries(Multiplicative_bootstrap ${TBB_LIBRARIES}) -endif(TBB_FOUND) -target_link_libraries(Multiplicative_bootstrap ${Boost_SYSTEM_LIBRARY}) - - - - -#just for Pawel's tests: -#add_executable ( NN_classification NN_classification.cpp ) -#target_link_libraries(NN_classification ${Boost_SYSTEM_LIBRARY}) -# -#add_executable ( compute_distance_between_vectors compute_distance_between_vectors.cpp ) -#target_link_libraries(compute_distance_between_vectors ${Boost_SYSTEM_LIBRARY}) - - -if(CGAL_FOUND) - add_executable ( sliding_window_embedding sliding_window_embedding.cpp ) - target_link_libraries(sliding_window_embedding ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY}) - if (TBB_FOUND) - target_link_libraries(sliding_window_embedding ${TBB_LIBRARIES}) - endif(TBB_FOUND) -endif(CGAL_FOUND) diff --git a/src/Gudhi_stat/utilities/Hausdorff_subsampling.cpp b/src/Gudhi_stat/utilities/Hausdorff_subsampling.cpp deleted file mode 100644 index 44de1029..00000000 --- a/src/Gudhi_stat/utilities/Hausdorff_subsampling.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* This file is part of the Gudhi Library. The Gudhi library - * (Geometric Understanding in Higher Dimensions) is a generic C++ - * library for computational topology. - * - * Author(s): Pawel Dlotko - * - * Copyright (C) 2015 INRIA (France) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - - -#include <gudhi/Hausdorff_distances.h> -#include <gudhi/bootstrap.h> -#include <gudhi/read_persistence_from_file.h> -#include <gudhi/persistence_vectors.h> - - -using namespace Gudhi; -using namespace Gudhi::Persistence_representations; -using namespace Gudhi::Gudhi_stat; - - - -int main( int argc , char** argv ) -{ - std::cout << "The parameters of this program are : " << std::endl; - std::cout << "(a) a name of a file with points," << std:: endl; - std::cout << "(b) a number of repetitions of bootstrap (integer)," << std::endl; - std::cout << "(c) a size of subsample (integer, smaller than the number of points," << std::endl; - std::cout << "(d) a quantile (real number between 0 and 1. If you do not know what to set, set it to 0.95." << std::endl; - if ( argc != 5 ) - { - std::cerr << "Wrong number of parameters, the program will now terminate.\n"; - return 1; - } - - const char* filename = argv[1]; - size_t number_of_repetitions_of_subsampling = (size_t)atoi( argv[2] ); - size_t size_of_subsample = (size_t)atoi( argv[3] ); - double quantile = atof( argv[4] ); - - std::cout << "Now we will read points from the file : " << filename << " and then perform " << number_of_repetitions_of_subsampling << " times the subsampling on it by choosing subsample of a size " << size_of_subsample << std::endl; - - std::vector< std::vector< double > > points = read_numbers_from_file_line_by_line( filename ); - /* - std::vector< std::vector< double > > points; - std::vector< double > point1(2); - point1[0] = -1; - point1[1] = 0; - std::vector< double > point2(2); - point2[0] = 1; - point2[1] = 0; - std::vector< double > point3(2); - point3[0] = -1; - point3[1] = 3; - std::vector< double > point4(2); - point4[0] = 1; - point4[1] = 3; - points.push_back( point1 ); - points.push_back( point2 ); - points.push_back( point3 ); - points.push_back( point4 ); - size_of_subsample = 2; - */ -// std::vector< std::vector<double> > all_to_all_distance_matrix_between_points = compute_all_to_all_distance_matrix_between_points< std::vector<double> , Euclidean_distance >( points ); -// Hausdorff_distance_between_subspace_and_the_whole_metric_space distance( all_to_all_distance_matrix_between_points ); - - - std::cout << "Read : " << points.size() << " points.\n"; - - //comute all-to-all distance matrix: - std::vector< std::vector<double> > all_to_all_distance_matrix_between_points = compute_all_to_all_distance_matrix_between_points< std::vector<double> , Euclidean_distance >( points ); - Hausdorff_distance_between_subspace_and_the_whole_metric_space distance( all_to_all_distance_matrix_between_points ); - identity< std::vector<size_t> > identity_char; - - - double max = -1; - for ( size_t i = 0 ; i != all_to_all_distance_matrix_between_points.size() ; ++i ) - { - double min = 10000000; - for ( size_t j = 0 ; j != all_to_all_distance_matrix_between_points.size() ; ++j ) - { - double distance = 0; - if ( i > j ) - { - distance = all_to_all_distance_matrix_between_points[i][j]; - } - else - { - if ( i < j )distance = all_to_all_distance_matrix_between_points[j][i]; - } - if ( (distance < min)&&(distance != 0) )min = distance; - } - std::cerr << "min : " << min << std::endl; - //getchar(); - if ( min > max )max = min; - } - std::cerr << "Max element in distance matrix : " << max << std::endl; - getchar(); - -// std::vector<size_t> characteristic_of_all_points = {0,1,2,3}; -// std::vector<size_t> characteristic_of_subsampled_points = {2,3}; -// std::cerr << "DISTANCE BETWEEN SAMPLE AND SUBSAMPLE: " << distance( characteristic_of_subsampled_points , characteristic_of_all_points ) << std::endl; - - - - - - //and now we can run the real bootstrap. - //template < typename PointCloudCharacteristics , typename CharacteristicFunction , typename DistanceBetweenPointsCharacteristics > - //In this case, the PointCloudCharacteristics is just a vector of numbers of points (in a order fixed on points vector). - //CharacteristicFunction is just identity, transforming std::vector< size_t > to itself. - //DistanceBetweenPointsCharacteristics is the place were all happens. This class have the information about the coordinates of the points, and allows to compute a Hausdorff distance between - //the collection of all points, and the subsample. - double result = bootstrap< - std::vector< size_t > , //PointCloudCharacteristics - identity< std::vector<size_t> > , //CharacteristicFunction - Hausdorff_distance_between_subspace_and_the_whole_metric_space //DistanceBetweenPointsCharacteristics. This function have the information about point's coordinates. - > - ( points.size() , identity_char , distance , number_of_repetitions_of_subsampling , size_of_subsample , quantile ); - - std::cout << "result of the subsampling : " << 2*result << std::endl; - - - return 0; -} diff --git a/src/Gudhi_stat/utilities/Landscape_bootstrap.cpp b/src/Gudhi_stat/utilities/Landscape_bootstrap.cpp deleted file mode 100644 index a2ca93a9..00000000 --- a/src/Gudhi_stat/utilities/Landscape_bootstrap.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/* This file is part of the Gudhi Library. The Gudhi library - * (Geometric Understanding in Higher Dimensions) is a generic C++ - * library for computational topology. - * - * Author(s): Pawel Dlotko - * - * Copyright (C) 2015 INRIA (France) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -//stat part: -#include <gudhi/Hausdorff_distances.h> -#include <gudhi/bootstrap.h> -#include <gudhi/Persistence_landscape.h> -#include <gudhi/read_persistence_from_file.h> -#include <gudhi/persistence_vectors.h> -//persistence part: -#include <gudhi/reader_utils.h> -#include <gudhi/Rips_complex.h> -#include <gudhi/distance_functions.h> -#include <gudhi/Simplex_tree.h> -#include <gudhi/Persistent_cohomology.h> - - -using namespace Gudhi::Gudhi_stat; -using namespace Gudhi::Persistence_representations; -using Persistence_landscape = Gudhi::Persistence_representations::Persistence_landscape; - -typedef int Vertex_handle; -//typedef double Filtration_value; - - -//if this variable is -1, then the infinite interals are ignored. If not, they infinite values are replaced with what_to_replace_infinite_intervals_with: -double what_to_replace_infinite_intervals_with = -1; - - - -class compute_persistence_landscape_of_a_point_cloud_in_certain_dimension -{ -public: - compute_persistence_landscape_of_a_point_cloud_in_certain_dimension( std::vector< std::vector< double > >& points_ , int dimension , double threshold_ , int coeficient_field_ = 11 , double min_persistence_ = 0 ):dim( dimension ),points(points_),threshold(threshold_),coeficient_field(coeficient_field_),min_persistence(min_persistence_){} - //This function takes a vector of indices (numbers_to_sample). It will select the points from this->points having those indices, construct Rips complex and persistence intervals based on this. - //Then it will filter the intervals to find only those in the dimension this->dim, and construct a persistence landascape based on this. Thie will be the result of the procedure. - Persistence_landscape operator()( std::vector< size_t > numbers_to_sample ) - { - bool dbg = false; - //take the subsampled points: - std::vector< std::vector< double > > points_in_subsample; - points_in_subsample.reserve( numbers_to_sample.size() ); - for ( size_t i = 0 ; i != numbers_to_sample.size() ; ++i ) - { - points_in_subsample.push_back( this->points[ numbers_to_sample[i] ] ); - } - - using Stree = Gudhi::Simplex_tree<Gudhi::Simplex_tree_options_fast_persistence>; - using Filtration_value = Stree::Filtration_value; - using Rips_complex = Gudhi::rips_complex::Rips_complex<Filtration_value>; - //construct a Rips complex based on it and compute its persistence: - Rips_complex rips_complex(points_in_subsample, this->threshold, Euclidean_distance()); - // Construct the Rips complex in a Simplex Tree - Stree st; - // expand the graph until dimension dim_max - rips_complex.create_complex(st, this->dim + 1); - // Compute the persistence diagram of the complex - Gudhi::persistent_cohomology::Persistent_cohomology<Stree, Gudhi::persistent_cohomology::Field_Zp > pcoh(st); - // initializes the coefficient field for homology - pcoh.init_coefficients( this->coeficient_field ); - pcoh.compute_persistent_cohomology(this->min_persistence); - auto persistence_pairs = pcoh.get_persistent_pairs(); - //From the persistence take only this in the dimension this->dim: - - if ( dbg )std::cerr << "Here are the persistence pairs :\n"; - std::vector< std::pair< double,double > > persistence_in_fixed_dimension; - for ( size_t i = 0 ; i != persistence_pairs.size() ; ++i ) - { - if ( st.dimension( std::get<0>(persistence_pairs[i]) ) == this->dim ) - { - double birth = st.filtration( std::get<0>(persistence_pairs[i]) ); - double death = st.filtration( std::get<1>(persistence_pairs[i]) ); - - if ( std::get<1>(persistence_pairs[i]) != st.null_simplex() ) - { - //finite interval - persistence_in_fixed_dimension.push_back( std::pair<double,double>( birth , death ) ); - if (dbg){std::cout << "birth : " << birth << " , death : " << death << std::endl;} - } - else - { - //infinite interval - if ( what_to_replace_infinite_intervals_with != -1 ) - { - persistence_in_fixed_dimension.push_back( std::pair<double,double>( birth , what_to_replace_infinite_intervals_with ) ); - if (dbg){std::cout << "birth : " << birth << " , death : " << what_to_replace_infinite_intervals_with << std::endl;} - } - } - } - } - if ( dbg )std::cerr << "Persistence pairs computed \n"; - //Construct and return the persistence landscape: - return Persistence_landscape( persistence_in_fixed_dimension ); - } -private: - int dim; - std::vector< std::vector< double > >& points; - double threshold; - int coeficient_field; - double min_persistence; -}; - -class distance_between_landscapes -{ -public: - distance_between_landscapes( double exponent_ ):exponent(exponent_){} - double operator()( const Persistence_landscape& first , const Persistence_landscape& second ) - { - return first.distance( second, this->exponent ); - } -private: - double exponent; -}; - - -int main( int argc , char** argv ) -{ - std::cout << "The parameters of this program are : " << std::endl; - std::cout << "(1) a name of a file with points," << std:: endl; - std::cout << "(2) a number of repetitions of bootstrap (integer)," << std::endl; - std::cout << "(3) a size of subsample (integer, smaller than the number of points. " << std::endl; - std::cout << "(4) An real value p such that L^p distance is going to be computed. \n"; - std::cout << "(5) A dimension of persistence that is to be taken into account (positive integer) \n"; - std::cout << "(6) A maximal diameter to which complex is to be grown (positive integer) \n"; - std::cout << "(d) a quantile (real number between 0 and 1. If you do not know what to set, set it to 0.95." << std::endl; - if ( argc != 8 ) - { - std::cerr << "Wrong number of parameters, the program will now terminate.\n"; - return 1; - } - - const char* filename = argv[1]; - size_t number_of_repetitions_of_bootstrap = (size_t)atoi( argv[2] ); - size_t size_of_subsample = (size_t)atoi( argv[3] ); - double p = atoi( argv[4] ); - int dimension = atoi( argv[5] ); - double threshold = atof( argv[6] ); - double quantile = atof( argv[7] ); - - std::cout << "Now we will read points from the file : " << filename << " and then perform " << number_of_repetitions_of_bootstrap << " times the bootstrap on it by choosing subsample of a size " << size_of_subsample << std::endl; - - std::vector< std::vector< double > > points = Gudhi::Persistence_representations::read_numbers_from_file_line_by_line( filename ); - - std::cout << "Read : " << points.size() << " points.\n"; - - distance_between_landscapes distance( p );//L^p distance. - compute_persistence_landscape_of_a_point_cloud_in_certain_dimension characteristic_fun( points , dimension , threshold ); - - //and now we can run the real bootstrap. - //template < typename PointCloudCharacteristics , typename CharacteristicFunction , typename DistanceBetweenPointsCharacteristics > - //In this case, the PointCloudCharacteristics is just a vector of numbers of points (in a order fixed on points vector). - //CharacteristicFunction is just identity, transforming std::vector< size_t > to itself. - //DistanceBetweenPointsCharacteristics is the place were all happens. This class hace the information about the coordinates of the points, and allows to compute a Hausdorff distance between - //the collection of all points, and the subsample. - double result = Gudhi::Gudhi_stat::bootstrap< - Persistence_landscape , //PointCloudCharacteristics, persistence landascapes constructed based on vector of - //pairs of birth--death values in a cartain dimension. - compute_persistence_landscape_of_a_point_cloud_in_certain_dimension , //CharacteristicFunction, in this case, we will need to compute persistence in a certain dimension. - distance_between_landscapes //DistanceBetweenPointsCharacteristics. In this case - > - ( points.size() , characteristic_fun , distance , number_of_repetitions_of_bootstrap , size_of_subsample , quantile ); - - std::cout << "result of bootstrap : " << result << std::endl; - - - return 0; -} diff --git a/src/Gudhi_stat/utilities/Multiplicative_bootstrap.cpp b/src/Gudhi_stat/utilities/Multiplicative_bootstrap.cpp deleted file mode 100644 index 8949fba1..00000000 --- a/src/Gudhi_stat/utilities/Multiplicative_bootstrap.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* This file is part of the Gudhi Library. The Gudhi library - * (Geometric Understanding in Higher Dimensions) is a generic C++ - * library for computational topology. - * - * Author(s): Pawel Dlotko - * - * Copyright (C) 2015 INRIA (France) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - - -#include <gudhi/Hausdorff_distances.h> -#include <gudhi/multiplicative_bootstrap.h> -#include <gudhi/read_persistence_from_file.h> -#include <gudhi/persistence_vectors.h> - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; -using namespace Gudhi::Persistence_representations; - - - -int main( int argc , char** argv ) -{ - std::cout << "The parameters of this program are : " << std::endl; - std::cout << "(a) a name of a file with names of files with persistence diagrams," << std:: endl; - std::cout << "(b) a number of repetitions of bootstrap (integer)," << std::endl; - std::cout << "(c) a quantile (real number between 0 and 1. If you do not know what to set, set it to 0.95." << std::endl; - if ( argc != 4 ) - { - std::cerr << "Wrong number of parameters, the program will now terminate.\n"; - return 1; - } - - const char* file_with_filenames = argv[1]; - size_t number_of_repetitions_of_bootstrap = (size_t)atoi( argv[2] ); - double quantile = atof( argv[3] ); - - std::vector< std::string > filenames = readFileNames( file_with_filenames ); - std::vector< Persistence_landscape* > collection_of_landscapes( filenames.size() ); - for ( size_t i = 0 ; i != filenames.size() ; ++i ) - { - std::vector< std::pair< double , double > > diag = read_persistence_intervals_in_one_dimension_from_file( filenames[i].c_str() ); - collection_of_landscapes[i] = new Persistence_landscape( diag ); - } - - //now we can run the bootstrap: - difference_of_objects<Persistence_landscape> diff; - norm_of_objects<Persistence_landscape> norm; - - double result = - multiplicative_bootstrap< Persistence_landscape , difference_of_objects<Persistence_landscape> , norm_of_objects<Persistence_landscape> > - ( collection_of_landscapes , number_of_repetitions_of_bootstrap , diff , norm , quantile , 1 ); - - std::cout << "result of bootstrap : " << result << std::endl; - return 0; -} - diff --git a/src/Gudhi_stat/utilities/permutation_test.cpp b/src/Gudhi_stat/utilities/permutation_test.cpp deleted file mode 100644 index e974b311..00000000 --- a/src/Gudhi_stat/utilities/permutation_test.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* This file is part of the Gudhi Library. The Gudhi library - * (Geometric Understanding in Higher Dimensions) is a generic C++ - * library for computational topology. - * - * Author(s): Pawel Dlotko - * - * Copyright (C) 2015 INRIA (France) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - - -#include <gudhi/permutation_test.h> -#include <gudhi/Persistence_landscape.h> -#include <iostream> -#include <cstring> - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; -using namespace Gudhi::Persistence_representations; - -int main( int argc , char** argv ) -{ - - std::cout << "This program require the following parameters: \n"; - std::cout << "(1-2) Names of files each of them contains the names of files with persistence diagrams. The diagrams from a single file are assumed to be in the same group \n"; - std::cout << "Third parameter is an integer being the number of permutations to be made \n"; - std::cout << "The last parameter is a double, the power of a distance \n"; - if ( argc != 5 ) - { - std::cout << "Wrong number of parameters, the program will now terminat \n"; - return 1; - } - std::cout << "We will now read the data from files : " << argv[1] << " and " << argv[2] << std::endl; - size_t number_of_permutations = (size_t)(atoi(argv[3])); - size_t exponent = (double)atof( argv[4] ); - - std::vector< std::string > first_group = readFileNames( argv[1] ); - std::vector< std::string > second_group =readFileNames( argv[2] ); - - std::cout << "Here are the filenames in the first group :\n"; - for ( size_t i = 0 ; i != first_group.size() ; ++i ) - { - std::cout << first_group[i] << std::endl; - } - std::cout << "Here are the filenames in the second group :\n"; - for ( size_t i = 0 ; i != second_group.size() ; ++i ) - { - std::cout << second_group[i] << std::endl; - } - - std::vector< Persistence_landscape* > first_collection( first_group.size() ); - for ( size_t i = 0 ; i != first_group.size() ; ++i ) - { - std::vector< std::pair< double , double > > diag = read_persistence_intervals_in_one_dimension_from_file( first_group[i].c_str() ); - Persistence_landscape* l = new Persistence_landscape( diag ); - first_collection[i] = l; - } - - std::vector< Persistence_landscape* > second_collection( second_group.size() ); - for ( size_t i = 0 ; i != second_group.size() ; ++i ) - { - std::vector< std::pair< double , double > > diag = read_standard_persistence_file( second_group[i].c_str() ); - Persistence_landscape* l = new Persistence_landscape( diag ); - second_collection[i] = l; - } - - std::cout << "The p-value form a permutation test is : " << permutation_test<Persistence_landscape>( first_collection , second_collection , number_of_permutations , exponent ) << std::endl; - - - - return 0; -} diff --git a/src/Gudhi_stat/utilities/sliding_window_embedding.cpp b/src/Gudhi_stat/utilities/sliding_window_embedding.cpp deleted file mode 100644 index 84e8f827..00000000 --- a/src/Gudhi_stat/utilities/sliding_window_embedding.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include <iostream> -#include <fstream> -#include <vector> -#include <string> -#include <sstream> -#include <cstdlib> -#include <sys/stat.h> -#include <string> - -#include <gudhi/time_series_analysis/sliding_window.h> - -using namespace Gudhi; -using namespace Gudhi_stat; - - -int main( int argc , char** argv ) -{ - //this array contains value of sin(x_n) for x_0 = 0 and x_{n+1} = _{n} + 0.1 for n \in {0,115-23}. - static const double arr[] = {0, 0.0998334166, 0.1986693308, 0.2955202067, 0.3894183423, 0.4794255386, 0.5646424734, 0.6442176872, 0.7173560909, 0.7833269096, 0.8414709848, 0.8912073601, 0.932039086, 0.9635581854, 0.98544973, - 0.9974949866, 0.999573603, 0.9916648105, 0.9738476309, 0.9463000877, 0.9092974268, 0.8632093666, 0.8084964038, 0.7457052122, 0.6754631806, 0.5984721441, 0.5155013718, 0.4273798802, 0.3349881502, - 0.2392493292, 0.1411200081, 0.0415806624, -0.0583741434, -0.1577456941, -0.255541102, -0.3507832277, -0.4425204433, -0.5298361409, -0.6118578909, -0.6877661592, -0.7568024953, -0.8182771111, -0.8715757724, - -0.9161659367, -0.9516020739, -0.9775301177, -0.9936910036, -0.9999232576, -0.9961646088, -0.9824526126, -0.9589242747, -0.9258146823, -0.8834546557, -0.8322674422, -0.7727644876, -0.7055403256, - -0.6312666379, -0.5506855426, -0.4646021794, -0.3738766648, -0.2794154982, -0.1821625043, -0.0830894028, 0.0168139005, 0.1165492049, 0.2151199881, 0.3115413635, 0.4048499206, 0.4941133511, 0.5784397644, - 0.6569865987, 0.7289690401, 0.7936678638, 0.8504366206, 0.8987080958, 0.9379999768, 0.967919672, 0.9881682339, 0.9985433454, 0.9989413418, 0.9893582466, 0.9698898108, 0.9407305567, 0.9021718338, 0.8545989081, - 0.7984871126, 0.7343970979, 0.6629692301, 0.5849171929, 0.5010208565, 0.4121184852, 0.3190983623, 0.2228899141, 0.1244544235, 0.0247754255, -0.0751511205, -0.1743267812, -0.2717606264, -0.3664791293, - -0.4575358938, -0.5440211109, -0.6250706489, -0.6998746876, -0.7676858098, -0.8278264691, -0.87969576, -0.9227754216, -0.9566350163, -0.9809362301, -0.9954362533, -0.9999902066, -0.9945525882, -0.9791777292, - -0.9540192499, -0.9193285257, -0.8754521747}; - vector< double > time_series (arr, arr + sizeof(arr) / sizeof(arr[0]) ); - - //construct sliding window embeddign to dimension 3 based on time_series: - Sliding_window_embedding swe( time_series , 3 ); - swe.create_point_cloud("pt_cloud"); - - //persistent_cohomology::Persistent_cohomology<ST, Field_Zp >& a = - swe.compute_persistence_of_Vietoris_Rips_complex( 1 , 2 ); - - - return 0; -} |