Skip to content

Commit

Permalink
Merge pull request #5 from MatthewSZhang/cython-lint
Browse files Browse the repository at this point in the history
MNT lint cython
  • Loading branch information
MatthewSZhang authored Aug 20, 2024
2 parents 1615f83 + a56f3aa commit 58e6193
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ name: CI
on:
workflow_call:
push:
branches: [main]
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
test:
Expand Down
14 changes: 13 additions & 1 deletion fastcan/_cancorr_fast.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
# Fast feature selection with sum squared canoncial correlation coefficents
from libc.stdlib cimport malloc, free
from libc.string cimport memset
from cython cimport floating
from cython cimport floating, final
from cython.parallel import prange
from scipy.linalg.cython_blas cimport isamax, idamax
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,
unsigned int n,
Expand All @@ -23,6 +25,8 @@ cdef unsigned int _bsum(
total += x[i]
return total


@final
cdef int _iamax(
int n,
const floating *x,
Expand All @@ -38,6 +42,8 @@ cdef int _iamax(
else:
return idamax(&n, <double *> x, &incx) - 1


@final
cdef bint _normv(
floating[::1] x, # IN/OUT
) noexcept nogil:
Expand All @@ -58,6 +64,8 @@ cdef bint _normv(
_scal(n_samples, x_norm, &x[0], 1)
return False


@final
cdef void _normm(
floating[::1, :] X, # IN/OUT
bint* m, # IN/OUT
Expand Down Expand Up @@ -85,6 +93,7 @@ cdef void _normm(
_scal(n_samples, x_norm, &X[0, j], 1)


@final
cdef floating _sscvm(
const floating[::1] w, # IN
const floating[::1, :] V, # IN
Expand Down Expand Up @@ -114,6 +123,8 @@ cdef floating _sscvm(
free(r)
return r2


@final
cdef void _mgsvv(
const floating[::1] w, # IN
floating[::1] x, # IN/OUT
Expand All @@ -134,6 +145,7 @@ cdef void _mgsvv(
_axpy(n_samples, -r, &w[0], 1, &x[0], 1)


@final
cpdef int _forward_search(
floating[::1, :] X, # IN/OUT
floating[::1, :] V, # IN
Expand Down

0 comments on commit 58e6193

Please sign in to comment.