diff options
Diffstat (limited to 'src/Persistence_representations/utilities/persistence_heat_maps')
10 files changed, 47 insertions, 50 deletions
diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt index c90c637d..4ad924cb 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt +++ b/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt @@ -1,11 +1,10 @@ cmake_minimum_required(VERSION 2.6) -project(GUDHI_STAT) +project(Persistence_representations_heat_maps_utilities) #persitence heat maps add_executable ( create_persistence_heat_maps create_persistence_heat_maps.cpp ) target_link_libraries(create_persistence_heat_maps ${Boost_SYSTEM_LIBRARY}) -#add_test ( create_persistence_heat_maps ${CMAKE_CURRENT_BINARY_DIR}/create_persistence_heat_maps 10 -1 -1 4 -1 simple_diagram.txt ) add_test ( create_persistence_heat_maps ${CMAKE_CURRENT_BINARY_DIR}/create_persistence_heat_maps 10 -1 -1 4 -1 "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" ) add_executable ( create_pssk create_pssk.cpp ) diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp b/src/Persistence_representations/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp index b4e2be89..4e81375a 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp +++ b/src/Persistence_representations/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp @@ -22,12 +22,12 @@ #include <gudhi/Persistence_heat_maps.h> -using namespace Gudhi; -using namespace Gudhi::Persistence_representations; - #include <iostream> #include <vector> +using constant_scaling_function = Gudhi::Persistence_representations::constant_scaling_function; +using Persistence_heat_maps = Gudhi::Persistence_representations::Persistence_heat_maps<constant_scaling_function>; + int main(int argc, char** argv) { std::cout << "This program computes average persistence landscape of persistence landscapes created based on " "persistence diagrams provided as an input. Please call this program with the names of files with " @@ -44,14 +44,14 @@ int main(int argc, char** argv) { } std::cout << "Creating persistence landscapes...\n"; - std::vector<Persistence_heat_maps<constant_scaling_function>*> maps; + std::vector<Persistence_heat_maps*> maps; for (size_t i = 0; i != filenames.size(); ++i) { - Persistence_heat_maps<constant_scaling_function>* l = new Persistence_heat_maps<constant_scaling_function>; + Persistence_heat_maps* l = new Persistence_heat_maps; l->load_from_file(filenames[i]); maps.push_back(l); } - Persistence_heat_maps<constant_scaling_function> av; + Persistence_heat_maps av; av.compute_average(maps); av.print_to_file("average.mps"); diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp b/src/Persistence_representations/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp index 56b2d336..a9e8821f 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp +++ b/src/Persistence_representations/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp @@ -22,14 +22,14 @@ #include <gudhi/Persistence_heat_maps.h> -using namespace Gudhi; -using namespace Gudhi::Persistence_representations; - #include <iostream> #include <sstream> #include <limits> #include <vector> +using constant_scaling_function = Gudhi::Persistence_representations::constant_scaling_function; +using Persistence_heat_maps = Gudhi::Persistence_representations::Persistence_heat_maps<constant_scaling_function>; + int main(int argc, char** argv) { std::cout << "This program compute distance of persistence heat maps stored in a file (the file needs to be created " "beforehand). \n"; @@ -52,10 +52,10 @@ int main(int argc, char** argv) { for (int i = 2; i < argc; ++i) { filenames.push_back(argv[i]); } - std::vector<Persistence_heat_maps<constant_scaling_function> > maps; + std::vector<Persistence_heat_maps> maps; maps.reserve(filenames.size()); for (size_t file_no = 0; file_no != filenames.size(); ++file_no) { - Persistence_heat_maps<constant_scaling_function> l; + Persistence_heat_maps l; l.load_from_file(filenames[file_no]); maps.push_back(l); } diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp b/src/Persistence_representations/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp index ec9482f0..1cee1f82 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp +++ b/src/Persistence_representations/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp @@ -22,13 +22,13 @@ #include <gudhi/Persistence_heat_maps.h> -using namespace Gudhi; -using namespace Gudhi::Persistence_representations; - #include <iostream> #include <sstream> #include <vector> +using constant_scaling_function = Gudhi::Persistence_representations::constant_scaling_function; +using Persistence_heat_maps = Gudhi::Persistence_representations::Persistence_heat_maps<constant_scaling_function>; + int main(int argc, char** argv) { std::cout << "This program compute scalar product of persistence landscapes stored in a file (the file needs to be " "created beforehand). \n"; @@ -38,10 +38,10 @@ int main(int argc, char** argv) { for (int i = 1; i < argc; ++i) { filenames.push_back(argv[i]); } - std::vector<Persistence_heat_maps<constant_scaling_function> > maps; + std::vector<Persistence_heat_maps> maps; maps.reserve(filenames.size()); for (size_t file_no = 0; file_no != filenames.size(); ++file_no) { - Persistence_heat_maps<constant_scaling_function> l; + Persistence_heat_maps l; l.load_from_file(filenames[file_no]); maps.push_back(l); } diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_arctan_of_their_persistence.cpp b/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_arctan_of_their_persistence.cpp index 68c75059..2bf185a3 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_arctan_of_their_persistence.cpp +++ b/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_arctan_of_their_persistence.cpp @@ -22,14 +22,15 @@ #include <gudhi/Persistence_heat_maps.h> -using namespace Gudhi; -using namespace Gudhi::Persistence_representations; - #include <iostream> #include <sstream> #include <limits> #include <vector> +using arc_tan_of_persistence_of_point = Gudhi::Persistence_representations::arc_tan_of_persistence_of_point; +using Persistence_heat_maps = + Gudhi::Persistence_representations::Persistence_heat_maps<arc_tan_of_persistence_of_point>; + int main(int argc, char** argv) { std::cout << "This program creates persistence heat map of diagrams provided as an input. The Gaussian kernels are " "weighted by the arc tangential of their persistence.\n"; @@ -68,12 +69,11 @@ int main(int argc, char** argv) { } std::cout << "Creating persistence heat maps...\n"; - std::vector<std::vector<double> > filter = create_Gaussian_filter(stdiv, 1); + std::vector<std::vector<double> > filter = Gudhi::Persistence_representations::create_Gaussian_filter(stdiv, 1); for (size_t i = 0; i != filenames.size(); ++i) { std::cout << "Creating a heat map based on a file : " << filenames[i] << std::endl; - Persistence_heat_maps<arc_tan_of_persistence_of_point> l(filenames[i], filter, false, size_of_grid, min_, max_, - dimension); + Persistence_heat_maps l(filenames[i], filter, false, size_of_grid, min_, max_, dimension); std::stringstream ss; ss << filenames[i] << ".mps"; diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_distance_from_diagonal.cpp b/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_distance_from_diagonal.cpp index a56393a3..ec9477f1 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_distance_from_diagonal.cpp +++ b/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_distance_from_diagonal.cpp @@ -22,14 +22,15 @@ #include <gudhi/Persistence_heat_maps.h> -using namespace Gudhi; -using namespace Gudhi::Persistence_representations; - #include <iostream> #include <sstream> #include <limits> #include <vector> +using distance_from_diagonal_scaling = Gudhi::Persistence_representations::distance_from_diagonal_scaling; +using Persistence_heat_maps = + Gudhi::Persistence_representations::Persistence_heat_maps<distance_from_diagonal_scaling>; + int main(int argc, char** argv) { std::cout << "This program creates persistence heat map of diagrams provided as an input. The Gaussian kernels are " "weighted by the distance of a center from the diagonal.\n"; @@ -68,12 +69,11 @@ int main(int argc, char** argv) { } std::cout << "Creating persistence heat maps...\n"; - std::vector<std::vector<double> > filter = create_Gaussian_filter(stdiv, 1); + std::vector<std::vector<double> > filter = Gudhi::Persistence_representations::create_Gaussian_filter(stdiv, 1); for (size_t i = 0; i != filenames.size(); ++i) { std::cout << "Creating a heat map based on a file : " << filenames[i] << std::endl; - Persistence_heat_maps<distance_from_diagonal_scaling> l(filenames[i], filter, false, size_of_grid, min_, max_, - dimension); + Persistence_heat_maps l(filenames[i], filter, false, size_of_grid, min_, max_, dimension); std::stringstream ss; ss << filenames[i] << ".mps"; diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_squared_diag_distance.cpp b/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_squared_diag_distance.cpp index 44115329..cb7e282c 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_squared_diag_distance.cpp +++ b/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_squared_diag_distance.cpp @@ -22,14 +22,15 @@ #include <gudhi/Persistence_heat_maps.h> -using namespace Gudhi; -using namespace Gudhi::Persistence_representations; - #include <iostream> #include <sstream> #include <limits> #include <vector> +using squared_distance_from_diagonal_scaling = Gudhi::Persistence_representations::squared_distance_from_diagonal_scaling; +using Persistence_heat_maps = + Gudhi::Persistence_representations::Persistence_heat_maps<squared_distance_from_diagonal_scaling>; + int main(int argc, char** argv) { std::cout << "This program creates persistence heat map of diagrams provided as an input. The Gaussian kernels are " "weighted by the square of distance of a center from the diagonal.\n"; @@ -68,12 +69,11 @@ int main(int argc, char** argv) { } std::cout << "Creating persistence heat maps...\n"; - std::vector<std::vector<double> > filter = create_Gaussian_filter(stdiv, 1); + std::vector<std::vector<double> > filter = Gudhi::Persistence_representations::create_Gaussian_filter(stdiv, 1); for (size_t i = 0; i != filenames.size(); ++i) { std::cout << "Creating a heat map based on a file : " << filenames[i] << std::endl; - Persistence_heat_maps<squared_distance_from_diagonal_scaling> l(filenames[i], filter, false, size_of_grid, min_, - max_, dimension); + Persistence_heat_maps l(filenames[i], filter, false, size_of_grid, min_, max_, dimension); std::stringstream ss; ss << filenames[i] << ".mps"; diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp b/src/Persistence_representations/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp index ebc82f82..bd5ec89a 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp +++ b/src/Persistence_representations/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp @@ -22,14 +22,14 @@ #include <gudhi/Persistence_heat_maps.h> -using namespace Gudhi; -using namespace Gudhi::Persistence_representations; - #include <iostream> #include <sstream> #include <limits> #include <vector> +using constant_scaling_function = Gudhi::Persistence_representations::constant_scaling_function; +using Persistence_heat_maps = Gudhi::Persistence_representations::Persistence_heat_maps<constant_scaling_function>; + int main(int argc, char** argv) { std::cout << "This program creates persistence heat map of diagrams provided as an input.\n"; std::cout << "The first parameter of a program is an integer, a size of a grid.\n"; @@ -65,12 +65,11 @@ int main(int argc, char** argv) { } std::cout << "Creating persistence heat maps...\n"; - std::vector<std::vector<double> > filter = create_Gaussian_filter(stdiv, 1); + std::vector<std::vector<double> > filter = Gudhi::Persistence_representations::create_Gaussian_filter(stdiv, 1); for (size_t i = 0; i != filenames.size(); ++i) { std::cout << "Creating a heat map based on a file : " << filenames[i] << std::endl; - Persistence_heat_maps<constant_scaling_function> l(filenames[i], filter, false, size_of_grid, min_, max_, - dimension); + Persistence_heat_maps l(filenames[i], filter, false, size_of_grid, min_, max_, dimension); std::stringstream ss; ss << filenames[i] << ".mps"; diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/create_pssk.cpp b/src/Persistence_representations/utilities/persistence_heat_maps/create_pssk.cpp index 7b24bb7c..6aefbb00 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/create_pssk.cpp +++ b/src/Persistence_representations/utilities/persistence_heat_maps/create_pssk.cpp @@ -22,14 +22,13 @@ #include <gudhi/PSSK.h> -using namespace Gudhi; -using namespace Gudhi::Persistence_representations; - #include <iostream> #include <sstream> #include <limits> #include <vector> +using PSSK = Gudhi::Persistence_representations::PSSK; + int main(int argc, char** argv) { std::cout << "This program creates PSSK of diagrams provided as an input.\n"; std::cout << "The first parameter of a program is an integer, a size of a grid.\n"; @@ -67,7 +66,7 @@ int main(int argc, char** argv) { } std::cout << "Creating persistence heat maps...\n"; - std::vector<std::vector<double> > filter = create_Gaussian_filter(stdiv, 1); + std::vector<std::vector<double> > filter = Gudhi::Persistence_representations::create_Gaussian_filter(stdiv, 1); for (size_t i = 0; i != filenames.size(); ++i) { std::cout << "Creating a heat map based on a file : " << filenames[i] << std::endl; diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/plot_persistence_heat_map.cpp b/src/Persistence_representations/utilities/persistence_heat_maps/plot_persistence_heat_map.cpp index 0b7841d1..a7c9f2d8 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/plot_persistence_heat_map.cpp +++ b/src/Persistence_representations/utilities/persistence_heat_maps/plot_persistence_heat_map.cpp @@ -22,16 +22,16 @@ #include <gudhi/Persistence_heat_maps.h> -using namespace Gudhi; -using namespace Gudhi::Persistence_representations; - #include <iostream> #include <sstream> +using constant_scaling_function = Gudhi::Persistence_representations::constant_scaling_function; +using Persistence_heat_maps = Gudhi::Persistence_representations::Persistence_heat_maps<constant_scaling_function>; + int main(int argc, char** argv) { std::cout << "This program plot persistence landscape stored in a file (the file needs to be created beforehand). " "Please call the code with the name of a landscape file \n"; - Persistence_heat_maps<constant_scaling_function> l; + Persistence_heat_maps l; l.load_from_file(argv[1]); l.plot(argv[1]); return 0; |