summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpdlotko <pdlotko@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-09-26 09:05:10 +0000
committerpdlotko <pdlotko@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-09-26 09:05:10 +0000
commitadfad214ae49658a3ad5578a2bcba7bb323849ef (patch)
tree804ee1347ed8b0df522cfd5f17cfb27b081b59df /src
parent8dd721b679fa47fba3fed14cf06b8cc64f3c2e1b (diff)
adding vizialuzation subroutine for persistence vectors. Now the list of utilities is the same for all representations of persistence.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/gudhi_stat@1563 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: a84a0ab5d9951b8f140b4d86b632b2e91aefe6b8
Diffstat (limited to 'src')
-rw-r--r--src/Gudhi_stat/example/CMakeLists.txt2
-rw-r--r--src/Gudhi_stat/include/gudhi/concretizations/Vector_distances_in_diagram.h45
2 files changed, 46 insertions, 1 deletions
diff --git a/src/Gudhi_stat/example/CMakeLists.txt b/src/Gudhi_stat/example/CMakeLists.txt
index 0dd35dd6..e7573cc6 100644
--- a/src/Gudhi_stat/example/CMakeLists.txt
+++ b/src/Gudhi_stat/example/CMakeLists.txt
@@ -99,4 +99,6 @@ target_link_libraries(utilities/persistence_vectors/compute_distance_of_persiste
add_executable ( utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp )
target_link_libraries(utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors ${Boost_SYSTEM_LIBRARY})
+add_executable ( utilities/persistence_vectors/plot_persistence_vectors utilities/persistence_vectors/plot_persistence_vectors.cpp )
+target_link_libraries(utilities/persistence_vectors/plot_persistence_vectors ${Boost_SYSTEM_LIBRARY})
diff --git a/src/Gudhi_stat/include/gudhi/concretizations/Vector_distances_in_diagram.h b/src/Gudhi_stat/include/gudhi/concretizations/Vector_distances_in_diagram.h
index 8c3d0f37..5870c652 100644
--- a/src/Gudhi_stat/include/gudhi/concretizations/Vector_distances_in_diagram.h
+++ b/src/Gudhi_stat/include/gudhi/concretizations/Vector_distances_in_diagram.h
@@ -170,17 +170,60 @@ public:
}
//concretization of abstract methods:
+ /**
+ * Compute projection to real numbers of persistence vector.
+ **/
double project_to_R( int number_of_function );
+
+ /**
+ * Compute a vectorization of a persistent vectors.
+ **/
std::vector<double> vectorize( int number_of_function );
+
+ /**
+ * Compute a average of two persistent vectors.
+ **/
void compute_average( std::vector< Abs_Topological_data_with_averages* > to_average );
+
+ /**
+ * Compute a distance of two persistent vectors.
+ **/
double distance( const Abs_Topological_data_with_distances* second , double power = 1);
+
+ /**
+ * Compute a scalar product of two persistent vectors.
+ **/
double compute_scalar_product( const Abs_Topological_data_with_scalar_product* second );
- //For visualization use output from vectorize and build histograms.
+ /**
+ * For visualization use output from vectorize and build histograms.
+ **/
std::vector< double > output_for_visualization()
{
return this->sorted_vector_of_distnaces;
}
+
+ /**
+ * Create a gnuplot script to vizualize the data structure.
+ **/
+ void plot( const char* filename )
+ {
+ std::stringstream gnuplot_script;
+ gnuplot_script << filename << "_Gnuplot_script";
+ ofstream out;
+ out.open( gnuplot_script.str().c_str() );
+ out << "set style data histogram" << std::endl;
+ out << "set style histogram cluster gap 1" << std::endl;
+ out << "set style fill solid border -1" << std::endl;
+ out << "plot '-' notitle" << std::endl;
+ for ( size_t i = 0 ; i != this->sorted_vector_of_distnaces.size() ; ++i )
+ {
+ out << this->sorted_vector_of_distnaces[i] << std::endl;
+ }
+ out << endl;
+ out.close();
+ std::cout << "To vizualize, open gnuplot and type: load \'" << gnuplot_script.str().c_str() << "\'" << std::endl;
+ }
private: