diff --git a/sksurv/kernels/_clinical_kernel.pyx b/sksurv/kernels/_clinical_kernel.pyx index f4ad9c79..c2acfeee 100644 --- a/sksurv/kernels/_clinical_kernel.pyx +++ b/sksurv/kernels/_clinical_kernel.pyx @@ -20,7 +20,7 @@ cnp.import_array() @cython.wraparound(False) @cython.cdivision(True) @cython.boundscheck(False) -cdef void _get_min_and_max(cnp.npy_double[:] x, cnp.npy_double * min_out, cnp.npy_double * max_out) nogil: +cdef void _get_min_and_max(cnp.npy_double[:] x, cnp.npy_double * min_out, cnp.npy_double * max_out) noexcept nogil: cdef cnp.npy_double amin = x[0] cdef cnp.npy_double amax = x[0] cdef int i diff --git a/sksurv/svm/_minlip.pyx b/sksurv/svm/_minlip.pyx index 28839ce4..97c4b0fb 100644 --- a/sksurv/svm/_minlip.pyx +++ b/sksurv/svm/_minlip.pyx @@ -84,7 +84,7 @@ def create_difference_matrix(cnp.npy_uint8[:] event, cdef inline void set_entries(cnp.npy_intp[:] columns, cnp.npy_int8[:] values, cnp.npy_intp k, - cnp.npy_intp i, cnp.npy_intp j) nogil: + cnp.npy_intp i, cnp.npy_intp j) noexcept nogil: """Create sparse matrix with sorted indices""" if i < j: columns[k] = i @@ -104,7 +104,7 @@ cdef inline void set_entries(cnp.npy_intp[:] columns, cdef cnp.npy_intp create_difference_matrix_direct_neighbor(cnp.npy_uint8[:] event, cnp.npy_intp[:] o, cnp.npy_int8[:] values, - cnp.npy_intp[:] columns) nogil: + cnp.npy_intp[:] columns) noexcept nogil: """Only compare against direct nearest neighbor according to time""" cdef cnp.npy_intp n_samples = event.shape[0] cdef cnp.npy_intp i @@ -129,7 +129,7 @@ cdef cnp.npy_intp create_difference_matrix_direct_neighbor(cnp.npy_uint8[:] even cdef cnp.npy_intp create_difference_matrix_nearest_neighbor(cnp.npy_uint8[:] event, cnp.npy_intp[:] o, cnp.npy_int8[:] values, - cnp.npy_intp[:] columns) nogil: + cnp.npy_intp[:] columns) noexcept nogil: """Only considers comparable pairs (i, j) where j is uncensored sample with highest survival time smaller than y_i""" cdef cnp.npy_intp n_samples = event.shape[0] @@ -154,7 +154,7 @@ cdef cnp.npy_intp create_difference_matrix_nearest_neighbor(cnp.npy_uint8[:] eve cdef cnp.npy_intp create_difference_matrix_full(cnp.npy_uint8[:] event, cnp.npy_intp[:] o, cnp.npy_int8[:] values, - cnp.npy_intp[:] columns) nogil: + cnp.npy_intp[:] columns) noexcept nogil: """Considers all possible comparable pairs""" cdef cnp.npy_intp n_samples = event.shape[0] cdef cnp.npy_intp i, j diff --git a/sksurv/tree/_criterion.pyx b/sksurv/tree/_criterion.pyx index 4875f793..42f471c8 100644 --- a/sksurv/tree/_criterion.pyx +++ b/sksurv/tree/_criterion.pyx @@ -59,14 +59,14 @@ cdef class RisksetCounter: free(self.n_events) free(self.n_at_risk) - cdef void reset(self) nogil: + cdef void reset(self) noexcept nogil: memset(self.n_events, 0, self.nbytes) memset(self.n_at_risk, 0, self.nbytes) - cdef void set_data(self, const DOUBLE_t[:, ::1] data) nogil: + cdef void set_data(self, const DOUBLE_t[:, ::1] data) noexcept nogil: self.data = data - cdef void update(self, const SIZE_t[:] samples, SIZE_t start, SIZE_t end) nogil: + cdef void update(self, const SIZE_t[:] samples, SIZE_t start, SIZE_t end) noexcept nogil: cdef: SIZE_t i SIZE_t idx @@ -94,7 +94,7 @@ cdef class RisksetCounter: if event != 0.0: self.n_events[ti] += 1 - cdef inline void at(self, SIZE_t index, DOUBLE_t * at_risk, DOUBLE_t * events) nogil: + cdef inline void at(self, SIZE_t index, DOUBLE_t * at_risk, DOUBLE_t * events) noexcept nogil: if at_risk != NULL: at_risk[0] = self.n_at_risk[index] if events != NULL: