From 778ea77eb9a3179c8b03ce21b7ee0672e4804b2a Mon Sep 17 00:00:00 2001 From: SIKAI ZHANG <34108862+MatthewSZhang@users.noreply.github.com> Date: Tue, 20 Aug 2024 17:14:10 +0800 Subject: [PATCH] MNT lint cython --- .github/workflows/ci.yml | 4 +++- fastcan/_cancorr_fast.pyx | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7e0783f..c21d985 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,9 @@ name: CI on: workflow_call: push: - branches: [main] + branches: [ "main" ] + pull_request: + branches: [ "main" ] jobs: test: diff --git a/fastcan/_cancorr_fast.pyx b/fastcan/_cancorr_fast.pyx index aa7fafd..3788e9d 100644 --- a/fastcan/_cancorr_fast.pyx +++ b/fastcan/_cancorr_fast.pyx @@ -10,6 +10,7 @@ from sklearn.utils._cython_blas cimport ColMajor, NoTrans from sklearn.utils._cython_blas cimport _dot, _scal, _nrm2, _gemm, _axpy from sklearn.utils._typedefs cimport int32_t + @final cdef unsigned int _bsum( bint* x, @@ -24,6 +25,7 @@ cdef unsigned int _bsum( total += x[i] return total + @final cdef int _iamax( int n, @@ -40,6 +42,7 @@ cdef int _iamax( else: return idamax(&n, x, &incx) - 1 + @final cdef bint _normv( floating[::1] x, # IN/OUT @@ -61,6 +64,7 @@ cdef bint _normv( _scal(n_samples, x_norm, &x[0], 1) return False + @final cdef void _normm( floating[::1, :] X, # IN/OUT @@ -88,6 +92,7 @@ cdef void _normm( x_norm = 1.0/x_norm _scal(n_samples, x_norm, &X[0, j], 1) + @final cdef floating _sscvm( const floating[::1] w, # IN @@ -118,6 +123,7 @@ cdef floating _sscvm( free(r) return r2 + @final cdef void _mgsvv( const floating[::1] w, # IN @@ -138,6 +144,7 @@ cdef void _mgsvv( # x = x - w*r _axpy(n_samples, -r, &w[0], 1, &x[0], 1) + @final cpdef int _forward_search( floating[::1, :] X, # IN/OUT