summaryrefslogtreecommitdiff
path: root/src/python/gudhi/alpha_complex.pyx
diff options
context:
space:
mode:
authorVincent Rouvreau <vincent.rouvreau@inria.fr>2022-01-20 17:26:27 +0100
committerVincent Rouvreau <vincent.rouvreau@inria.fr>2022-01-20 17:26:27 +0100
commitcee14f45b10d8fd4bee78b4323dea650f8d20f11 (patch)
tree54e6b98866e66b7965353d861a87e626ebd2faaa /src/python/gudhi/alpha_complex.pyx
parent72a56067c5a6f105ff60996e7257063505030e73 (diff)
Rollback c1cf7fe and 5c09f30
Diffstat (limited to 'src/python/gudhi/alpha_complex.pyx')
-rw-r--r--src/python/gudhi/alpha_complex.pyx9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/python/gudhi/alpha_complex.pyx b/src/python/gudhi/alpha_complex.pyx
index 512597b3..a4888914 100644
--- a/src/python/gudhi/alpha_complex.pyx
+++ b/src/python/gudhi/alpha_complex.pyx
@@ -51,7 +51,7 @@ cdef class AlphaComplex:
cdef Alpha_complex_interface * this_ptr
# Fake constructor that does nothing but documenting the constructor
- def __init__(self, points=[], off_file='', weights=[], precision='safe'):
+ def __init__(self, points=[], off_file='', weights=None, precision='safe'):
"""AlphaComplex constructor.
:param points: A list of points in d-Dimension.
@@ -72,7 +72,7 @@ cdef class AlphaComplex:
"""
# The real cython constructor
- def __cinit__(self, points = [], off_file = '', weights=[], precision = 'safe'):
+ def __cinit__(self, points = [], off_file = '', weights=None, 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,14 +83,15 @@ 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 len(weights) != 0 and len(weights) != len(points):
+ if weights != None 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
- wgts = weights
+ if weights != None:
+ wgts = weights
with nogil:
self.this_ptr = new Alpha_complex_interface(pts, wgts, fast, exact)