summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-12-09 12:47:11 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-12-09 12:47:11 +0000
commitca8474aa59374fc5f4266aa56196587685b86637 (patch)
tree6cb78f32bbe0bcb4f5c689626d540cda4168aff8
parent2cfcdc6d74a2bae0655234f71f41a80a3351e3c4 (diff)
CMake modification strategy as it was quite painful to maintain all these utilities
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/persistence_representation_integration_cmake_improvement@3062 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: c0eae764abe5c7076ae59027eeab2a7ad451463c
-rw-r--r--src/Persistence_representations/include/gudhi/Persistence_heat_maps.h10
-rw-r--r--src/Persistence_representations/include/gudhi/Persistence_landscape.h11
-rw-r--r--src/Persistence_representations/include/gudhi/Persistence_landscape_on_grid.h12
-rw-r--r--src/Persistence_representations/include/gudhi/Persistence_vectors.h3
-rw-r--r--src/Persistence_representations/utilities/CMakeLists.txt48
-rw-r--r--src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt72
-rw-r--r--src/Persistence_representations/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp16
-rw-r--r--src/Persistence_representations/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp13
-rw-r--r--src/Persistence_representations/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp14
-rw-r--r--src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_arctan_of_their_persistence.cpp33
-rw-r--r--src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_distance_from_diagonal.cpp34
-rw-r--r--src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_squared_diag_distance.cpp34
-rw-r--r--src/Persistence_representations/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp34
-rw-r--r--src/Persistence_representations/utilities/persistence_heat_maps/create_pssk.cpp34
-rw-r--r--src/Persistence_representations/utilities/persistence_heat_maps/plot_persistence_heat_map.cpp8
-rw-r--r--src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt6
-rw-r--r--src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt40
-rw-r--r--src/Persistence_representations/utilities/persistence_landscapes/average_landscapes.cpp15
-rw-r--r--src/Persistence_representations/utilities/persistence_landscapes/compute_distance_of_landscapes.cpp14
-rw-r--r--src/Persistence_representations/utilities/persistence_landscapes/compute_scalar_product_of_landscapes.cpp15
-rw-r--r--src/Persistence_representations/utilities/persistence_landscapes/create_landscapes.cpp24
-rw-r--r--src/Persistence_representations/utilities/persistence_landscapes/plot_landscapes.cpp16
-rw-r--r--src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt39
-rw-r--r--src/Persistence_representations/utilities/persistence_landscapes_on_grid/average_landscapes_on_grid.cpp16
-rw-r--r--src/Persistence_representations/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp13
-rw-r--r--src/Persistence_representations/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp14
-rw-r--r--src/Persistence_representations/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp27
-rw-r--r--src/Persistence_representations/utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp17
-rw-r--r--src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt38
-rw-r--r--src/Persistence_representations/utilities/persistence_vectors/average_persistence_vectors.cpp13
-rw-r--r--src/Persistence_representations/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp3
-rw-r--r--src/Persistence_representations/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp15
-rw-r--r--src/Persistence_representations/utilities/persistence_vectors/create_persistence_vectors.cpp23
-rw-r--r--src/cmake/modules/GUDHI_third_party_libraries.cmake5
34 files changed, 332 insertions, 397 deletions
diff --git a/src/Persistence_representations/include/gudhi/Persistence_heat_maps.h b/src/Persistence_representations/include/gudhi/Persistence_heat_maps.h
index 04dd78ad..ae1740a7 100644
--- a/src/Persistence_representations/include/gudhi/Persistence_heat_maps.h
+++ b/src/Persistence_representations/include/gudhi/Persistence_heat_maps.h
@@ -743,10 +743,10 @@ void Persistence_heat_maps<Scalling_of_kernels>::compute_percentage_of_active(
template <typename Scalling_of_kernels>
void Persistence_heat_maps<Scalling_of_kernels>::plot(const char* filename) const {
std::ofstream out;
- std::stringstream ss;
- ss << filename << "_GnuplotScript";
+ std::stringstream gnuplot_script;
+ gnuplot_script << filename << "_GnuplotScript";
- out.open(ss.str().c_str());
+ out.open(gnuplot_script.str().c_str());
out << "plot '-' matrix with image" << std::endl;
for (size_t i = 0; i != this->heat_map.size(); ++i) {
for (size_t j = 0; j != this->heat_map[i].size(); ++j) {
@@ -755,8 +755,8 @@ void Persistence_heat_maps<Scalling_of_kernels>::plot(const char* filename) cons
out << std::endl;
}
out.close();
- std::cout << "Gnuplot script have been created. Open gnuplot and type load \'" << ss.str().c_str()
- << "\' to see the picture." << std::endl;
+ std::cout << "To visualize, install gnuplot and type the command: gnuplot -persist -e \"load \'"
+ << gnuplot_script.str().c_str() << "\'\"" << std::endl;
}
template <typename Scalling_of_kernels>
diff --git a/src/Persistence_representations/include/gudhi/Persistence_landscape.h b/src/Persistence_representations/include/gudhi/Persistence_landscape.h
index 5c300112..72498edf 100644
--- a/src/Persistence_representations/include/gudhi/Persistence_landscape.h
+++ b/src/Persistence_representations/include/gudhi/Persistence_landscape.h
@@ -1340,10 +1340,9 @@ void Persistence_landscape::plot(const char* filename, double xRangeBegin, doubl
// this program create a gnuplot script file that allows to plot persistence diagram.
std::ofstream out;
- std::ostringstream nameSS;
- nameSS << filename << "_GnuplotScript";
- std::string nameStr = nameSS.str();
- out.open(nameStr);
+ std::ostringstream gnuplot_script;
+ gnuplot_script << filename << "_GnuplotScript";
+ out.open(gnuplot_script.str().c_str());
if ((xRangeBegin != std::numeric_limits<double>::max()) || (xRangeEnd != std::numeric_limits<double>::max()) ||
(yRangeBegin != std::numeric_limits<double>::max()) || (yRangeEnd != std::numeric_limits<double>::max())) {
@@ -1376,8 +1375,8 @@ void Persistence_landscape::plot(const char* filename, double xRangeBegin, doubl
}
out << "EOF" << std::endl;
}
- std::cout << "Gnuplot script to visualize persistence diagram written to the file: " << nameStr << ". Type load '"
- << nameStr << "' in gnuplot to visualize." << std::endl;
+ std::cout << "To visualize, install gnuplot and type the command: gnuplot -persist -e \"load \'"
+ << gnuplot_script.str().c_str() << "\'\"" << std::endl;
}
} // namespace Persistence_representations
diff --git a/src/Persistence_representations/include/gudhi/Persistence_landscape_on_grid.h b/src/Persistence_representations/include/gudhi/Persistence_landscape_on_grid.h
index 4ceb9bf6..84fd22ed 100644
--- a/src/Persistence_representations/include/gudhi/Persistence_landscape_on_grid.h
+++ b/src/Persistence_representations/include/gudhi/Persistence_landscape_on_grid.h
@@ -1207,10 +1207,9 @@ void Persistence_landscape_on_grid::plot(const char* filename, double min_x, dou
// this program create a gnuplot script file that allows to plot persistence diagram.
std::ofstream out;
- std::ostringstream nameSS;
- nameSS << filename << "_GnuplotScript";
- std::string nameStr = nameSS.str();
- out.open(nameStr);
+ std::ostringstream gnuplot_script;
+ gnuplot_script << filename << "_GnuplotScript";
+ out.open(gnuplot_script.str().c_str());
if (min_x == max_x) {
std::pair<double, double> min_max = compute_minimum_maximum();
@@ -1241,7 +1240,6 @@ void Persistence_landscape_on_grid::plot(const char* filename, double min_x, dou
out << "plot ";
for (size_t lambda = from; lambda != to; ++lambda) {
- // out << " '-' using 1:2 title 'l" << lambda << "' with lp";
out << " '-' using 1:2 notitle with lp";
if (lambda + 1 != to) {
out << ", \\";
@@ -1261,8 +1259,8 @@ void Persistence_landscape_on_grid::plot(const char* filename, double min_x, dou
}
out << "EOF" << std::endl;
}
- std::cout << "Gnuplot script to visualize persistence diagram written to the file: " << nameStr << ". Type load '"
- << nameStr << "' in gnuplot to visualize." << std::endl;
+ std::cout << "To visualize, install gnuplot and type the command: gnuplot -persist -e \"load \'"
+ << gnuplot_script.str().c_str() << "\'\"" << std::endl;
}
template <typename T>
diff --git a/src/Persistence_representations/include/gudhi/Persistence_vectors.h b/src/Persistence_representations/include/gudhi/Persistence_vectors.h
index 0fb49eee..39df37e0 100644
--- a/src/Persistence_representations/include/gudhi/Persistence_vectors.h
+++ b/src/Persistence_representations/include/gudhi/Persistence_vectors.h
@@ -201,7 +201,8 @@ class Vector_distances_in_diagram {
}
out << std::endl;
out.close();
- std::cout << "To visualize, open gnuplot and type: load \'" << gnuplot_script.str().c_str() << "\'" << std::endl;
+ std::cout << "To visualize, install gnuplot and type the command: gnuplot -persist -e \"load \'"
+ << gnuplot_script.str().c_str() << "\'\"" << std::endl;
}
/**
diff --git a/src/Persistence_representations/utilities/CMakeLists.txt b/src/Persistence_representations/utilities/CMakeLists.txt
index 66524666..d0d93f9d 100644
--- a/src/Persistence_representations/utilities/CMakeLists.txt
+++ b/src/Persistence_representations/utilities/CMakeLists.txt
@@ -1,3 +1,51 @@
+# Copy files, otherwise result files are created in sources
+file(COPY "${CMAKE_SOURCE_DIR}/data/persistence_diagram/first.pers" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/")
+file(COPY "${CMAKE_SOURCE_DIR}/data/persistence_diagram/second.pers" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/")
+
+function(add_persistence_representation_creation_utility creation_utility)
+ add_executable ( ${creation_utility} ${creation_utility}.cpp )
+
+ # as the function is called in a subdirectory level, need to '../' to find persistence files
+ # ARGN will add all the other arguments (except creation_utility) sent to the CMake functions
+ add_test(NAME Persistence_representation_utilities_${creation_utility} COMMAND $<TARGET_FILE:${creation_utility}>
+ ${ARGN} "${CMAKE_CURRENT_BINARY_DIR}/../first.pers"
+ "${CMAKE_CURRENT_BINARY_DIR}/../second.pers")
+endfunction(add_persistence_representation_creation_utility)
+
+function(add_persistence_representation_plot_utility plot_utility tool_extension)
+ add_executable ( ${plot_utility} ${plot_utility}.cpp )
+
+ # as the function is called in a subdirectory level, need to '../' to find persistence heat maps files
+ add_test(NAME Persistence_representation_utilities_${plot_utility}_first COMMAND $<TARGET_FILE:${plot_utility}>
+ "${CMAKE_CURRENT_BINARY_DIR}/../first.pers${tool_extension}")
+ add_test(NAME Persistence_representation_utilities_${plot_utility}_second COMMAND $<TARGET_FILE:${plot_utility}>
+ "${CMAKE_CURRENT_BINARY_DIR}/../second.pers${tool_extension}")
+ if(GNUPLOT_PATH)
+ add_test(NAME Persistence_representation_utilities_${plot_utility}_first_gnuplot COMMAND ${GNUPLOT_PATH}
+ "-e" "load '${CMAKE_CURRENT_BINARY_DIR}/../first.pers${tool_extension}_GnuplotScript'")
+ add_test(NAME Persistence_representation_utilities_${plot_utility}_second_gnuplot COMMAND ${GNUPLOT_PATH}
+ "-e" "load '${CMAKE_CURRENT_BINARY_DIR}/../second.pers${tool_extension}_GnuplotScript'")
+ endif()
+endfunction(add_persistence_representation_plot_utility)
+
+function(add_persistence_representation_function_utility function_utility tool_extension)
+ add_executable ( ${function_utility} ${function_utility}.cpp )
+
+ # ARGV2 is an optional argument
+ if (${ARGV2})
+ # as the function is called in a subdirectory level, need to '../' to find persistence heat maps files
+ add_test(NAME Persistence_representation_utilities_${function_utility} COMMAND $<TARGET_FILE:${function_utility}>
+ "${ARGV2}"
+ "${CMAKE_CURRENT_BINARY_DIR}/../first.pers${tool_extension}"
+ "${CMAKE_CURRENT_BINARY_DIR}/../second.pers${tool_extension}")
+ else()
+ # as the function is called in a subdirectory level, need to '../' to find persistence heat maps files
+ add_test(NAME Persistence_representation_utilities_${function_utility} COMMAND $<TARGET_FILE:${function_utility}>
+ "${CMAKE_CURRENT_BINARY_DIR}/../first.pers${tool_extension}"
+ "${CMAKE_CURRENT_BINARY_DIR}/../second.pers${tool_extension}")
+ endif()
+endfunction(add_persistence_representation_function_utility)
+
add_subdirectory(persistence_heat_maps)
add_subdirectory(persistence_intervals)
add_subdirectory(persistence_landscapes)
diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt
index 0dd63852..386e9fa5 100644
--- a/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt
+++ b/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt
@@ -1,63 +1,15 @@
cmake_minimum_required(VERSION 2.6)
project(Persistence_representations_heat_maps_utilities)
-file(COPY "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/")
-
-add_executable ( create_persistence_heat_maps create_persistence_heat_maps.cpp )
-target_link_libraries(create_persistence_heat_maps ${Boost_SYSTEM_LIBRARY})
-
-add_test(NAME create_persistence_heat_maps COMMAND $<TARGET_FILE:create_persistence_heat_maps>
- "10" "-1" "-1" "4" "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt")
-
-
-add_executable ( create_pssk create_pssk.cpp )
-target_link_libraries(create_pssk ${Boost_SYSTEM_LIBRARY})
-
-add_test(NAME create_pssk COMMAND $<TARGET_FILE:create_pssk>
- "10" "-1" "-1" "4" "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt")
-
-add_executable ( create_p_h_m_weighted_by_distance_from_diagonal create_p_h_m_weighted_by_distance_from_diagonal.cpp )
-target_link_libraries(create_p_h_m_weighted_by_distance_from_diagonal ${Boost_SYSTEM_LIBRARY})
-
-add_test(NAME create_p_h_m_weighted_by_distance_from_diagonal COMMAND $<TARGET_FILE:create_p_h_m_weighted_by_distance_from_diagonal>
- "10" "-1" "-1" "4" "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt")
-
-add_executable ( create_p_h_m_weighted_by_squared_diag_distance create_p_h_m_weighted_by_squared_diag_distance.cpp )
-target_link_libraries(create_p_h_m_weighted_by_squared_diag_distance ${Boost_SYSTEM_LIBRARY})
-
-add_test(NAME create_p_h_m_weighted_by_squared_diag_distance COMMAND $<TARGET_FILE:create_p_h_m_weighted_by_squared_diag_distance>
- "10" "-1" "-1" "4" "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt")
-
-add_executable ( create_p_h_m_weighted_by_arctan_of_their_persistence create_p_h_m_weighted_by_arctan_of_their_persistence.cpp )
-target_link_libraries(create_p_h_m_weighted_by_arctan_of_their_persistence ${Boost_SYSTEM_LIBRARY})
-
-add_test(NAME create_p_h_m_weighted_by_arctan_of_their_persistence COMMAND $<TARGET_FILE:create_p_h_m_weighted_by_arctan_of_their_persistence>
- "10" "-1" "-1" "4" "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt")
-
-add_executable ( average_persistence_heat_maps average_persistence_heat_maps.cpp )
-target_link_libraries(average_persistence_heat_maps ${Boost_SYSTEM_LIBRARY})
-
-add_test(NAME average_persistence_heat_maps COMMAND $<TARGET_FILE:average_persistence_heat_maps>
- "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt"
- "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt")
-
-add_executable ( plot_persistence_heat_map plot_persistence_heat_map.cpp )
-target_link_libraries(plot_persistence_heat_map ${Boost_SYSTEM_LIBRARY})
-
-add_test(NAME plot_persistence_heat_map COMMAND $<TARGET_FILE:plot_persistence_heat_map>
- "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt")
-
-add_executable ( compute_distance_of_persistence_heat_maps compute_distance_of_persistence_heat_maps.cpp )
-target_link_libraries(compute_distance_of_persistence_heat_maps ${Boost_SYSTEM_LIBRARY})
-
-add_test(NAME compute_distance_of_persistence_heat_maps COMMAND $<TARGET_FILE:compute_distance_of_persistence_heat_maps>
- "1"
- "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt"
- "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt")
-
-add_executable ( compute_scalar_product_of_persistence_heat_maps compute_scalar_product_of_persistence_heat_maps.cpp )
-target_link_libraries(compute_scalar_product_of_persistence_heat_maps ${Boost_SYSTEM_LIBRARY})
-
-add_test(NAME compute_scalar_product_of_persistence_heat_maps COMMAND $<TARGET_FILE:compute_scalar_product_of_persistence_heat_maps>
- "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt"
- "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt")
+add_persistence_representation_creation_utility(create_pssk "10" "-1" "-1" "4" "-1")
+add_persistence_representation_creation_utility(create_p_h_m_weighted_by_arctan_of_their_persistence "10" "-1" "-1" "4" "-1")
+add_persistence_representation_creation_utility(create_p_h_m_weighted_by_distance_from_diagonal "10" "-1" "-1" "4" "-1")
+add_persistence_representation_creation_utility(create_p_h_m_weighted_by_squared_diag_distance "10" "-1" "-1" "4" "-1")
+# Need to set grid min and max for further average, distance and scalar_product
+add_persistence_representation_creation_utility(create_persistence_heat_maps "10" "0" "35" "10" "-1")
+
+add_persistence_representation_plot_utility(plot_persistence_heat_map ".mps")
+
+add_persistence_representation_function_utility(average_persistence_heat_maps ".mps")
+add_persistence_representation_function_utility(compute_distance_of_persistence_heat_maps ".mps" "1")
+add_persistence_representation_function_utility(compute_scalar_product_of_persistence_heat_maps ".mps")
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 4e81375a..6739e0b6 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
@@ -29,21 +29,20 @@ using constant_scaling_function = Gudhi::Persistence_representations::constant_s
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 "
- "persistence diagrams \n";
- std::vector<const char*> filenames;
+ std::cout << "This program computes average of persistence heat maps stored in files (the files needs to be "
+ << "created beforehand).\n"
+ << "The parameters of this programs are names of files with persistence heat maps.\n";
- if (argc == 1) {
- std::cout << "No input files given, the program will now terminate \n";
+ if (argc < 3) {
+ std::cout << "Wrong number of parameters, the program will now terminate \n";
return 1;
}
+ std::vector<const char*> filenames;
for (int i = 1; i < argc; ++i) {
filenames.push_back(argv[i]);
}
- std::cout << "Creating persistence landscapes...\n";
std::vector<Persistence_heat_maps*> maps;
for (size_t i = 0; i != filenames.size(); ++i) {
Persistence_heat_maps* l = new Persistence_heat_maps;
@@ -53,13 +52,12 @@ int main(int argc, char** argv) {
Persistence_heat_maps av;
av.compute_average(maps);
-
av.print_to_file("average.mps");
for (size_t i = 0; i != filenames.size(); ++i) {
delete maps[i];
}
- std::cout << "Done \n";
+ std::cout << "Average can be found in 'average.mps' file\n";
return 0;
}
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 befb0837..ed8278a2 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
@@ -31,11 +31,11 @@ using constant_scaling_function = Gudhi::Persistence_representations::constant_s
using Persistence_heat_maps = Gudhi::Persistence_representations::Persistence_heat_maps<constant_scaling_function>;
int main(int argc, char** argv) {
- std::cout << "This program computes distance of persistence heat maps stored in a file (the file needs to be created "
- "beforehand). \n";
- std::cout << "The first parameter of a program is an integer p. The program compute L^p distance of the two heat "
- "maps. For L^infty distance choose p = -1. \n";
- std::cout << "The remaining parameters of this program are names of files with persistence heat maps.\n";
+ std::cout << "This program computes distance of persistence heat maps stored in files (the files needs to be "
+ << "created beforehand).\n"
+ << "The first parameter of a program is an integer p. The program compute L^p distance of the two heat "
+ << "maps. For L^infty distance choose p = -1. \n"
+ << "The remaining parameters of this program are names of files with persistence heat maps.\n";
if (argc < 3) {
std::cout << "Wrong number of parameters, the program will now terminate \n";
@@ -78,7 +78,7 @@ int main(int argc, char** argv) {
// and now output the result to the screen and a file:
std::ofstream out;
- out.open("distance");
+ out.open("distance.mps");
for (size_t i = 0; i != distance.size(); ++i) {
for (size_t j = 0; j != distance.size(); ++j) {
std::cout << distance[i][j] << " ";
@@ -89,5 +89,6 @@ int main(int argc, char** argv) {
}
out.close();
+ std::cout << "Distance can be found in 'distance.mps' file\n";
return 0;
}
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 c684a336..63626853 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
@@ -30,9 +30,14 @@ using constant_scaling_function = Gudhi::Persistence_representations::constant_s
using Persistence_heat_maps = Gudhi::Persistence_representations::Persistence_heat_maps<constant_scaling_function>;
int main(int argc, char** argv) {
- std::cout << "This program computes scalar product of persistence landscapes stored in a file (the file needs to be "
- "created beforehand). \n";
- std::cout << "The parameters of this programs are names of files with persistence landscapes.\n";
+ std::cout << "This program computes scalar product of persistence heat maps stored in a file (the file needs to be "
+ << "created beforehand). \n"
+ << "The parameters of this programs are names of files with persistence heat maps.\n";
+
+ if (argc < 3) {
+ std::cout << "Wrong number of parameters, the program will now terminate \n";
+ return 1;
+ }
std::vector<const char*> filenames;
for (int i = 1; i < argc; ++i) {
@@ -64,7 +69,7 @@ int main(int argc, char** argv) {
// and now output the result to the screen and a file:
std::ofstream out;
- out.open("scalar_product");
+ out.open("scalar_product.mps");
for (size_t i = 0; i != scalar_product.size(); ++i) {
for (size_t j = 0; j != scalar_product.size(); ++j) {
std::cout << scalar_product[i][j] << " ";
@@ -75,5 +80,6 @@ int main(int argc, char** argv) {
}
out.close();
+ std::cout << "Distance can be found in 'scalar_product.mps' file\n";
return 0;
}
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 2bf185a3..47c70484 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
@@ -32,22 +32,22 @@ 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";
- std::cout << "The first parameter of a program is an integer, a size of a grid.\n";
- std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed "
- "based on the data, set them both to -1 \n";
- std::cerr << "The fourth parameter is an integer, the standard deviation of a Gaussian kernel expressed in a number "
- "of pixels \n";
- std::cout << "The fifth parameter of this program is a dimension of persistence that will be used in creation of the "
- "persistence heat maps.";
- std::cout << "If our input files contain persistence pairs of various dimension, as a fifth parameter of the "
- "procedure please provide the dimension of persistence you want to use.";
- std::cout << "If in your file there are only birth-death pairs of the same dimension, set the first parameter to -1."
- << std::endl;
- std::cout << "The remaining parameters are the names of files with persistence diagrams. \n";
+ std::cout << "This program creates persistence heat map files (*.mps) of persistence diagrams files (*.pers) "
+ << "provided as an input.The Gaussian kernels are weighted by the arc tangential of their persistence.\n"
+ << "The first parameter of a program is an integer, a size of a grid.\n"
+ << "The second and third parameters are min and max of the grid. If you want those numbers to be computed "
+ << "based on the data, set them both to -1 \n"
+ << "The fourth parameter is an integer, the standard deviation of a Gaussian kernel expressed in a number "
+ << "of pixels.\n"
+ << "The fifth parameter of this program is a dimension of persistence that will be used in creation of "
+ << "the persistence heat maps."
+ << "If your input files contains persistence pairs of various dimension, as a fifth parameter of the "
+ << "procedure please provide the dimension of persistence you want to use."
+ << "If in your files there are only birth-death pairs of the same dimension, set the fifth parameter to "
+ << "-1.\n"
+ << "The remaining parameters are the names of files with persistence diagrams. \n";
- if (argc < 5) {
+ if (argc < 7) {
std::cout << "Wrong parameter list, the program will now terminate \n";
return 1;
}
@@ -68,9 +68,7 @@ int main(int argc, char** argv) {
filenames.push_back(argv[i]);
}
- std::cout << "Creating persistence heat maps...\n";
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 l(filenames[i], filter, false, size_of_grid, min_, max_, dimension);
@@ -79,6 +77,5 @@ int main(int argc, char** argv) {
ss << filenames[i] << ".mps";
l.print_to_file(ss.str().c_str());
}
- std::cout << "Done \n";
return 0;
}
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 ec9477f1..659a5105 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
@@ -32,22 +32,23 @@ 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";
- std::cout << "The first parameter of a program is an integer, a size of a grid.\n";
- std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed "
- "based on the data, set them both to -1 \n";
- std::cerr << "The fourth parameter is an integer, the standard deviation of a Gaussian kernel expressed in a number "
- "of pixels \n";
- std::cout << "The fifth parameter of this program is a dimension of persistence that will be used in creation of the "
- "persistence heat maps.";
- std::cout << "If our input files contain persistence pairs of various dimension, as a fifth parameter of the "
- "procedure please provide the dimension of persistence you want to use.";
- std::cout << "If in your file there are only birth-death pairs of the same dimension, set the first parameter to -1."
- << std::endl;
- std::cout << "The remaining parameters are the names of files with persistence diagrams. \n";
+ std::cout << "This program creates persistence heat map files (*.mps) of persistence diagrams files (*.pers) "
+ << "provided as an input.The Gaussian kernels are weighted by the distance of a center from the "
+ << "diagonal.\n"
+ << "The first parameter of a program is an integer, a size of a grid.\n"
+ << "The second and third parameters are min and max of the grid. If you want those numbers to be computed "
+ << "based on the data, set them both to -1 \n"
+ << "The fourth parameter is an integer, the standard deviation of a Gaussian kernel expressed in a number "
+ << "of pixels.\n"
+ << "The fifth parameter of this program is a dimension of persistence that will be used in creation of "
+ << "the persistence heat maps."
+ << "If your input files contains persistence pairs of various dimension, as a fifth parameter of the "
+ << "procedure please provide the dimension of persistence you want to use."
+ << "If in your files there are only birth-death pairs of the same dimension, set the fifth parameter to "
+ << "-1.\n"
+ << "The remaining parameters are the names of files with persistence diagrams. \n";
- if (argc < 5) {
+ if (argc < 7) {
std::cout << "Wrong parameter list, the program will now terminate \n";
return 1;
}
@@ -68,9 +69,7 @@ int main(int argc, char** argv) {
filenames.push_back(argv[i]);
}
- std::cout << "Creating persistence heat maps...\n";
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 l(filenames[i], filter, false, size_of_grid, min_, max_, dimension);
@@ -79,6 +78,5 @@ int main(int argc, char** argv) {
ss << filenames[i] << ".mps";
l.print_to_file(ss.str().c_str());
}
- std::cout << "Done \n";
return 0;
}
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 ffec8b3d..9497b188 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
@@ -33,22 +33,23 @@ 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";
- std::cout << "The first parameter of a program is an integer, a size of a grid.\n";
- std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed "
- "based on the data, set them both to -1 \n";
- std::cerr << "The fourth parameter is an integer, the standard deviation of a Gaussian kernel expressed in a number "
- "of pixels \n";
- std::cout << "The fifth parameter of this program is a dimension of persistence that will be used in creation of the "
- "persistence heat maps.";
- std::cout << "If our input files contain persistence pairs of various dimension, as a fifth parameter of the "
- "procedure please provide the dimension of persistence you want to use.";
- std::cout << "If in your file there are only birth-death pairs of the same dimension, set the first parameter to -1."
- << std::endl;
- std::cout << "The remaining parameters are the names of files with persistence diagrams. \n";
+ std::cout << "This program creates persistence heat map files (*.mps) of persistence diagrams files (*.pers) "
+ << "provided as an input.The Gaussian kernels are weighted by the square of distance of a center from the "
+ << "diagonal.\n"
+ << "The first parameter of a program is an integer, a size of a grid.\n"
+ << "The second and third parameters are min and max of the grid. If you want those numbers to be computed "
+ << "based on the data, set them both to -1 \n"
+ << "The fourth parameter is an integer, the standard deviation of a Gaussian kernel expressed in a number "
+ << "of pixels.\n"
+ << "The fifth parameter of this program is a dimension of persistence that will be used in creation of "
+ << "the persistence heat maps."
+ << "If your input files contains persistence pairs of various dimension, as a fifth parameter of the "
+ << "procedure please provide the dimension of persistence you want to use."
+ << "If in your files there are only birth-death pairs of the same dimension, set the fifth parameter to "
+ << "-1.\n"
+ << "The remaining parameters are the names of files with persistence diagrams. \n";
- if (argc < 5) {
+ if (argc < 7) {
std::cout << "Wrong parameter list, the program will now terminate \n";
return 1;
}
@@ -69,9 +70,7 @@ int main(int argc, char** argv) {
filenames.push_back(argv[i]);
}
- std::cout << "Creating persistence heat maps...\n";
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 l(filenames[i], filter, false, size_of_grid, min_, max_, dimension);
@@ -80,6 +79,5 @@ int main(int argc, char** argv) {
ss << filenames[i] << ".mps";
l.print_to_file(ss.str().c_str());
}
- std::cout << "Done \n";
return 0;
}
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 db2f0008..25cd1067 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
@@ -31,21 +31,22 @@ using constant_scaling_function = Gudhi::Persistence_representations::constant_s
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";
- std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed "
- "based on the data, set them both to -1 \n";
- std::cerr << "The fourth parameter is an integer, the standard deviation of a Gaussian kernel expressed in a number "
- "of pixels \n";
+ std::cout << "This program creates persistence heat map files (*.mps) of persistence diagrams files (*.pers) "
+ << "provided as an input.\n"
+ << "The first parameter of a program is an integer, a size of a grid.\n"
+ << "The second and third parameters are min and max of the grid. If you want those numbers to be computed "
+ << "based on the data, set them both to -1 \n"
+ << "The fourth parameter is an integer, the standard deviation of a Gaussian kernel expressed in a number "
+ << "of pixels.\n"
+ << "The fifth parameter of this program is a dimension of persistence that will be used in creation of "
+ << "the persistence heat maps."
+ << "If your input files contains persistence pairs of various dimension, as a fifth parameter of the "
+ << "procedure please provide the dimension of persistence you want to use."
+ << "If in your files there are only birth-death pairs of the same dimension, set the fifth parameter to "
+ << "-1.\n"
+ << "The remaining parameters are the names of files with persistence diagrams. \n";
- std::cout << "The fifth parameter of this program is a dimension of persistence that will be used in creation of the "
- "persistence heat maps.";
- std::cout << "If your input file contains persistence pairs of various dimension, as a fifth parameter of the "
- "procedure please provide the dimension of persistence you want to use.";
- std::cout << "If in your file there are only birth-death pairs of the same dimension, set the first parameter to -1."
- << std::endl;
- std::cout << "The remaining parameters are the names of files with persistence diagrams. \n";
- if (argc < 5) {
+ if (argc < 7) {
std::cout << "Wrong parameter list, the program will now terminate \n";
return 1;
}
@@ -64,17 +65,14 @@ int main(int argc, char** argv) {
filenames.push_back(argv[i]);
}
- std::cout << "Creating persistence heat maps...\n";
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;
+ std::cout << "Creating a heat map based on file : " << filenames[i] << std::endl;
Persistence_heat_maps l(filenames[i], filter, false, size_of_grid, min_, max_, dimension);
std::stringstream ss;
ss << filenames[i] << ".mps";
l.print_to_file(ss.str().c_str());
}
- std::cout << "Done \n";
return 0;
}
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 6aefbb00..97ddb8f0 100644
--- a/src/Persistence_representations/utilities/persistence_heat_maps/create_pssk.cpp
+++ b/src/Persistence_representations/utilities/persistence_heat_maps/create_pssk.cpp
@@ -30,21 +30,22 @@
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";
- std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed "
- "based on the data, set them both to -1 \n";
- std::cerr << "The fourth parameter is an integer, the standard deviation of a Gaussian kernel expressed in a number "
- "of pixels \n";
- std::cout << "The fifth parameter of this program is a dimension of persistence that will be used in creation of the "
- "persistence heat maps.";
- std::cout << "If our input files contain persistence pairs of various dimension, as a fifth parameter of the "
- "procedure please provide the dimension of persistence you want to use.";
- std::cout << "If in your file there are only birth-death pairs of the same dimension, set the first parameter to -1."
- << std::endl;
- std::cout << "The remaining parameters are the names of files with persistence diagrams. \n";
+ std::cout << "This program creates PSSK files (*.pssk) of persistence diagrams files (*.pers) "
+ << "provided as an input.\n"
+ << "The first parameter of a program is an integer, a size of a grid.\n"
+ << "The second and third parameters are min and max of the grid. If you want those numbers to be computed "
+ << "based on the data, set them both to -1 \n"
+ << "The fourth parameter is an integer, the standard deviation of a Gaussian kernel expressed in a number "
+ << "of pixels.\n"
+ << "The fifth parameter of this program is a dimension of persistence that will be used in creation of "
+ << "the PSSK."
+ << "If your input files contains persistence pairs of various dimension, as a fifth parameter of the "
+ << "procedure please provide the dimension of persistence you want to use."
+ << "If in your files there are only birth-death pairs of the same dimension, set the first parameter to "
+ << "-1.\n"
+ << "The remaining parameters are the names of files with persistence diagrams. \n";
- if (argc < 5) {
+ if (argc < 7) {
std::cout << "Wrong parameter list, the program will now terminate \n";
return 1;
}
@@ -65,17 +66,14 @@ int main(int argc, char** argv) {
filenames.push_back(argv[i]);
}
- std::cout << "Creating persistence heat maps...\n";
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;
+ std::cout << "Creating a PSSK based on a file : " << filenames[i] << std::endl;
PSSK l(filenames[i], filter, size_of_grid, min_, max_, dimension);
std::stringstream ss;
ss << filenames[i] << ".pssk";
l.print_to_file(ss.str().c_str());
}
- std::cout << "Done \n";
return 0;
}
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 a7c9f2d8..63711d83 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
@@ -29,8 +29,12 @@ using constant_scaling_function = Gudhi::Persistence_representations::constant_s
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";
+ std::cout << "This program creates a gnuplot script from a persistence heat maps stored in a file (the file needs "
+ << "to be created beforehand). Please call the code with the name of a single heat maps file \n";
+ if (argc != 2) {
+ std::cout << "Wrong parameter list, the program will now terminate \n";
+ return 1;
+ }
Persistence_heat_maps l;
l.load_from_file(argv[1]);
l.plot(argv[1]);
diff --git a/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt
index 105b7efb..2ba6efe5 100644
--- a/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt
+++ b/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt
@@ -4,38 +4,32 @@ project(Persistence_representations_intervals_utilities)
file(COPY "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/")
add_executable ( plot_persistence_intervals plot_persistence_intervals.cpp )
-target_link_libraries( plot_persistence_intervals ${Boost_SYSTEM_LIBRARY})
add_test(NAME plot_persistence_intervals COMMAND $<TARGET_FILE:plot_persistence_intervals>
"${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt")
add_executable ( compute_birth_death_range_in_persistence_diagram compute_birth_death_range_in_persistence_diagram.cpp )
-target_link_libraries( compute_birth_death_range_in_persistence_diagram ${Boost_SYSTEM_LIBRARY})
add_test(NAME compute_birth_death_range_in_persistence_diagram COMMAND $<TARGET_FILE:compute_birth_death_range_in_persistence_diagram>
"-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt")
add_executable ( compute_number_of_dominant_intervals compute_number_of_dominant_intervals.cpp )
-target_link_libraries( compute_number_of_dominant_intervals ${Boost_SYSTEM_LIBRARY})
add_test(NAME compute_number_of_dominant_intervals COMMAND $<TARGET_FILE:compute_number_of_dominant_intervals>
"${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt" "-1" "2")
add_executable ( plot_histogram_of_intervals_lengths plot_histogram_of_intervals_lengths.cpp )
-target_link_libraries( plot_histogram_of_intervals_lengths ${Boost_SYSTEM_LIBRARY})
add_test(NAME plot_histogram_of_intervals_lengths COMMAND $<TARGET_FILE:plot_histogram_of_intervals_lengths>
"${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt" "2")
add_executable ( plot_persistence_Betti_numbers plot_persistence_Betti_numbers.cpp )
-target_link_libraries( plot_persistence_Betti_numbers ${Boost_SYSTEM_LIBRARY})
add_test(NAME plot_persistence_Betti_numbers COMMAND $<TARGET_FILE:plot_persistence_Betti_numbers>
"${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt")
if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
add_executable ( compute_bottleneck_distance compute_bottleneck_distance.cpp )
- target_link_libraries( compute_bottleneck_distance ${Boost_SYSTEM_LIBRARY})
if (TBB_FOUND)
target_link_libraries(compute_bottleneck_distance ${TBB_LIBRARIES})
endif(TBB_FOUND)
diff --git a/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt
index baf8de3c..d7087ed8 100644
--- a/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt
+++ b/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt
@@ -1,38 +1,10 @@
cmake_minimum_required(VERSION 2.6)
-project(Persistence_representations_lanscapes_utilities)
+project(Persistence_representations_landscapes_utilities)
-file(COPY "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/")
+add_persistence_representation_creation_utility(create_landscapes "-1")
-add_executable ( create_landscapes create_landscapes.cpp )
-target_link_libraries(create_landscapes ${Boost_SYSTEM_LIBRARY})
+add_persistence_representation_plot_utility(plot_landscapes ".land")
-# Will create simple_diagram.txt.land
-add_test(NAME create_landscapes COMMAND $<TARGET_FILE:create_landscapes>
- "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt")
-
-add_executable ( average_landscapes average_landscapes.cpp )
-target_link_libraries(average_landscapes ${Boost_SYSTEM_LIBRARY})
-
-add_test(NAME average_landscapes COMMAND $<TARGET_FILE:average_landscapes>
- "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt"
- "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt")
-
-add_executable ( plot_landscapes plot_landscapes.cpp )
-target_link_libraries(plot_landscapes ${Boost_SYSTEM_LIBRARY})
-
-add_test(NAME plot_landscapes COMMAND $<TARGET_FILE:plot_landscapes>
- "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt")
-
-add_executable ( compute_distance_of_landscapes compute_distance_of_landscapes.cpp )
-target_link_libraries(compute_distance_of_landscapes ${Boost_SYSTEM_LIBRARY})
-
-add_test(NAME compute_distance_of_landscapes COMMAND $<TARGET_FILE:compute_distance_of_landscapes>
- "1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.land"
- "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.land")
-
-add_executable ( compute_scalar_product_of_landscapes compute_scalar_product_of_landscapes.cpp )
-target_link_libraries(compute_scalar_product_of_landscapes ${Boost_SYSTEM_LIBRARY})
-
-add_test(NAME compute_scalar_product_of_landscapes COMMAND $<TARGET_FILE:compute_scalar_product_of_landscapes>
- "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.land"
- "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.land")
+add_persistence_representation_function_utility(average_landscapes ".land")
+add_persistence_representation_function_utility(compute_distance_of_landscapes ".land" "1")
+add_persistence_representation_function_utility(compute_scalar_product_of_landscapes ".land")
diff --git a/src/Persistence_representations/utilities/persistence_landscapes/average_landscapes.cpp b/src/Persistence_representations/utilities/persistence_landscapes/average_landscapes.cpp
index 526130e9..1a59be8c 100644
--- a/src/Persistence_representations/utilities/persistence_landscapes/average_landscapes.cpp
+++ b/src/Persistence_representations/utilities/persistence_landscapes/average_landscapes.cpp
@@ -28,14 +28,13 @@
using Persistence_landscape = Gudhi::Persistence_representations::Persistence_landscape;
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 (you must create them first).\n";
- std::cout << "Please call this program with the names of files with persistence landscapes. The program will create "
- "a persistence landscape which will be their average \n";
+ std::cout << "This program computes average of persistence landscapes stored in files (the files needs to be "
+ << "created beforehand).\n"
+ << "The parameters of this programs are names of files with persistence landscapes.\n";
std::vector<const char*> filenames;
- if (argc == 1) {
- std::cout << "No input files given, the program will now terminate \n";
+ if (argc < 3) {
+ std::cout << "Wrong number of parameters, the program will now terminate \n";
return 1;
}
@@ -43,7 +42,6 @@ int main(int argc, char** argv) {
filenames.push_back(argv[i]);
}
- std::cout << "Creating persistence landscapes...\n";
std::vector<Persistence_landscape*> lands;
for (size_t i = 0; i != filenames.size(); ++i) {
Persistence_landscape* l = new Persistence_landscape;
@@ -60,7 +58,6 @@ int main(int argc, char** argv) {
delete lands[i];
}
- std::cout << "Done \n";
-
+ std::cout << "Average can be found in 'average.land' file\n";
return 0;
}
diff --git a/src/Persistence_representations/utilities/persistence_landscapes/compute_distance_of_landscapes.cpp b/src/Persistence_representations/utilities/persistence_landscapes/compute_distance_of_landscapes.cpp
index b3881d6a..5062f521 100644
--- a/src/Persistence_representations/utilities/persistence_landscapes/compute_distance_of_landscapes.cpp
+++ b/src/Persistence_representations/utilities/persistence_landscapes/compute_distance_of_landscapes.cpp
@@ -30,11 +30,11 @@
using Persistence_landscape = Gudhi::Persistence_representations::Persistence_landscape;
int main(int argc, char** argv) {
- std::cout << "This program compute distance of persistence landscapes stored in a file (the file needs to be created "
- "beforehand). \n";
- std::cout << "The first parameter of a program is an integer p. The program compute L^p distance of the given "
- "landscapes. For L^infty distance choose p = -1. \n";
- std::cout << "The remaining parameters of this programs are names of files with persistence landscapes.";
+ std::cout << "This program computes distance of persistence landscapes stored in files (the files needs to be "
+ << "created beforehand).\n"
+ << "The first parameter of a program is an integer p. The program compute L^p distance of the two heat "
+ << "maps. For L^infty distance choose p = -1. \n"
+ << "The remaining parameters of this program are names of files with persistence landscapes.\n";
if (argc < 3) {
std::cout << "Wrong number of parameters, the program will now terminate \n";
@@ -54,7 +54,6 @@ int main(int argc, char** argv) {
std::vector<Persistence_landscape> landscaspes;
landscaspes.reserve(filenames.size());
for (size_t file_no = 0; file_no != filenames.size(); ++file_no) {
- std::cout << "Loading persistence landscape from a file : " << filenames[file_no] << std::endl;
Persistence_landscape l;
l.load_landscape_from_file(filenames[file_no]);
landscaspes.push_back(l);
@@ -78,7 +77,7 @@ int main(int argc, char** argv) {
// and now output the result to the screen and a file:
std::ofstream out;
- out.open("distance");
+ out.open("distance.land");
for (size_t i = 0; i != distance.size(); ++i) {
for (size_t j = 0; j != distance.size(); ++j) {
std::cout << distance[i][j] << " ";
@@ -89,5 +88,6 @@ int main(int argc, char** argv) {
}
out.close();
+ std::cout << "Distance can be found in 'distance.land' file\n";
return 0;
}
diff --git a/src/Persistence_representations/utilities/persistence_landscapes/compute_scalar_product_of_landscapes.cpp b/src/Persistence_representations/utilities/persistence_landscapes/compute_scalar_product_of_landscapes.cpp
index 8dad7b4d..5b5e9fa3 100644
--- a/src/Persistence_representations/utilities/persistence_landscapes/compute_scalar_product_of_landscapes.cpp
+++ b/src/Persistence_representations/utilities/persistence_landscapes/compute_scalar_product_of_landscapes.cpp
@@ -29,9 +29,14 @@
using Persistence_landscape = Gudhi::Persistence_representations::Persistence_landscape;
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";
- std::cout << "The parameters of this programs are names of files with persistence landscapes.\n";
+ std::cout << "This program computes scalar product of persistence landscapes stored in a file (the file needs to be "
+ << "created beforehand). \n"
+ << "The parameters of this programs are names of files with persistence landscapes.\n";
+
+ if (argc < 3) {
+ std::cout << "Wrong number of parameters, the program will now terminate \n";
+ return 1;
+ }
std::vector<const char*> filenames;
for (int i = 1; i < argc; ++i) {
@@ -40,7 +45,6 @@ int main(int argc, char** argv) {
std::vector<Persistence_landscape> landscaspes;
landscaspes.reserve(filenames.size());
for (size_t file_no = 0; file_no != filenames.size(); ++file_no) {
- std::cout << "Reading persistence landscape from a file : " << filenames[file_no] << std::endl;
Persistence_landscape l;
l.load_landscape_from_file(filenames[file_no]);
landscaspes.push_back(l);
@@ -64,7 +68,7 @@ int main(int argc, char** argv) {
// and now output the result to the screen and a file:
std::ofstream out;
- out.open("scalar_product");
+ out.open("scalar_product.land");
for (size_t i = 0; i != scalar_product.size(); ++i) {
for (size_t j = 0; j != scalar_product.size(); ++j) {
std::cout << scalar_product[i][j] << " ";
@@ -75,5 +79,6 @@ int main(int argc, char** argv) {
}
out.close();
+ std::cout << "Distance can be found in 'scalar_product.land' file\n";
return 0;
}
diff --git a/src/Persistence_representations/utilities/persistence_landscapes/create_landscapes.cpp b/src/Persistence_representations/utilities/persistence_landscapes/create_landscapes.cpp
index 325081d1..6030e994 100644
--- a/src/Persistence_representations/utilities/persistence_landscapes/create_landscapes.cpp
+++ b/src/Persistence_representations/utilities/persistence_landscapes/create_landscapes.cpp
@@ -30,13 +30,20 @@
using Persistence_landscape = Gudhi::Persistence_representations::Persistence_landscape;
int main(int argc, char** argv) {
- std::cout << "This program creates persistence landscapes of diagrams provided as an input. \n";
- std::cout << "The first parameter of the program is the dimension of persistence to be used to construct persistence "
- "landscapes. If your file contains ";
- std::cout << "the information about dimension of persistence pairs, please provide here the dimension of persistence "
- "pairs you want to use. If your input files consist only ";
- std::cout << "of birth-death pairs, please set this first parameter to -1 \n";
- std::cout << "The remaining parameters of the program are the names of files with persistence diagrams. \n";
+ std::cout << "This program creates persistence landscapes files (*.land) of persistence diagrams files (*.pers) "
+ << "provided as an input.\n"
+ << "The first parameter of this program is a dimension of persistence that will be used in creation of "
+ << "the persistence heat maps."
+ << "If your input files contains persistence pairs of various dimension, as a first parameter of the "
+ << "procedure please provide the dimension of persistence you want to use."
+ << "If in your files there are only birth-death pairs of the same dimension, set the first parameter to "
+ << "-1.\n"
+ << "The remaining parameters are the names of files with persistence diagrams. \n";
+
+ if (argc < 3) {
+ std::cout << "Wrong parameter list, the program will now terminate \n";
+ return 1;
+ }
std::vector<const char*> filenames;
int dim = atoi(argv[1]);
unsigned dimension = std::numeric_limits<unsigned>::max();
@@ -47,13 +54,12 @@ int main(int argc, char** argv) {
filenames.push_back(argv[i]);
}
- std::cout << "Creating persistence landscapes...\n";
for (size_t i = 0; i != filenames.size(); ++i) {
+ std::cout << "Creating a landscape based on file : " << filenames[i] << std::endl;
Persistence_landscape l(filenames[i], dimension);
std::stringstream ss;
ss << filenames[i] << ".land";
l.print_to_file(ss.str().c_str());
}
- std::cout << "Done \n";
return 0;
}
diff --git a/src/Persistence_representations/utilities/persistence_landscapes/plot_landscapes.cpp b/src/Persistence_representations/utilities/persistence_landscapes/plot_landscapes.cpp
index ebdb20a1..c797a7a8 100644
--- a/src/Persistence_representations/utilities/persistence_landscapes/plot_landscapes.cpp
+++ b/src/Persistence_representations/utilities/persistence_landscapes/plot_landscapes.cpp
@@ -28,16 +28,16 @@
using Persistence_landscape = Gudhi::Persistence_representations::Persistence_landscape;
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";
+ std::cout << "This program creates a gnuplot script from a persistence landscape stored in a file (the file needs "
+ << "to be created beforehand). Please call the code with the name of a single landscape file.\n";
+ if (argc != 2) {
+ std::cout << "Wrong parameter list, the program will now terminate \n";
+ return 1;
+ }
+
Persistence_landscape l;
l.load_landscape_from_file(argv[1]);
-
- std::stringstream ss;
- ss << argv[1] << "_gnuplot_script";
- l.plot(ss.str().c_str());
-
- std::cout << "Done \n";
+ l.plot(argv[1]);
return 0;
}
diff --git a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt
index 55a4fd50..c5ea4bbf 100644
--- a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt
+++ b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt
@@ -1,38 +1,11 @@
cmake_minimum_required(VERSION 2.6)
project(Persistence_representations_lanscapes_on_grid_utilities)
-file(COPY "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/")
+# Need to set grid min and max for further average, distance and scalar_product
+add_persistence_representation_creation_utility(create_landscapes_on_grid "100" "0" "35" "-1")
-add_executable ( create_landscapes_on_grid create_landscapes_on_grid.cpp )
-target_link_libraries(create_landscapes_on_grid ${Boost_SYSTEM_LIBRARY})
+add_persistence_representation_plot_utility(plot_landscapes_on_grid ".g_land")
-# Will create simple_diagram.txt.land
-add_test(NAME create_landscapes_on_grid COMMAND $<TARGET_FILE:create_landscapes_on_grid>
- "100" "-1" "-1" "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt")
-
-add_executable ( average_landscapes_on_grid average_landscapes_on_grid.cpp )
-target_link_libraries(average_landscapes_on_grid ${Boost_SYSTEM_LIBRARY})
-
-add_test(NAME average_landscapes_on_grid COMMAND $<TARGET_FILE:average_landscapes_on_grid>
- "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.g_land"
- "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.g_land")
-
-add_executable ( plot_landscapes_on_grid plot_landscapes_on_grid.cpp )
-target_link_libraries(plot_landscapes_on_grid ${Boost_SYSTEM_LIBRARY})
-
-add_test(NAME plot_landscapes_on_grid COMMAND $<TARGET_FILE:plot_landscapes_on_grid>
- "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.g_land")
-
-add_executable ( compute_distance_of_landscapes_on_grid compute_distance_of_landscapes_on_grid.cpp )
-target_link_libraries(compute_distance_of_landscapes_on_grid ${Boost_SYSTEM_LIBRARY})
-
-add_test(NAME compute_distance_of_landscapes_on_grid COMMAND $<TARGET_FILE:compute_distance_of_landscapes_on_grid>
- "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.g_land"
- "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.g_land")
-
-add_executable ( compute_scalar_product_of_landscapes_on_grid compute_scalar_product_of_landscapes_on_grid.cpp )
-target_link_libraries(compute_scalar_product_of_landscapes_on_grid ${Boost_SYSTEM_LIBRARY})
-
-add_test(NAME compute_scalar_product_of_landscapes_on_grid COMMAND $<TARGET_FILE:compute_scalar_product_of_landscapes_on_grid>
- "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.g_land"
- "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.g_land")
+add_persistence_representation_function_utility(average_landscapes_on_grid ".g_land")
+add_persistence_representation_function_utility(compute_distance_of_landscapes_on_grid ".g_land" "1")
+add_persistence_representation_function_utility(compute_scalar_product_of_landscapes_on_grid ".g_land")
diff --git a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/average_landscapes_on_grid.cpp b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/average_landscapes_on_grid.cpp
index d50118a0..0b098d1a 100644
--- a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/average_landscapes_on_grid.cpp
+++ b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/average_landscapes_on_grid.cpp
@@ -28,21 +28,20 @@
using Persistence_landscape_on_grid = Gudhi::Persistence_representations::Persistence_landscape_on_grid;
int main(int argc, char** argv) {
- std::cout << "This program computes average persistence landscape on grid of persistence landscapes on grid created "
- "based on persistence diagrams provided as an input. Please call this program with the names of files "
- "with persistence diagrams \n";
- std::vector<const char*> filenames;
+ std::cout << "This program computes average of persistence landscapes on grid stored in files (the files needs to "
+ << "be created beforehand).\n"
+ << "The parameters of this programs are names of files with persistence landscapes on grid.\n";
- if (argc == 1) {
- std::cout << "No input files given, the program will now terminate \n";
+ if (argc < 3) {
+ std::cout << "Wrong number of parameters, the program will now terminate \n";
return 1;
}
+ std::vector<const char*> filenames;
for (int i = 1; i < argc; ++i) {
filenames.push_back(argv[i]);
}
- std::cout << "Creating persistence landscapes...\n";
std::vector<Persistence_landscape_on_grid*> lands;
for (size_t i = 0; i != filenames.size(); ++i) {
Persistence_landscape_on_grid* l = new Persistence_landscape_on_grid;
@@ -59,7 +58,6 @@ int main(int argc, char** argv) {
delete lands[i];
}
- std::cout << "Done \n";
-
+ std::cout << "Average can be found in 'average.g_land' file\n";
return 0;
}
diff --git a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp
index 859c6991..fd0fcd15 100644
--- a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp
+++ b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp
@@ -30,11 +30,11 @@
using Persistence_landscape_on_grid = Gudhi::Persistence_representations::Persistence_landscape_on_grid;
int main(int argc, char** argv) {
- std::cout << "This program compute distance of persistence landscapes on grid stored in a file (the file needs to be "
- "created beforehand). \n";
- std::cout << "The first parameter of a program is an integer p. The program compute L^p distance of the landscapes "
- "on grid. For L^infty distance choose p = -1. \n";
- std::cout << "The remaining parameters of this programs are names of files with persistence landscapes on grid.\n";
+ std::cout << "This program computes distance of persistence landscapes on grid stored in files (the files needs to "
+ << "be created beforehand).\n"
+ << "The first parameter of a program is an integer p. The program compute L^p distance of the two heat "
+ << "maps. For L^infty distance choose p = -1. \n"
+ << "The remaining parameters of this program are names of files with persistence landscapes on grid.\n";
if (argc < 3) {
std::cout << "Wrong number of parameters, the program will now terminate \n";
@@ -77,7 +77,7 @@ int main(int argc, char** argv) {
// and now output the result to the screen and a file:
std::ofstream out;
- out.open("distance");
+ out.open("distance.g_land");
for (size_t i = 0; i != distance.size(); ++i) {
for (size_t j = 0; j != distance.size(); ++j) {
std::cout << distance[i][j] << " ";
@@ -88,5 +88,6 @@ int main(int argc, char** argv) {
}
out.close();
+ std::cout << "Distance can be found in 'distance.g_land' file\n";
return 0;
}
diff --git a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp
index e95bf8ad..e2222487 100644
--- a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp
+++ b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp
@@ -29,9 +29,14 @@
using Persistence_landscape_on_grid = Gudhi::Persistence_representations::Persistence_landscape_on_grid;
int main(int argc, char** argv) {
- std::cout << "This program compute scalar product of persistence landscapes on grid stored in a file (the file needs "
- "to be created beforehand). \n";
- std::cout << "The parameters of this programs are names of files with persistence landscapes on grid.\n";
+ std::cout << "This program computes scalar product of persistence landscapes on grid stored in a file (the file needs to "
+ << "be created beforehand). \n"
+ << "The parameters of this programs are names of files with persistence landscapes on grid.\n";
+
+ if (argc < 3) {
+ std::cout << "Wrong number of parameters, the program will now terminate \n";
+ return 1;
+ }
std::vector<const char*> filenames;
for (int i = 1; i < argc; ++i) {
@@ -63,7 +68,7 @@ int main(int argc, char** argv) {
// and now output the result to the screen and a file:
std::ofstream out;
- out.open("scalar_product");
+ out.open("scalar_product.g_land");
for (size_t i = 0; i != scalar_product.size(); ++i) {
for (size_t j = 0; j != scalar_product.size(); ++j) {
std::cout << scalar_product[i][j] << " ";
@@ -74,5 +79,6 @@ int main(int argc, char** argv) {
}
out.close();
+ std::cout << "Distance can be found in 'scalar_product.g_land' file\n";
return 0;
}
diff --git a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp
index 8d747c14..2827f982 100644
--- a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp
+++ b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp
@@ -30,22 +30,25 @@
using Persistence_landscape_on_grid = Gudhi::Persistence_representations::Persistence_landscape_on_grid;
int main(int argc, char** argv) {
- std::cout << "This program creates persistence landscape on grid of diagrams provided as an input.\n";
- std::cout << "The first parameter of a program is an integer, a size of a grid.\n";
- std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed "
- "based on the data, set them both to -1 \n";
- std::cout << "The fourth parameter of the program is the dimension of persistence to be used to construct "
- "persistence landscape on a grid. If your file contains ";
- std::cout << "the information about dimension of birth-death pairs, please provide here the dimension of intervals "
- "you want to use. If your input files consist only ";
- std::cout << "of birth-death pairs, please set the fourth parameter to -1 \n";
- std::cout << "The remaining parameters are the names of files with persistence diagrams. \n";
+ std::cout << "This program creates persistence landscapes on grid files (*.g_land) of persistence diagrams files "
+ << "(*.pers) provided as an input.\n"
+ << "The first parameter of a program is an integer, a size of a grid.\n"
+ << "The second and third parameters are min and max of the grid. If you want those numbers to be computed "
+ << "based on the data, set them both to -1 \n"
+ << "The fourth parameter of this program is a dimension of persistence that will be used in creation of "
+ << "the persistence heat maps."
+ << "If your input files contains persistence pairs of various dimension, as a fourth parameter of the "
+ << "procedure please provide the dimension of persistence you want to use."
+ << "If in your files there are only birth-death pairs of the same dimension, set the fourth parameter to "
+ << "-1.\n"
+ << "The remaining parameters are the names of files with persistence diagrams. \n";
- if (argc < 5) {
+ if (argc < 6) {
std::cout << "Wrong parameter list, the program will now terminate \n";
return 1;
}
+
size_t size_of_grid = (size_t)atoi(argv[1]);
double min_ = atof(argv[2]);
double max_ = atof(argv[3]);
@@ -60,7 +63,6 @@ int main(int argc, char** argv) {
filenames.push_back(argv[i]);
}
- std::cout << "Creating persistence landscapes...\n";
for (size_t i = 0; i != filenames.size(); ++i) {
std::cout << "Creating persistence landscape on a grid based on a file : " << filenames[i] << std::endl;
Persistence_landscape_on_grid l;
@@ -74,6 +76,5 @@ int main(int argc, char** argv) {
ss << filenames[i] << ".g_land";
l.print_to_file(ss.str().c_str());
}
- std::cout << "Done \n";
return 0;
}
diff --git a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp
index 42822a01..dddb3615 100644
--- a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp
+++ b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp
@@ -28,20 +28,17 @@
using Persistence_landscape_on_grid = Gudhi::Persistence_representations::Persistence_landscape_on_grid;
int main(int argc, char** argv) {
- std::cout << "This program plot persistence landscape on grid stored in a file (the file needs to be created "
- "beforehand). Please call the code with the name of a landscape on grid file \n";
- if (argc == 1) {
- std::cout << "Wrong parameters of a program call, the program will now terminate \n";
+ std::cout << "This program creates a gnuplot script from a persistence landscape on grid stored in a file (the file "
+ << "needs to be created beforehand). Please call the code with the name of a single landscape on grid file"
+ << ".\n";
+ if (argc != 2) {
+ std::cout << "Wrong parameter list, the program will now terminate \n";
return 1;
}
+
Persistence_landscape_on_grid l;
l.load_landscape_from_file(argv[1]);
-
- std::stringstream ss;
- ss << argv[1] << "_gnuplot_script";
- l.plot(ss.str().c_str());
-
- std::cout << "Done \n";
+ l.plot(argv[1]);
return 0;
}
diff --git a/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt
index e3d1013b..a401c955 100644
--- a/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt
+++ b/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt
@@ -1,38 +1,10 @@
cmake_minimum_required(VERSION 2.6)
project(Persistence_vectors_utilities)
-file(COPY "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/")
+add_persistence_representation_creation_utility(create_persistence_vectors "-1")
-add_executable ( create_persistence_vectors create_persistence_vectors.cpp )
-target_link_libraries(create_persistence_vectors ${Boost_SYSTEM_LIBRARY})
+add_persistence_representation_plot_utility(plot_persistence_vectors ".vect")
-# Will create simple_diagram.txt.vect
-add_test(NAME create_persistence_vectors COMMAND $<TARGET_FILE:create_persistence_vectors>
- "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt")
-
-add_executable ( average_persistence_vectors average_persistence_vectors.cpp )
-target_link_libraries(average_persistence_vectors ${Boost_SYSTEM_LIBRARY})
-
-add_test(NAME average_persistence_vectors COMMAND $<TARGET_FILE:average_persistence_vectors>
- "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.vect"
- "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.vect")
-
-add_executable ( compute_distance_of_persistence_vectors compute_distance_of_persistence_vectors.cpp )
-target_link_libraries(compute_distance_of_persistence_vectors ${Boost_SYSTEM_LIBRARY})
-
-add_test(NAME compute_distance_of_persistence_vectors COMMAND $<TARGET_FILE:compute_distance_of_persistence_vectors>
- "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.vect"
- "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.vect")
-
-add_executable ( compute_scalar_product_of_persistence_vectors compute_scalar_product_of_persistence_vectors.cpp )
-target_link_libraries(compute_scalar_product_of_persistence_vectors ${Boost_SYSTEM_LIBRARY})
-
-add_test(NAME compute_scalar_product_of_persistence_vectors COMMAND $<TARGET_FILE:compute_scalar_product_of_persistence_vectors>
- "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.vect"
- "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.vect")
-
-add_executable ( plot_persistence_vectors plot_persistence_vectors.cpp )
-target_link_libraries(plot_persistence_vectors ${Boost_SYSTEM_LIBRARY})
-
-add_test(NAME plot_persistence_vectors COMMAND $<TARGET_FILE:plot_persistence_vectors>
- "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.vect")
+add_persistence_representation_function_utility(average_persistence_vectors ".vect")
+add_persistence_representation_function_utility(compute_distance_of_persistence_vectors ".vect" "1")
+add_persistence_representation_function_utility(compute_scalar_product_of_persistence_vectors ".vect")
diff --git a/src/Persistence_representations/utilities/persistence_vectors/average_persistence_vectors.cpp b/src/Persistence_representations/utilities/persistence_vectors/average_persistence_vectors.cpp
index 366ee2bc..8de7725c 100644
--- a/src/Persistence_representations/utilities/persistence_vectors/average_persistence_vectors.cpp
+++ b/src/Persistence_representations/utilities/persistence_vectors/average_persistence_vectors.cpp
@@ -30,21 +30,20 @@ using Vector_distances_in_diagram =
Gudhi::Persistence_representations::Vector_distances_in_diagram<Euclidean_distance>;
int main(int argc, char** argv) {
- std::cout << "This program computes average persistence vector of persistence vectors created based on persistence "
- "diagrams provided as an input. \n";
- std::cout << "Please call this program with the names of files with persistence diagrams \n";
- std::vector<const char*> filenames;
+ std::cout << "This program computes average of persistence vectors stored in files (the files needs to "
+ << "be created beforehand).\n"
+ << "The parameters of this programs are names of files with persistence vectors.\n";
- if (argc == 1) {
- std::cout << "No input files given, the program will now terminate \n";
+ if (argc < 3) {
+ std::cout << "Wrong number of parameters, the program will now terminate \n";
return 1;
}
+ std::vector<const char*> filenames;
for (int i = 1; i < argc; ++i) {
filenames.push_back(argv[i]);
}
- std::cout << "Reading persistence vectors...\n";
std::vector<Vector_distances_in_diagram*> lands;
for (size_t i = 0; i != filenames.size(); ++i) {
Vector_distances_in_diagram* l = new Vector_distances_in_diagram;
diff --git a/src/Persistence_representations/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp b/src/Persistence_representations/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp
index 3aed297e..f8b71e5b 100644
--- a/src/Persistence_representations/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp
+++ b/src/Persistence_representations/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp
@@ -79,7 +79,7 @@ int main(int argc, char** argv) {
// and now output the result to the screen and a file:
std::ofstream out;
- out.open("distance");
+ out.open("distance.vect");
for (size_t i = 0; i != distance.size(); ++i) {
for (size_t j = 0; j != distance.size(); ++j) {
std::cout << distance[i][j] << " ";
@@ -90,5 +90,6 @@ int main(int argc, char** argv) {
}
out.close();
+ std::cout << "Distance can be found in 'distance.vect' file\n";
return 0;
}
diff --git a/src/Persistence_representations/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp b/src/Persistence_representations/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp
index d9ad4360..bda0b61b 100644
--- a/src/Persistence_representations/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp
+++ b/src/Persistence_representations/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp
@@ -32,9 +32,14 @@ using Vector_distances_in_diagram =
Gudhi::Persistence_representations::Vector_distances_in_diagram<Euclidean_distance>;
int main(int argc, char** argv) {
- std::cout << "This program compute scalar product of persistence vectors stored in a file (the file needs to be "
- "created beforehand). \n";
- std::cout << "The parameters of this programs are names of files with persistence vectors.\n";
+ std::cout << "This program computes scalar product of persistence vectors stored in a file (the file needs to "
+ << "be created beforehand). \n"
+ << "The parameters of this programs are names of files with persistence vectors.\n";
+
+ if (argc < 3) {
+ std::cout << "Wrong number of parameters, the program will now terminate \n";
+ return 1;
+ }
std::vector<const char*> filenames;
for (int i = 1; i < argc; ++i) {
@@ -66,7 +71,7 @@ int main(int argc, char** argv) {
// and now output the result to the screen and a file:
std::ofstream out;
- out.open("scalar_product");
+ out.open("scalar_product.vect");
for (size_t i = 0; i != scalar_product.size(); ++i) {
for (size_t j = 0; j != scalar_product.size(); ++j) {
std::cout << scalar_product[i][j] << " ";
@@ -76,5 +81,7 @@ int main(int argc, char** argv) {
out << std::endl;
}
out.close();
+
+ std::cout << "Distance can be found in 'scalar_product.vect' file\n";
return 0;
}
diff --git a/src/Persistence_representations/utilities/persistence_vectors/create_persistence_vectors.cpp b/src/Persistence_representations/utilities/persistence_vectors/create_persistence_vectors.cpp
index b618ca67..753675cb 100644
--- a/src/Persistence_representations/utilities/persistence_vectors/create_persistence_vectors.cpp
+++ b/src/Persistence_representations/utilities/persistence_vectors/create_persistence_vectors.cpp
@@ -32,13 +32,21 @@ using Vector_distances_in_diagram =
Gudhi::Persistence_representations::Vector_distances_in_diagram<Euclidean_distance>;
int main(int argc, char** argv) {
- std::cout << "This program creates persistence vectors of diagrams provided as an input. The first parameter of this "
- "program is a dimension of persistence ";
- std::cout << " that will be used in creation of the persistence vectors. If our input files contain persistence "
- "pairs of various dimension, as a second parameter of the ";
- std::cout << " procedure please provide the dimension of persistence you want to use. If in your file there are only "
- "birth-death pairs of the same dimension, set the first parameter to -1."
- << std::endl;
+ std::cout << "This program creates persistence vectors files (*.vect) of persistence diagrams files (*.pers) "
+ << "provided as an input.\n"
+ << "The first parameter of this program is a dimension of persistence that will be used in creation of "
+ << "the persistence heat maps."
+ << "If your input files contains persistence pairs of various dimension, as a first parameter of the "
+ << "procedure please provide the dimension of persistence you want to use."
+ << "If in your files there are only birth-death pairs of the same dimension, set the first parameter to "
+ << "-1.\n"
+ << "The remaining parameters are the names of files with persistence diagrams. \n";
+
+ if (argc < 3) {
+ std::cout << "Wrong parameter list, the program will now terminate \n";
+ return 1;
+ }
+
std::cout << "The remaining parameters are the names of files with persistence diagrams. \n";
int dim = atoi(argv[1]);
unsigned dimension = std::numeric_limits<unsigned>::max();
@@ -58,6 +66,5 @@ int main(int argc, char** argv) {
ss << filenames[i] << ".vect";
l.print_to_file(ss.str().c_str());
}
- std::cout << "Done \n";
return 0;
}
diff --git a/src/cmake/modules/GUDHI_third_party_libraries.cmake b/src/cmake/modules/GUDHI_third_party_libraries.cmake
index 8269c3bf..e44bbe04 100644
--- a/src/cmake/modules/GUDHI_third_party_libraries.cmake
+++ b/src/cmake/modules/GUDHI_third_party_libraries.cmake
@@ -85,7 +85,6 @@ FIND_PROGRAM( GCOVR_PATH gcovr )
if (GCOVR_PATH)
message("gcovr found in ${GCOVR_PATH}")
endif()
-# Required programs for unitary tests purpose
FIND_PROGRAM( GPROF_PATH gprof )
if (GPROF_PATH)
message("gprof found in ${GPROF_PATH}")
@@ -94,6 +93,10 @@ FIND_PROGRAM( DIFF_PATH diff )
if (DIFF_PATH)
message("diff found in ${DIFF_PATH}")
endif()
+FIND_PROGRAM( GNUPLOT_PATH gnuplot )
+if (GNUPLOT_PATH)
+ message("gnuplot found in ${GNUPLOT_PATH}")
+endif()
# BOOST ISSUE result_of vs C++11
add_definitions(-DBOOST_RESULT_OF_USE_DECLTYPE)