diff --git a/fastcan/_cancorr_fast.pyx b/fastcan/_cancorr_fast.pyx index fb7e49e..aa7fafd 100644 --- a/fastcan/_cancorr_fast.pyx +++ b/fastcan/_cancorr_fast.pyx @@ -3,13 +3,14 @@ # 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, @@ -23,6 +24,7 @@ cdef unsigned int _bsum( total += x[i] return total +@final cdef int _iamax( int n, const floating *x, @@ -38,6 +40,7 @@ cdef int _iamax( else: return idamax(&n, x, &incx) - 1 +@final cdef bint _normv( floating[::1] x, # IN/OUT ) noexcept nogil: @@ -58,6 +61,7 @@ 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 @@ -84,7 +88,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 const floating[::1, :] V, # IN @@ -114,6 +118,7 @@ cdef floating _sscvm( free(r) return r2 +@final cdef void _mgsvv( const floating[::1] w, # IN floating[::1] x, # IN/OUT @@ -133,7 +138,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 floating[::1, :] V, # IN diff --git a/meson.build b/meson.build index 6902e1a..773602e 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project( 'fastcan', 'c', 'cython', - version: '0.1.26', + version: '0.2.1', license: 'MIT', meson_version: '>= 1.1.0', default_options: [ diff --git a/pixi.lock b/pixi.lock index 449b467..54be6f7 100644 --- a/pixi.lock +++ b/pixi.lock @@ -13,7 +13,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-h4bc722e_7.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/ca-certificates-2024.7.4-hbcca054_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/cython-3.0.11-py312hca68cad_0.conda - - conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.2.0-pyha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.3.0-pyha770c72_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/joblib-1.4.2-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/ld_impl_linux-64-2.40-hf3520f5_7.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/libblas-3.9.0-23_linux64_openblas.conda @@ -100,7 +100,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/osx-64/bzip2-1.0.8-hfdf4475_7.conda - conda: https://conda.anaconda.org/conda-forge/osx-64/ca-certificates-2024.7.4-h8857fd0_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-64/cython-3.0.11-py312h28f332c_0.conda - - conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.2.0-pyha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.3.0-pyha770c72_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/joblib-1.4.2-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-64/libblas-3.9.0-22_osx64_openblas.conda - conda: https://conda.anaconda.org/conda-forge/osx-64/libcblas-3.9.0-22_osx64_openblas.conda @@ -182,7 +182,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/osx-arm64/bzip2-1.0.8-h99b78c6_7.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/ca-certificates-2024.7.4-hf0a4a13_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/cython-3.0.11-py312h5c2e7bc_0.conda - - conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.2.0-pyha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.3.0-pyha770c72_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/joblib-1.4.2-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libblas-3.9.0-23_osxarm64_openblas.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libcblas-3.9.0-23_osxarm64_openblas.conda @@ -264,7 +264,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/win-64/bzip2-1.0.8-h2466b09_7.conda - conda: https://conda.anaconda.org/conda-forge/win-64/ca-certificates-2024.7.4-h56e8100_0.conda - conda: https://conda.anaconda.org/conda-forge/win-64/cython-3.0.11-py312h275cf98_0.conda - - conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.2.0-pyha770c72_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.3.0-pyha770c72_0.conda - conda: https://conda.anaconda.org/conda-forge/win-64/intel-openmp-2024.2.1-h57928b3_1083.conda - conda: https://conda.anaconda.org/conda-forge/noarch/joblib-1.4.2-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/win-64/libblas-3.9.0-23_win64_mkl.conda @@ -801,7 +801,7 @@ packages: name: fastcan version: 0.2.1 path: . - sha256: 5d008e2df785be8fffa44ef208d510ba8d84024994d98ecc9dd546ca9b3d323f + sha256: ea92ccb317eae49ba15c2d2b9031e97bfcb8d6154ee7dffd9bd53ffca3e62f7b requires_dist: - scikit-learn>=1.5.0,<1.6 - pytest ; extra == 'test' @@ -838,22 +838,22 @@ packages: requires_python: '>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*' - kind: conda name: importlib-metadata - version: 8.2.0 + version: 8.3.0 build: pyha770c72_0 subdir: noarch noarch: python - url: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.2.0-pyha770c72_0.conda - sha256: 15dd2beba1c6f780fec6c5351bbce815d27a29561f422fe830133c995ef90b8a - md5: c261d14fc7f49cdd403868998a18c318 + url: https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.3.0-pyha770c72_0.conda + sha256: e3b47fb8a7980823a009ca56c0ca3a573f5e7d035261476370806c7022936e45 + md5: 2144a30dbedfbe592625e61d7cb8cdb5 depends: - python >=3.8 - zipp >=0.5 license: Apache-2.0 license_family: APACHE purls: - - pkg:pypi/importlib-metadata?source=hash-mapping - size: 28110 - timestamp: 1721856614564 + - pkg:pypi/importlib-metadata?source=compressed-mapping + size: 28353 + timestamp: 1724124610766 - kind: pypi name: iniconfig version: 2.0.0 @@ -2069,6 +2069,7 @@ packages: constrains: - numpy-base <0a0 license: BSD-3-Clause + license_family: BSD purls: - pkg:pypi/numpy?source=compressed-mapping size: 8365718 @@ -2093,6 +2094,7 @@ packages: constrains: - numpy-base <0a0 license: BSD-3-Clause + license_family: BSD purls: - pkg:pypi/numpy?source=compressed-mapping size: 6993044 @@ -2116,6 +2118,7 @@ packages: constrains: - numpy-base <0a0 license: BSD-3-Clause + license_family: BSD purls: - pkg:pypi/numpy?source=compressed-mapping size: 7489811 @@ -2140,6 +2143,7 @@ packages: constrains: - numpy-base <0a0 license: BSD-3-Clause + license_family: BSD purls: - pkg:pypi/numpy?source=compressed-mapping size: 6337151 diff --git a/pyproject.toml b/pyproject.toml index b800394..d36278b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,7 +69,7 @@ test-coverage = { cmd = "rm -rf .coverage && pytest --cov-report $FMT --cov=$PAC [tool.pixi.feature.build.tasks] build-wheel = "rm -rf dist && python -m build -wnx -Cinstall-args=--tags=runtime,python-runtime,devel" build-sdist = "rm -rf dist && python -m build --sdist" -rebuild = "uv pip install --no-deps --force-reinstall -e ." +rebuild = "rm -rf build && uv pip install --no-deps --force-reinstall -e ." [tool.pixi.feature.fmt.tasks] fmt = { cmd = "black .", cwd = "fastcan" }