Loading...
Searching...
No Matches
Persistence_vectors.h
1/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
2 * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
3 * Author(s): Pawel Dlotko
4 *
5 * Copyright (C) 2016 Inria
6 *
7 * Modification(s):
8 * - 2025/06 Hannah Schreiber: Various small bug fixes (missing `inline`s, `DEBUG_TRACES`s etc.)
9 * - YYYY/MM Author: Description of the modification
10 */
11
12#ifndef PERSISTENCE_VECTORS_H_
13#define PERSISTENCE_VECTORS_H_
14
15// standard include
16#ifdef DEBUG_TRACES
17#include <iostream> // std::cerr, std::clog
18#endif
19#include <ostream> // std::ostream
20#include <fstream> // std::ofstream, std::ifstream
21#include <sstream> // std::stringstream
22#include <stdexcept> // std::invalid_argument
23#include <cstddef> // std::size_t
24#include <cmath> // std::min, std::max, std::pow, std::fabs
25#include <algorithm> // std::make_heap, std::pop_heap, std::push_heap, std::sort
26#include <limits> // std::numeric_limits
27#include <utility> // std::pair
28#include <vector>
29
30// gudhi include
31#include <gudhi/read_persistence_from_file.h>
33#include <gudhi/Debug_utils.h>
34
35namespace Gudhi {
36namespace Persistence_representations {
37
38// TODO: the template F is only used in the constructor to build `sorted_vector_of_distances_`. Once done it is
39// used nowhere anymore or did I miss something?
40// Would it not be better to pass the method as argument to the constructor?
41// But I guess, that won't be retro-compatible anymore...
57template <typename F>
59{
60 public:
65
70 Vector_distances_in_diagram(const std::vector<std::pair<double, double> >& intervals, std::size_t where_to_cut)
71 : intervals_(intervals), where_to_cut_(where_to_cut)
72 {
73 this->_compute_sorted_vector_of_distances_via_vector_sorting();
74 this->_set_up_numbers_of_functions_for_vectorization_and_projections_to_reals();
75 }
76
81 Vector_distances_in_diagram(const char* filename,
82 std::size_t where_to_cut,
83 unsigned int dimension = std::numeric_limits<unsigned int>::max())
85 filename,
86 dimension == std::numeric_limits<unsigned int>::max() ? -1 : static_cast<int>(dimension))),
87 where_to_cut_(where_to_cut)
88 {
89 this->_compute_sorted_vector_of_distances_via_heap();
90 _set_up_numbers_of_functions_for_vectorization_and_projections_to_reals();
91 }
92
96 friend std::ostream& operator<<(std::ostream& out, const Vector_distances_in_diagram& d)
97 {
98 for (std::size_t i = 0; i != std::min(d.sorted_vector_of_distances_.size(), d.where_to_cut_); ++i) {
99 out << d.sorted_vector_of_distances_[i] << " ";
100 }
101 return out;
102 }
103
107 double vector_in_position(std::size_t position) const
108 {
109 if (position >= this->sorted_vector_of_distances_.size())
110 throw("Wrong position in accessing Vector_distances_in_diagram::sorted_vector_of_distances_\n");
111 return this->sorted_vector_of_distances_[position];
112 }
113
117 std::size_t size() const { return this->sorted_vector_of_distances_.size(); }
118
122 void write_to_file(const char* filename) const;
123
127 void print_to_file(const char* filename) const { this->write_to_file(filename); }
128
132 void load_from_file(const char* filename);
133
137 bool operator==(const Vector_distances_in_diagram& second) const
138 {
139 if (this->sorted_vector_of_distances_.size() != second.sorted_vector_of_distances_.size()) return false;
140 for (std::size_t i = 0; i != this->sorted_vector_of_distances_.size(); ++i) {
141 if (!almost_equal(this->sorted_vector_of_distances_[i], second.sorted_vector_of_distances_[i])) return false;
142 }
143 return true;
144 }
145
146 bool operator!=(const Vector_distances_in_diagram& second) const { return !(*this == second); }
147
148 // Implementations of functions for various concepts.
155 double project_to_R(int number_of_function) const;
156
161 std::size_t number_of_projections_to_R() const { return this->number_of_functions_for_projections_to_reals_; }
162
166 std::vector<double> vectorize(int number_of_function) const;
167
172 std::size_t number_of_vectorize_functions() const { return this->number_of_functions_for_vectorization_; }
173
177 void compute_average(const std::vector<Vector_distances_in_diagram*>& to_average);
178
183 double distance(const Vector_distances_in_diagram& second, double power = 1) const;
184
190
191 // end of implementation of functions needed for concepts.
192
196 const std::vector<double>& output_for_visualization() const { return this->sorted_vector_of_distances_; }
197
201 void plot(const char* filename) const
202 {
203 std::stringstream gnuplot_script;
204 gnuplot_script << filename << "_GnuplotScript";
205 std::ofstream out;
206 out.open(gnuplot_script.str().c_str());
207 out << "set style data histogram" << std::endl;
208 out << "set style histogram cluster gap 1" << std::endl;
209 out << "set style fill solid border -1" << std::endl;
210 out << "plot '-' notitle" << std::endl;
211 for (std::size_t i = 0; i != this->sorted_vector_of_distances_.size(); ++i) {
212 out << this->sorted_vector_of_distances_[i] << std::endl;
213 }
214 out << std::endl;
215 out.close();
216#ifdef DEBUG_TRACES
217 std::clog << "To visualize, install gnuplot and type the command: gnuplot -persist -e \"load \'"
218 << gnuplot_script.str().c_str() << "\'\"" << std::endl;
219#endif
220 }
221
225 std::pair<double, double> get_x_range() const { return std::make_pair(0, this->sorted_vector_of_distances_.size()); }
226
230 std::pair<double, double> get_y_range() const
231 {
232 if (this->sorted_vector_of_distances_.size() == 0) return std::make_pair(0, 0);
233 return std::make_pair(this->sorted_vector_of_distances_[0], 0);
234 }
235
236 // arithmetic operations:
237 template <typename Operation>
238 friend Vector_distances_in_diagram operation_on_pair_of_vectors(const Vector_distances_in_diagram& first,
239 const Vector_distances_in_diagram& second,
240 Operation&& operation)
241 {
243 result.sorted_vector_of_distances_.reserve(
244 std::max(first.sorted_vector_of_distances_.size(), second.sorted_vector_of_distances_.size()));
245 for (std::size_t i = 0;
246 i != std::min(first.sorted_vector_of_distances_.size(), second.sorted_vector_of_distances_.size());
247 ++i) {
248 result.sorted_vector_of_distances_.push_back(
249 operation(first.sorted_vector_of_distances_[i], second.sorted_vector_of_distances_[i]));
250 }
251 if (first.sorted_vector_of_distances_.size() ==
252 std::min(first.sorted_vector_of_distances_.size(), second.sorted_vector_of_distances_.size())) {
253 for (std::size_t i =
254 std::min(first.sorted_vector_of_distances_.size(), second.sorted_vector_of_distances_.size());
255 i != std::max(first.sorted_vector_of_distances_.size(), second.sorted_vector_of_distances_.size());
256 ++i) {
257 result.sorted_vector_of_distances_.push_back(operation(0, second.sorted_vector_of_distances_[i]));
258 }
259 } else {
260 for (std::size_t i =
261 std::min(first.sorted_vector_of_distances_.size(), second.sorted_vector_of_distances_.size());
262 i != std::max(first.sorted_vector_of_distances_.size(), second.sorted_vector_of_distances_.size());
263 ++i) {
264 result.sorted_vector_of_distances_.push_back(operation(first.sorted_vector_of_distances_[i], 0));
265 }
266 }
267 return result;
268 }
269
274 {
276 result.sorted_vector_of_distances_.reserve(this->sorted_vector_of_distances_.size());
277 for (std::size_t i = 0; i != this->sorted_vector_of_distances_.size(); ++i) {
278 result.sorted_vector_of_distances_.push_back(scalar * this->sorted_vector_of_distances_[i]);
279 }
280 return result;
281 }
282
287 const Vector_distances_in_diagram& second)
288 {
289 return operation_on_pair_of_vectors(first, second, std::plus<double>());
290 }
291
296 const Vector_distances_in_diagram& second)
297 {
298 return operation_on_pair_of_vectors(first, second, std::minus<double>());
299 }
300
305 {
306 return A.multiply_by_scalar(scalar);
307 }
308
313 {
314 return A.multiply_by_scalar(scalar);
315 }
316
320 Vector_distances_in_diagram operator*(double scalar) { return this->multiply_by_scalar(scalar); }
321
326 {
327 *this = *this + rhs;
328 return *this;
329 }
330
335 {
336 *this = *this - rhs;
337 return *this;
338 }
339
344 {
345 *this = *this * x;
346 return *this;
347 }
348
353 {
354 if (x == 0) throw("In operator /=, division by 0. Program terminated.");
355 *this = *this * (1 / x);
356 return *this;
357 }
358
359 private:
360 std::vector<std::pair<double, double> > intervals_;
361 std::vector<double> sorted_vector_of_distances_;
362 std::size_t number_of_functions_for_vectorization_;
363 std::size_t number_of_functions_for_projections_to_reals_;
364 std::size_t where_to_cut_;
365
366 void _compute_sorted_vector_of_distances_via_heap();
367 void _compute_sorted_vector_of_distances_via_vector_sorting();
368
369 Vector_distances_in_diagram(const std::vector<double>& sorted_vector_of_distances)
370 : sorted_vector_of_distances_(sorted_vector_of_distances)
371 {
372 this->_set_up_numbers_of_functions_for_vectorization_and_projections_to_reals();
373 }
374
375 // warning, this function can be only called after filling in the intervals vector.
376 void _set_up_numbers_of_functions_for_vectorization_and_projections_to_reals()
377 {
378 this->number_of_functions_for_vectorization_ = this->sorted_vector_of_distances_.size();
379 this->number_of_functions_for_projections_to_reals_ = this->sorted_vector_of_distances_.size();
380 }
381};
382
383template <typename F>
384void Vector_distances_in_diagram<F>::_compute_sorted_vector_of_distances_via_heap()
385{
386#ifdef DEBUG_TRACES
387 std::clog << "Here are the intervals : \n";
388 for (std::size_t i = 0; i != this->intervals_.size(); ++i) {
389 std::clog << this->intervals_[i].first << " , " << this->intervals_[i].second << std::endl;
390 }
391#endif
392 // TODO: should this also modify where_to_cut_ ?
393 auto where_to_cut =
394 std::min(where_to_cut_,
395 (std::size_t)(0.5 * this->intervals_.size() * (this->intervals_.size() - 1) + this->intervals_.size()));
396
397 std::vector<double> heap(where_to_cut, std::numeric_limits<int>::max());
398 std::make_heap(heap.begin(), heap.end());
399 F f;
400
401 // for every pair of points in the diagram, compute the minimum of their distance, and distance of those points from
402 // diagonal
403 for (std::size_t i = 0; i < this->intervals_.size(); ++i) {
404 for (std::size_t j = i + 1; j < this->intervals_.size(); ++j) {
405 double value =
406 std::min(f(this->intervals_[i], this->intervals_[j]),
407 std::min(f(this->intervals_[i],
408 std::make_pair(0.5 * (this->intervals_[i].first + this->intervals_[i].second),
409 0.5 * (this->intervals_[i].first + this->intervals_[i].second))),
410 f(this->intervals_[j],
411 std::make_pair(0.5 * (this->intervals_[j].first + this->intervals_[j].second),
412 0.5 * (this->intervals_[j].first + this->intervals_[j].second)))));
413
414#ifdef DEBUG_TRACES
415 std::clog << "Value : " << value << std::endl;
416 std::clog << "heap.front() : " << heap.front() << std::endl;
417#endif
418
419 if (-value < heap.front()) {
420#ifdef DEBUG_TRACES
421 std::clog << "Replacing : " << heap.front() << " with : " << -value << std::endl;
422#endif
423 // remove the first element from the heap
424 std::pop_heap(heap.begin(), heap.end());
425 // and put value there instead:
426 heap[where_to_cut - 1] = -value;
427 std::push_heap(heap.begin(), heap.end());
428 }
429 }
430 }
431
432 // now add distances of all points from diagonal
433 for (std::size_t i = 0; i < this->intervals_.size(); ++i) {
434 double value = f(this->intervals_[i],
435 std::make_pair(0.5 * (this->intervals_[i].first + this->intervals_[i].second),
436 0.5 * (this->intervals_[i].first + this->intervals_[i].second)));
437 if (-value < heap.front()) {
438 // remove the first element from the heap
439 std::pop_heap(heap.begin(), heap.end());
440 // and put value there instead:
441 heap[where_to_cut - 1] = -value;
442 std::push_heap(heap.begin(), heap.end());
443 }
444 }
445
446 std::sort_heap(heap.begin(), heap.end());
447 for (std::size_t i = 0; i != heap.size(); ++i) {
448 if (heap[i] == std::numeric_limits<int>::max()) {
449 heap[i] = 0;
450 } else {
451 heap[i] *= -1;
452 }
453 }
454
455#ifdef DEBUG_TRACES
456 std::clog << "This is the heap after all the operations :\n";
457 for (std::size_t i = 0; i != heap.size(); ++i) {
458 std::clog << heap[i] << " ";
459 }
460 std::clog << std::endl;
461#endif
462
463 this->sorted_vector_of_distances_.swap(heap);
464}
465
466template <typename F>
467void Vector_distances_in_diagram<F>::_compute_sorted_vector_of_distances_via_vector_sorting()
468{
469 std::vector<double> distances;
470 distances.reserve(
471 (std::size_t)(0.5 * this->intervals_.size() * (this->intervals_.size() - 1) + this->intervals_.size()));
472 F f;
473
474 // for every pair of points in the diagram, compute the minimum of their distance, and distance of those points from
475 // diagonal
476 for (std::size_t i = 0; i < this->intervals_.size(); ++i) {
477 // add distance of i-th point in the diagram from the diagonal to the distances vector
478 distances.push_back(f(this->intervals_[i],
479 std::make_pair(0.5 * (this->intervals_[i].first + this->intervals_[i].second),
480 0.5 * (this->intervals_[i].first + this->intervals_[i].second))));
481 for (std::size_t j = i + 1; j < this->intervals_.size(); ++j) {
482 double value =
483 std::min(f(this->intervals_[i], this->intervals_[j]),
484 std::min(f(this->intervals_[i],
485 std::make_pair(0.5 * (this->intervals_[i].first + this->intervals_[i].second),
486 0.5 * (this->intervals_[i].first + this->intervals_[i].second))),
487 f(this->intervals_[j],
488 std::make_pair(0.5 * (this->intervals_[j].first + this->intervals_[j].second),
489 0.5 * (this->intervals_[j].first + this->intervals_[j].second)))));
490 distances.push_back(value);
491 }
492 }
493 std::sort(distances.begin(), distances.end(), std::greater<double>());
494 if (distances.size() > where_to_cut_) distances.resize(where_to_cut_);
495
496 this->sorted_vector_of_distances_.swap(distances);
497}
498
499// Implementations of functions for various concepts.
500template <typename F>
501double Vector_distances_in_diagram<F>::project_to_R(int number_of_function) const
502{
503 // TODO: why not type `number_of_function` directly as `std::size_t`? Are there cases where the user wants this
504 // method to throw when `number_of_function` < 0 ?
505 if (static_cast<std::size_t>(number_of_function) > this->number_of_functions_for_projections_to_reals_)
506 throw std::invalid_argument("Wrong index of a function in a method Vector_distances_in_diagram<F>::project_to_R");
507 if (number_of_function < 0)
508 throw std::invalid_argument("Wrong index of a function in a method Vector_distances_in_diagram<F>::project_to_R");
509
510 double result = 0;
511 for (std::size_t i = 0; i != static_cast<std::size_t>(number_of_function); ++i) {
512 result += sorted_vector_of_distances_[i];
513 }
514 return result;
515}
516
517template <typename F>
518void Vector_distances_in_diagram<F>::compute_average(const std::vector<Vector_distances_in_diagram*>& to_average)
519{
520 if (to_average.size() == 0) {
522 return;
523 }
524
525 std::size_t maximal_length_of_vector = 0;
526 for (std::size_t i = 0; i != to_average.size(); ++i) {
527 if (to_average[i]->sorted_vector_of_distances_.size() > maximal_length_of_vector) {
528 maximal_length_of_vector = to_average[i]->sorted_vector_of_distances_.size();
529 }
530 }
531
532 std::vector<double> av(maximal_length_of_vector, 0);
533 for (std::size_t i = 0; i != to_average.size(); ++i) {
534 for (std::size_t j = 0; j != to_average[i]->sorted_vector_of_distances_.size(); ++j) {
535 av[j] += to_average[i]->sorted_vector_of_distances_[j];
536 }
537 }
538
539 for (std::size_t i = 0; i != maximal_length_of_vector; ++i) {
540 av[i] /= static_cast<double>(to_average.size());
541 }
542 this->sorted_vector_of_distances_.swap(av);
543 this->where_to_cut_ = av.size();
544}
545
546template <typename F>
548{
549#ifdef DEBUG_TRACES
550 std::clog << "Entering double Vector_distances_in_diagram<F>::distance( const Abs_Topological_data_with_distances* "
551 "second , double power ) procedure \n";
552 std::clog << "Power : " << power << std::endl;
553 std::clog << "This : " << *this << std::endl;
554 std::clog << "second : " << second_ << std::endl;
555#endif
556
557 double result = 0;
558 for (std::size_t i = 0;
559 i != std::min(this->sorted_vector_of_distances_.size(), second_.sorted_vector_of_distances_.size());
560 ++i) {
561 if (power == 1) {
562#ifdef DEBUG_TRACES
563 std::clog << "|" << this->sorted_vector_of_distances_[i] << " - " << second_.sorted_vector_of_distances_[i]
564 << " | : " << std::fabs(this->sorted_vector_of_distances_[i] - second_.sorted_vector_of_distances_[i])
565 << std::endl;
566#endif
567 result += std::fabs(this->sorted_vector_of_distances_[i] - second_.sorted_vector_of_distances_[i]);
568 } else {
569 if (power < std::numeric_limits<double>::max()) {
570 result +=
571 std::pow(std::fabs(this->sorted_vector_of_distances_[i] - second_.sorted_vector_of_distances_[i]), power);
572 } else {
573 // max norm
574 if (result < std::fabs(this->sorted_vector_of_distances_[i] - second_.sorted_vector_of_distances_[i]))
575 result = std::fabs(this->sorted_vector_of_distances_[i] - second_.sorted_vector_of_distances_[i]);
576 }
577#ifdef DEBUG_TRACES
578 std::clog << "| " << this->sorted_vector_of_distances_[i] << " - " << second_.sorted_vector_of_distances_[i]
579 << " : " << std::fabs(this->sorted_vector_of_distances_[i] - second_.sorted_vector_of_distances_[i])
580 << std::endl;
581#endif
582 }
583 }
584 if (this->sorted_vector_of_distances_.size() != second_.sorted_vector_of_distances_.size()) {
585 if (this->sorted_vector_of_distances_.size() > second_.sorted_vector_of_distances_.size()) {
586 for (std::size_t i = second_.sorted_vector_of_distances_.size(); i != this->sorted_vector_of_distances_.size();
587 ++i) {
588 result += std::fabs(this->sorted_vector_of_distances_[i]);
589 }
590 } else {
591 // this->sorted_vector_of_distances_.size() < second_.sorted_vector_of_distances_.size()
592 for (std::size_t i = this->sorted_vector_of_distances_.size(); i != second_.sorted_vector_of_distances_.size();
593 ++i) {
594 result += std::fabs(second_.sorted_vector_of_distances_[i]);
595 }
596 }
597 }
598
599 if (power != 1) {
600 result = std::pow(result, (1.0 / power));
601 }
602 return result;
603}
604
605template <typename F>
606std::vector<double> Vector_distances_in_diagram<F>::vectorize(int number_of_function) const
607{
608 // TODO: why not type `number_of_function` directly as `std::size_t`? Are there cases where the user wants this
609 // method to throw when `number_of_function` < 0 ?
610 if (static_cast<std::size_t>(number_of_function) > this->number_of_functions_for_vectorization_)
611 throw std::invalid_argument("Wrong index of a function in a method Vector_distances_in_diagram<F>::vectorize");
612 if (number_of_function < 0)
613 throw std::invalid_argument("Wrong index of a function in a method Vector_distances_in_diagram<F>::vectorize");
614
615 std::vector<double> result(
616 std::min(static_cast<std::size_t>(number_of_function), this->sorted_vector_of_distances_.size()));
617 for (std::size_t i = 0;
618 i != std::min(static_cast<std::size_t>(number_of_function), this->sorted_vector_of_distances_.size());
619 ++i) {
620 result[i] = this->sorted_vector_of_distances_[i];
621 }
622 return result;
623}
624
625template <typename F>
626void Vector_distances_in_diagram<F>::write_to_file(const char* filename) const
627{
628 std::ofstream out;
629 out.open(filename);
630
631 for (std::size_t i = 0; i != this->sorted_vector_of_distances_.size(); ++i) {
632 out << this->sorted_vector_of_distances_[i] << " ";
633 }
634
635 out.close();
636}
637
638template <typename F>
640{
641 std::ifstream in;
642 in.open(filename);
643 // check if the file exist.
644 if (!in.good()) {
645#ifdef DEBUG_TRACES
646 std::cerr << "The file : " << filename << " do not exist. The program will now terminate \n";
647#endif
648 throw std::invalid_argument("The persistence landscape file do not exist.");
649 }
650
651 double number;
652 while (in >> number) {
653 this->sorted_vector_of_distances_.push_back(number);
654 }
655 in.close();
656}
657
658template <typename F>
660{
661 double result = 0;
662 for (std::size_t i = 0;
663 i != std::min(this->sorted_vector_of_distances_.size(), second_vector.sorted_vector_of_distances_.size());
664 ++i) {
665 result += this->sorted_vector_of_distances_[i] * second_vector.sorted_vector_of_distances_[i];
666 }
667 return result;
668}
669
670} // namespace Persistence_representations
671} // namespace Gudhi
672
673#endif // PERSISTENCE_VECTORS_H_
A class implementing persistence vectors.
Definition Persistence_vectors.h:59
bool operator==(const Vector_distances_in_diagram &second) const
Definition Persistence_vectors.h:137
const std::vector< double > & output_for_visualization() const
Definition Persistence_vectors.h:196
void plot(const char *filename) const
Definition Persistence_vectors.h:201
double project_to_R(int number_of_function) const
Definition Persistence_vectors.h:501
Vector_distances_in_diagram operator+=(const Vector_distances_in_diagram &rhs)
Definition Persistence_vectors.h:325
void compute_average(const std::vector< Vector_distances_in_diagram * > &to_average)
Definition Persistence_vectors.h:518
double compute_scalar_product(const Vector_distances_in_diagram &second) const
Definition Persistence_vectors.h:659
std::pair< double, double > get_x_range() const
Definition Persistence_vectors.h:225
void load_from_file(const char *filename)
Definition Persistence_vectors.h:639
Vector_distances_in_diagram operator*=(double x)
Definition Persistence_vectors.h:343
std::size_t size() const
Definition Persistence_vectors.h:117
friend std::ostream & operator<<(std::ostream &out, const Vector_distances_in_diagram &d)
Definition Persistence_vectors.h:96
void write_to_file(const char *filename) const
Definition Persistence_vectors.h:626
std::pair< double, double > get_y_range() const
Definition Persistence_vectors.h:230
std::size_t number_of_vectorize_functions() const
Definition Persistence_vectors.h:172
void print_to_file(const char *filename) const
Definition Persistence_vectors.h:127
double distance(const Vector_distances_in_diagram &second, double power=1) const
Definition Persistence_vectors.h:547
Vector_distances_in_diagram operator/=(double x)
Definition Persistence_vectors.h:352
Vector_distances_in_diagram(const std::vector< std::pair< double, double > > &intervals, std::size_t where_to_cut)
Definition Persistence_vectors.h:70
double vector_in_position(std::size_t position) const
Definition Persistence_vectors.h:107
friend Vector_distances_in_diagram operator*(const Vector_distances_in_diagram &A, double scalar)
Definition Persistence_vectors.h:312
Vector_distances_in_diagram operator*(double scalar)
Definition Persistence_vectors.h:320
friend Vector_distances_in_diagram operator*(double scalar, const Vector_distances_in_diagram &A)
Definition Persistence_vectors.h:304
friend Vector_distances_in_diagram operator+(const Vector_distances_in_diagram &first, const Vector_distances_in_diagram &second)
Definition Persistence_vectors.h:286
Vector_distances_in_diagram()
Definition Persistence_vectors.h:64
std::size_t number_of_projections_to_R() const
Definition Persistence_vectors.h:161
Vector_distances_in_diagram operator-=(const Vector_distances_in_diagram &rhs)
Definition Persistence_vectors.h:334
Vector_distances_in_diagram multiply_by_scalar(double scalar) const
Definition Persistence_vectors.h:273
Vector_distances_in_diagram(const char *filename, std::size_t where_to_cut, unsigned int dimension=std::numeric_limits< unsigned int >::max())
Definition Persistence_vectors.h:81
std::vector< double > vectorize(int number_of_function) const
Definition Persistence_vectors.h:606
friend Vector_distances_in_diagram operator-(const Vector_distances_in_diagram &first, const Vector_distances_in_diagram &second)
Definition Persistence_vectors.h:295
This file contain an implementation of some common procedures used in the Persistence_representations...
bool almost_equal(double a, double b)
Definition common_persistence_representations.h:65
std::vector< std::pair< double, double > > read_persistence_intervals_in_one_dimension_from_file(std::string const &filename, int dimension=-1, double what_to_substitute_for_infinite_bar=-1)
Definition read_persistence_from_file.h:44
Gudhi namespace.
Definition SimplicialComplexForAlpha.h:14
STL namespace.