diff options
author | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-05-09 14:38:46 +0000 |
---|---|---|
committer | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-05-09 14:38:46 +0000 |
commit | 700c2cf3833a55af11b731a6a44c189e8f01b978 (patch) | |
tree | 13aa786f6e336e2dfad9a8a3eeea638488dfa8e7 | |
parent | b487c8bf2bb87566a73d607f83785f2497866684 (diff) |
Fix Windows python module compilation
rips_complex_diagram_persistence_from_distance_matrix_file_example.py shall use csv_file instead of off_file
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@2409 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: b73613ce923e4bb72f5eae110cf290dc2215994d
3 files changed, 25 insertions, 32 deletions
diff --git a/src/Bottleneck_distance/include/gudhi/Bottleneck.h b/src/Bottleneck_distance/include/gudhi/Bottleneck.h index b90a0ee0..8c97dce9 100644 --- a/src/Bottleneck_distance/include/gudhi/Bottleneck.h +++ b/src/Bottleneck_distance/include/gudhi/Bottleneck.h @@ -101,11 +101,11 @@ double bottleneck_distance_exact(Persistence_graph& g) { */ template<typename Persistence_diagram1, typename Persistence_diagram2> double bottleneck_distance(const Persistence_diagram1 &diag1, const Persistence_diagram2 &diag2, - double e = std::numeric_limits<double>::min()) { + double e = (std::numeric_limits<double>::min)()) { Persistence_graph g(diag1, diag2, e); if (g.bottleneck_alive() == std::numeric_limits<double>::infinity()) return std::numeric_limits<double>::infinity(); - return std::max(g.bottleneck_alive(), e == 0. ? bottleneck_distance_exact(g) : bottleneck_distance_approx(g, e)); + return (std::max)(g.bottleneck_alive(), e == 0. ? bottleneck_distance_exact(g) : bottleneck_distance_approx(g, e)); } } // namespace persistence_diagram diff --git a/src/Bottleneck_distance/include/gudhi/Persistence_graph.h b/src/Bottleneck_distance/include/gudhi/Persistence_graph.h index 44f4b827..622b0691 100644 --- a/src/Bottleneck_distance/include/gudhi/Persistence_graph.h +++ b/src/Bottleneck_distance/include/gudhi/Persistence_graph.h @@ -102,7 +102,7 @@ Persistence_graph::Persistence_graph(const Persistence_diagram1 &diag1, b_alive = std::numeric_limits<double>::infinity(); } else { for (auto it_u = u_alive.cbegin(), it_v = v_alive.cbegin(); it_u != u_alive.cend(); ++it_u, ++it_v) - b_alive = std::max(b_alive, std::fabs(*it_u - *it_v)); + b_alive = (std::max)(b_alive, std::fabs(*it_u - *it_v)); } } @@ -129,7 +129,7 @@ inline double Persistence_graph::distance(int u_point_index, int v_point_index) return 0.; Internal_point p_u = get_u_point(u_point_index); Internal_point p_v = get_v_point(v_point_index); - return std::max(std::fabs(p_u.x() - p_v.x()), std::fabs(p_u.y() - p_v.y())); + return (std::max)(std::fabs(p_u.x() - p_v.x()), std::fabs(p_u.y() - p_v.y())); } inline int Persistence_graph::size() const { @@ -175,9 +175,9 @@ inline Internal_point Persistence_graph::get_v_point(int v_point_index) const { inline double Persistence_graph::diameter_bound() const { double max = 0.; for (auto it = u.cbegin(); it != u.cend(); it++) - max = std::max(max, it->y()); + max = (std::max)(max, it->y()); for (auto it = v.cbegin(); it != v.cend(); it++) - max = std::max(max, it->y()); + max = (std::max)(max, it->y()); return max; } diff --git a/src/cython/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py b/src/cython/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py index 664eb5c4..984dbf1b 100755 --- a/src/cython/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py +++ b/src/cython/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py @@ -43,29 +43,22 @@ parser.add_argument('--no-diagram', default=False, action='store_true' , help='F args = parser.parse_args() -with open(args.file, 'r') as f: - first_line = f.readline() - if (first_line == 'OFF\n') or (first_line == 'nOFF\n'): - print("#####################################################################") - print("RipsComplex creation from distance matrix read in a csv file") - - message = "RipsComplex with max_edge_length=" + repr(args.max_edge_length) - print(message) - - rips_complex = gudhi.RipsComplex(off_file=args.file, max_edge_length=args.max_edge_length) - simplex_tree = rips_complex.create_simplex_tree(max_dimension=args.max_dimension) - - message = "Number of simplices=" + repr(simplex_tree.num_simplices()) - print(message) - - diag = simplex_tree.persistence() - - print("betti_numbers()=") - print(simplex_tree.betti_numbers()) - - if args.no_diagram == False: - gudhi.plot_persistence_diagram(diag) - else: - print(args.file, "is not a valid OFF file") - - f.close() +print("#####################################################################") +print("RipsComplex creation from distance matrix read in a csv file") + +message = "RipsComplex with max_edge_length=" + repr(args.max_edge_length) +print(message) + +rips_complex = gudhi.RipsComplex(csv_file=args.file, max_edge_length=args.max_edge_length) +simplex_tree = rips_complex.create_simplex_tree(max_dimension=args.max_dimension) + +message = "Number of simplices=" + repr(simplex_tree.num_simplices()) +print(message) + +diag = simplex_tree.persistence() + +print("betti_numbers()=") +print(simplex_tree.betti_numbers()) + +if args.no_diagram == False: + gudhi.plot_persistence_diagram(diag) |