summaryrefslogtreecommitdiff
path: root/src/Persistence_representations/utilities/persistence_landscapes/average_landscapes.cpp
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-05-30 15:52:00 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-05-30 15:52:00 +0000
commit9d1a526de85694b5f075bb88dbd7097a40abf10a (patch)
treebbcd0cef32610d2f5e9c0209b48c58f73fbf379a /src/Persistence_representations/utilities/persistence_landscapes/average_landscapes.cpp
parent2bcb3d7cb47ce71803f2464cc822346ed2e1b039 (diff)
clang format all sources
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/persistence_representation_integration@2477 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 326d664483d6700f82be824f79a0bf5c082b4945
Diffstat (limited to 'src/Persistence_representations/utilities/persistence_landscapes/average_landscapes.cpp')
-rw-r--r--src/Persistence_representations/utilities/persistence_landscapes/average_landscapes.cpp76
1 files changed, 34 insertions, 42 deletions
diff --git a/src/Persistence_representations/utilities/persistence_landscapes/average_landscapes.cpp b/src/Persistence_representations/utilities/persistence_landscapes/average_landscapes.cpp
index 1e0caa30..9816ff1d 100644
--- a/src/Persistence_representations/utilities/persistence_landscapes/average_landscapes.cpp
+++ b/src/Persistence_representations/utilities/persistence_landscapes/average_landscapes.cpp
@@ -20,55 +20,47 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
-
#include <gudhi/Persistence_landscape.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 (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::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_landscape*> lands;
+ for (size_t i = 0; i != filenames.size(); ++i) {
+ Persistence_landscape* l = new Persistence_landscape;
+ l->load_landscape_from_file(filenames[i]);
+ lands.push_back(l);
+ }
+
+ Persistence_landscape av;
+ av.compute_average(lands);
+
+ av.print_to_file("average.land");
+
+ for (size_t i = 0; i != filenames.size(); ++i) {
+ delete lands[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 (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::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_landscape* > lands;
- for ( size_t i = 0 ; i != filenames.size() ; ++i )
- {
- Persistence_landscape* l = new Persistence_landscape;
- l->load_landscape_from_file( filenames[i] );
- lands.push_back( l );
- }
-
- Persistence_landscape av;
- av.compute_average( lands );
-
- av.print_to_file( "average.land" );
-
- for ( size_t i = 0 ; i != filenames.size() ; ++i )
- {
- delete lands[i];
- }
-
- std::cout << "Done \n";
+ std::cout << "Done \n";
- return 0;
+ return 0;
}