summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVincent Rouvreau <vincent.rouvreau@inria.fr>2022-01-19 09:26:00 +0100
committerVincent Rouvreau <vincent.rouvreau@inria.fr>2022-01-19 09:26:00 +0100
commitc1cf7fe36a65b6a97739f673ee55c77e43807746 (patch)
tree20b187362f1f32645c3dc68dc4c4c6c63146dd4f /src
parent1f9b9d2e751332c944d98be366d39d8a69556187 (diff)
Code review: None was used to detect unweighted alpha complex. An empty list works as well and simplifies the code
Diffstat (limited to 'src')
-rw-r--r--src/python/gudhi/alpha_complex.pyx7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/python/gudhi/alpha_complex.pyx b/src/python/gudhi/alpha_complex.pyx
index a4888914..4fbbb3ba 100644
--- a/src/python/gudhi/alpha_complex.pyx
+++ b/src/python/gudhi/alpha_complex.pyx
@@ -72,7 +72,7 @@ cdef class AlphaComplex:
"""
# The real cython constructor
- def __cinit__(self, points = [], off_file = '', weights=None, precision = 'safe'):
+ def __cinit__(self, points = [], off_file = '', weights=[], precision = 'safe'):
assert precision in ['fast', 'safe', 'exact'], "Alpha complex precision can only be 'fast', 'safe' or 'exact'"
cdef bool fast = precision == 'fast'
cdef bool exact = precision == 'exact'
@@ -83,15 +83,14 @@ cdef class AlphaComplex:
points = read_points_from_off_file(off_file = off_file)
# weights are set but is inconsistent with the number of points
- if weights != None and len(weights) != len(points):
+ if len(weights) != 0 and len(weights) != len(points):
raise ValueError("Inconsistency between the number of points and weights")
# need to copy the points to use them without the gil
cdef vector[vector[double]] pts
cdef vector[double] wgts
pts = points
- if weights != None:
- wgts = weights
+ wgts = weights
with nogil:
self.this_ptr = new Alpha_complex_interface(pts, wgts, fast, exact)