From ca6194150f8fe44b5c320e0c1e16e240546536f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Est=C3=A8ve?= Date: Mon, 13 Mar 2023 10:02:53 +0100 Subject: [PATCH] MNT Fix Pyodide build errors due to incompatible function pointer types --- sklearn/svm/_liblinear.pxi | 8 ++++---- sklearn/svm/_libsvm.pxi | 2 +- sklearn/svm/_libsvm_sparse.pyx | 2 +- sklearn/svm/src/liblinear/_cython_blas_helpers.h | 8 ++++---- sklearn/svm/src/libsvm/_svm_cython_blas_helpers.h | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sklearn/svm/_liblinear.pxi b/sklearn/svm/_liblinear.pxi index 569fe5b8a88b5..1a874ba4cbf9c 100644 --- a/sklearn/svm/_liblinear.pxi +++ b/sklearn/svm/_liblinear.pxi @@ -1,8 +1,8 @@ cdef extern from "_cython_blas_helpers.h": - ctypedef double (*dot_func)(int, double*, int, double*, int) - ctypedef void (*axpy_func)(int, double, double*, int, double*, int) - ctypedef void (*scal_func)(int, double, double*, int) - ctypedef double (*nrm2_func)(int, double*, int) + ctypedef double (*dot_func)(int, const double*, int, const double*, int) + ctypedef void (*axpy_func)(int, double, const double*, int, double*, int) + ctypedef void (*scal_func)(int, double, const double*, int) + ctypedef double (*nrm2_func)(int, const double*, int) cdef struct BlasFunctions: dot_func dot axpy_func axpy diff --git a/sklearn/svm/_libsvm.pxi b/sklearn/svm/_libsvm.pxi index f97a21ad50da5..8f1250d884687 100644 --- a/sklearn/svm/_libsvm.pxi +++ b/sklearn/svm/_libsvm.pxi @@ -1,7 +1,7 @@ ################################################################################ # Includes cdef extern from "_svm_cython_blas_helpers.h": - ctypedef double (*dot_func)(int, double*, int, double*, int) + ctypedef double (*dot_func)(int, const double*, int, const double*, int) cdef struct BlasFunctions: dot_func dot diff --git a/sklearn/svm/_libsvm_sparse.pyx b/sklearn/svm/_libsvm_sparse.pyx index ffef617a70e6e..37619f399988c 100644 --- a/sklearn/svm/_libsvm_sparse.pyx +++ b/sklearn/svm/_libsvm_sparse.pyx @@ -11,7 +11,7 @@ cdef extern from *: # Includes cdef extern from "_svm_cython_blas_helpers.h": - ctypedef double (*dot_func)(int, double*, int, double*, int) + ctypedef double (*dot_func)(int, const double*, int, const double*, int) cdef struct BlasFunctions: dot_func dot diff --git a/sklearn/svm/src/liblinear/_cython_blas_helpers.h b/sklearn/svm/src/liblinear/_cython_blas_helpers.h index 6b2475e9d56cf..bdec1a2f99eb9 100644 --- a/sklearn/svm/src/liblinear/_cython_blas_helpers.h +++ b/sklearn/svm/src/liblinear/_cython_blas_helpers.h @@ -1,10 +1,10 @@ #ifndef _CYTHON_BLAS_HELPERS_H #define _CYTHON_BLAS_HELPERS_H -typedef double (*dot_func)(int, double*, int, double*, int); -typedef void (*axpy_func)(int, double, double*, int, double*, int); -typedef void (*scal_func)(int, double, double*, int); -typedef double (*nrm2_func)(int, double*, int); +typedef double (*dot_func)(int, const double*, int, const double*, int); +typedef void (*axpy_func)(int, double, const double*, int, double*, int); +typedef void (*scal_func)(int, double, const double*, int); +typedef double (*nrm2_func)(int, const double*, int); typedef struct BlasFunctions{ dot_func dot; diff --git a/sklearn/svm/src/libsvm/_svm_cython_blas_helpers.h b/sklearn/svm/src/libsvm/_svm_cython_blas_helpers.h index 057e08195e9a5..2548c7844d267 100644 --- a/sklearn/svm/src/libsvm/_svm_cython_blas_helpers.h +++ b/sklearn/svm/src/libsvm/_svm_cython_blas_helpers.h @@ -1,7 +1,7 @@ #ifndef _SVM_CYTHON_BLAS_HELPERS_H #define _SVM_CYTHON_BLAS_HELPERS_H -typedef double (*dot_func)(int, double*, int, double*, int); +typedef double (*dot_func)(int, const double*, int, const double*, int); typedef struct BlasFunctions{ dot_func dot; } BlasFunctions;