summaryrefslogtreecommitdiff
path: root/src/Persistence_representations/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Persistence_representations/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp')
-rw-r--r--src/Persistence_representations/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp74
1 files changed, 33 insertions, 41 deletions
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 2d221d27..34fdb1f8 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
@@ -20,53 +20,45 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
-
#include <gudhi/Persistence_heat_maps.h>
-
-
using namespace Gudhi;
using namespace Gudhi::Persistence_representations;
#include <iostream>
+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;
+
+ if (argc == 1) {
+ std::cout << "No input files given, the program will now terminate \n";
+ return 1;
+ }
+
+ for (int i = 1; i < argc; ++i) {
+ filenames.push_back(argv[i]);
+ }
+
+ std::cout << "Creating persistence landscapes...\n";
+ std::vector<Persistence_heat_maps<constant_scaling_function>*> maps;
+ for (size_t i = 0; i != filenames.size(); ++i) {
+ Persistence_heat_maps<constant_scaling_function>* l = new Persistence_heat_maps<constant_scaling_function>;
+ l->load_from_file(filenames[i]);
+ maps.push_back(l);
+ }
+
+ Persistence_heat_maps<constant_scaling_function> av;
+ av.compute_average(maps);
+
+ av.print_to_file("average.mps");
+
+ for (size_t i = 0; i != filenames.size(); ++i) {
+ delete maps[i];
+ }
-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;
-
- if ( argc == 1 )
- {
- std::cout << "No input files given, the program will now terminate \n";
- return 1;
- }
-
- for ( int i = 1 ; i < argc ; ++i )
- {
- filenames.push_back( argv[i] );
- }
-
- std::cout << "Creating persistence landscapes...\n";
- std::vector< Persistence_heat_maps<constant_scaling_function>* > maps;
- for ( size_t i = 0 ; i != filenames.size() ; ++i )
- {
- Persistence_heat_maps<constant_scaling_function>* l = new Persistence_heat_maps<constant_scaling_function>;
- l->load_from_file( filenames[i] );
- maps.push_back( l );
- }
-
- Persistence_heat_maps<constant_scaling_function> 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";
- return 0;
+ std::cout << "Done \n";
+ return 0;
}