Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions hdbscan/_hdbscan_boruvka.pyx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION
# cython: boundscheck=False
# cython: nonecheck=False
# cython: wraparound=False
Expand Down Expand Up @@ -89,7 +90,7 @@ cdef inline np.double_t balltree_min_dist_dual(
np.double_t radius2,
np.intp_t node1,
np.intp_t node2,
np.double_t[:, ::1] centroid_dist) nogil except -1:
np.double_t[:, ::1] centroid_dist) except -1 nogil:

cdef np.double_t dist_pt = centroid_dist[node1, node2]
return max(0, (dist_pt - radius1 - radius2))
Expand Down Expand Up @@ -139,7 +140,7 @@ cdef inline np.double_t kdtree_min_rdist_dual(
np.intp_t node1,
np.intp_t node2,
np.double_t[:, :, ::1] node_bounds,
np.intp_t num_features) nogil except -1:
np.intp_t num_features) except -1 nogil:

cdef np.double_t d, d1, d2, rdist = 0.0
cdef np.double_t zero = 0.0
Expand Down Expand Up @@ -603,7 +604,7 @@ cdef class KDTreeBoruvkaAlgorithm (object):
return self.components.shape[0]

cdef int dual_tree_traversal(self, np.intp_t node1,
np.intp_t node2) nogil except -1:
np.intp_t node2) except -1 nogil:
"""Perform a dual tree traversal, pruning wherever possible, to find
the nearest neighbor not in the same component for each component.
This is akin to a standard dual tree NN search, but we also prune
Expand Down
1 change: 1 addition & 0 deletions hdbscan/_hdbscan_linkage.pyx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION
# cython: boundscheck=False
# cython: nonecheck=False
# Minimum spanning tree single linkage implementation for hdbscan
Expand Down
1 change: 1 addition & 0 deletions hdbscan/_hdbscan_reachability.pyx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION
# cython: boundscheck=False
# cython: nonecheck=False
# cython: initializedcheck=False
Expand Down
1 change: 1 addition & 0 deletions hdbscan/_hdbscan_tree.pyx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION
# cython: boundscheck=False
# cython: nonecheck=False
# cython: initializedcheck=False
Expand Down
3 changes: 2 additions & 1 deletion hdbscan/_prediction_utils.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#cython: boundscheck=False, nonecheck=False, initializedcheck=False
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION
# cython: boundscheck=False, nonecheck=False, initializedcheck=False
# Utility routines in cython for prediction in hdbscan
# Authors: Leland McInnes
# License: 3-clause BSD
Expand Down
19 changes: 10 additions & 9 deletions hdbscan/dist_metrics.pxd
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!python
#cython: boundscheck=False
#cython: wraparound=False
#cython: cdivision=True
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION
# cython: boundscheck=False
# cython: wraparound=False
# cython: cdivision=True

import cython
cimport cython
Expand Down Expand Up @@ -33,7 +34,7 @@ DTYPE = np.double
# We use these for the default (euclidean) case so that they can be
# inlined. This leads to faster computation for the most common case
cdef inline DTYPE_t euclidean_dist(DTYPE_t* x1, DTYPE_t* x2,
ITYPE_t size) nogil except -1:
ITYPE_t size) except -1 nogil:
cdef DTYPE_t tmp, d=0
cdef np.intp_t j
for j in range(size):
Expand All @@ -43,7 +44,7 @@ cdef inline DTYPE_t euclidean_dist(DTYPE_t* x1, DTYPE_t* x2,


cdef inline DTYPE_t euclidean_rdist(DTYPE_t* x1, DTYPE_t* x2,
ITYPE_t size) nogil except -1:
ITYPE_t size) except -1 nogil:
cdef DTYPE_t tmp, d=0
cdef np.intp_t j
for j in range(size):
Expand All @@ -52,7 +53,7 @@ cdef inline DTYPE_t euclidean_rdist(DTYPE_t* x1, DTYPE_t* x2,
return d


cdef inline DTYPE_t euclidean_dist_to_rdist(DTYPE_t dist) nogil except -1:
cdef inline DTYPE_t euclidean_dist_to_rdist(DTYPE_t dist) except -1 nogil:
return dist * dist


Expand All @@ -79,10 +80,10 @@ cdef class DistanceMetric:
cdef object kwargs

cdef DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2,
ITYPE_t size) nogil except -1
ITYPE_t size) except -1 nogil

cdef DTYPE_t rdist(self, DTYPE_t* x1, DTYPE_t* x2,
ITYPE_t size) nogil except -1
ITYPE_t size) except -1 nogil

cdef int pdist(self, DTYPE_t[:, ::1] X, DTYPE_t[:, ::1] D) except -1

Expand All @@ -91,4 +92,4 @@ cdef class DistanceMetric:

cdef DTYPE_t _rdist_to_dist(self, DTYPE_t rdist) except -1

cdef DTYPE_t _dist_to_rdist(self, DTYPE_t dist) nogil except -1
cdef DTYPE_t _dist_to_rdist(self, DTYPE_t dist) except -1 nogil
Loading