Skip to content

Commit

Permalink
Merge pull request #481 from bjodah/fix-Equality-func
Browse files Browse the repository at this point in the history
Fix cython syntax, add tests
  • Loading branch information
isuruf authored Jul 9, 2024
2 parents b87a4a2 + 3eaf921 commit 9ce6c5a
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 67 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,32 +111,33 @@ jobs:
PYTHON_VERSION: '3.8'
WITH_SCIPY: yes
WITH_LLVM: 5.0
OS: macos-latest
OS: macos-13
CC: clang

- BUILD_TYPE: Release
PYTHON_VERSION: '3.9'
WITH_NUMPY: no
OS: macos-latest
OS: macos-13
CC: clang

- BUILD_TYPE: Debug
PYTHON_VERSION: '3.8'
WITH_NUMPY: no
OS: macos-latest
OS: macos-13
CC: gcc

- BUILD_TYPE: Release
PYTHON_VERSION: '3.8'
OS: macos-latest
OS: macos-13
CC: gcc

- BUILD_TYPE: Release
PYTHON_VERSION: '3.8'
PYTHON_VERSION: '3.11'
OS: ubuntu-20.04
WITH_MPC: yes
WITH_MPFR: yes
WITH_FLINT: yes
WITH_FLINT_PY: yes
WITH_SCIPY: yes
WITH_DOCS: yes
INTEGER_CLASS: flint
Expand Down
40 changes: 21 additions & 19 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,37 @@ environment:
PLATFORMTOOLSET: "v140"

matrix:
- BUILD_TYPE: "Release"
COMPILER: MSVC15
PLATFORM: "Win32"
PYTHON_VERSION: 39
CONDA_INSTALL_LOCN: C:\\Miniconda38-x64
WITH_MPFR: yes
WITH_MPC: yes
- BUILD_TYPE: "Release"
COMPILER: MSVC15
PLATFORM: "x64"
PYTHON_VERSION: 310-x64
CONDA_INSTALL_LOCN: C:\\Miniconda36-x64
CONDA_INSTALL_LOCN: C:\\Miniconda38-x64
WITH_MPFR: yes
WITH_MPC: yes
- BUILD_TYPE: "Release"
COMPILER: MSVC15
PLATFORM: "x64"
PYTHON_VERSION: 38-x64
CONDA_INSTALL_LOCN: C:\\Miniconda36-x64
CONDA_INSTALL_LOCN: C:\\Miniconda38-x64
- BUILD_TYPE: "Release"
COMPILER: MSVC15
PLATFORM: "x64"
PYTHON_VERSION: 39-x64
WITH_SYMPY: no
CONDA_INSTALL_LOCN: C:\\Miniconda36-x64
CONDA_INSTALL_LOCN: C:\\Miniconda38-x64
- BUILD_TYPE: "Release"
COMPILER: MSVC15
PLATFORM: "x64"
PYTHON_VERSION: 311-x64
WITH_NUMPY: no
CONDA_INSTALL_LOCN: C:\\Miniconda36-x64
CONDA_INSTALL_LOCN: C:\\Miniconda38-x64
#- BUILD_TYPE: "Debug"
# COMPILER: MinGW-w64
# PYTHON_VERSION: 39-x64
Expand All @@ -42,38 +49,33 @@ environment:
# COMPILER: MinGW-w64
# PYTHON_VERSION: 39-x64
# WITH_SYMPY: no
- BUILD_TYPE: "Release"
COMPILER: MSVC15
PLATFORM: "Win32"
PYTHON_VERSION: 39
CONDA_INSTALL_LOCN: C:\\Miniconda36
WITH_MPFR: yes
WITH_MPC: yes
- BUILD_TYPE: "Release"
COMPILER: MSVC15
PLATFORM: "x64"
PYTHON_VERSION: 310-x64
CONDA_INSTALL_LOCN: C:\\Miniconda36-x64
CONDA_INSTALL_LOCN: C:\\Miniconda38-x64
WITH_MPFR: yes
WITH_MPC: yes
WITH_LLVM: yes

install:
- set PYTHON_SOURCE_DIR=%CD%
- git clone https://github.com/sympy/symengine symengine-cpp
- if [%PLATFORM%]==[Win32] set "CONDA_SUBDIR=win-32"

- if [%COMPILER%]==[MSVC15] call %CONDA_INSTALL_LOCN%\Scripts\activate.bat
- if [%COMPILER%]==[MSVC15] conda install --yes --quiet conda python=3.6
- if [%COMPILER%]==[MSVC15] conda config --add channels conda-forge
- if [%COMPILER%]==[MSVC15] if [%BUILD_TYPE%]==[Debug] conda config --add channels symengine/label/debug
- if [%COMPILER%]==[MSVC15] conda install --yes mpir=3.0.0 vc=14
- if [%COMPILER%]==[MSVC15] set "CONDA_DEPS=mpir=3.0.0 vc=14"
- if [%COMPILER%]==[MSVC15] if [%WITH_MPFR%]==[yes] set "CONDA_DEPS=%CONDA_DEPS% mpfr=3.1.5"
- if [%COMPILER%]==[MSVC15] if [%WITH_MPC%]==[yes] set "CONDA_DEPS=%CONDA_DEPS% mpc=1.0.3"
- if [%COMPILER%]==[MSVC15] if [%WITH_LLVM%]==[yes] set "CONDA_DEPS=%CONDA_DEPS% llvmdev=4.0"
- if [%COMPILER%]==[MSVC15] set "CONDA_DEPS=%CONDA_DEPS% -c conda-forge"
- if [%COMPILER%]==[MSVC15] if [%BUILD_TYPE%]==[Debug] set "CONDA_DEPS=%CONDA_DEPS% -c symengine/label/debug"
- if [%COMPILER%]==[MSVC15] conda create -n deps --yes %CONDA_DEPS%
- if [%COMPILER%]==[MSVC15] call conda activate deps
- if [%COMPILER%]==[MSVC15] echo %CONDA_PREFIX%
- if [%COMPILER%]==[MSVC15] echo %PATH%
- if [%COMPILER%]==[MSVC15] set "PATH=%PATH%;%CONDA_PREFIX%\\Library\\bin;%CONDA_PREFIX%"
- if [%COMPILER%]==[MSVC15] echo %PATH%
- if [%COMPILER%]==[MSVC15] if [%WITH_MPFR%]==[yes] conda install --yes mpfr=3.1.5
- if [%COMPILER%]==[MSVC15] if [%WITH_MPC%]==[yes] conda install --yes mpc=1.0.3
- if [%COMPILER%]==[MSVC15] if [%WITH_LLVM%]==[yes] conda install --yes llvmdev=4.0

- if [%COMPILER%]==[MinGW] set "PATH=C:\MinGW\bin;%PATH%"
- if [%COMPILER%]==[MinGW] mingw-get update
Expand Down
4 changes: 4 additions & 0 deletions bin/install_travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ if [[ "${WITH_DOCS}" == "yes" ]]; then
export conda_pkgs="${conda_pkgs} sphinx recommonmark";
fi

if [[ "${WITH_FLINT_PY}" == "yes" ]]; then
export conda_pkgs="${conda_pkgs} python-flint"; # python-flint affects sympy, see e.g. sympy/sympy#26645
fi

if [[ "${WITH_SAGE}" == "yes" ]]; then
# This is split to avoid the 10 minute limit
conda install -q sagelib=8.1
Expand Down
11 changes: 6 additions & 5 deletions symengine/lib/symengine_wrapper.in.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

cimport symengine
from symengine cimport RCP, map_basic_basic, rcp_const_basic
from libcpp.memory cimport unique_ptr
from libcpp.vector cimport vector
from libcpp.string cimport string
from libcpp cimport bool as cppbool
Expand Down Expand Up @@ -44,7 +45,7 @@ cdef class _Lambdify(object):
cpdef unsafe_eval(sef, inp, out, unsigned nbroadcast=*)

cdef class LambdaDouble(_Lambdify):
cdef vector[symengine.LambdaRealDoubleVisitor] lambda_double
cdef unique_ptr[symengine.LambdaRealDoubleVisitor] lambda_visitor
cdef _init(self, symengine.vec_basic& args_, symengine.vec_basic& outs_, cppbool cse)
cpdef unsafe_real(self, double[::1] inp, double[::1] out, int inp_offset=*, int out_offset=*)
cpdef as_scipy_low_level_callable(self)
Expand All @@ -54,7 +55,7 @@ cdef class LambdaDouble(_Lambdify):
int inp_offset=*, int out_offset=*)

cdef class LambdaComplexDouble(_Lambdify):
cdef vector[symengine.LambdaComplexDoubleVisitor] lambda_double
cdef unique_ptr[symengine.LambdaComplexDoubleVisitor] lambda_visitor
cdef _init(self, symengine.vec_basic& args_, symengine.vec_basic& outs_, cppbool cse)
cpdef unsafe_complex(self, double complex[::1] inp, double complex[::1] out, int inp_offset=*, int out_offset=*)

Expand All @@ -63,22 +64,22 @@ IF HAVE_SYMENGINE_LLVM:
cdef int opt_level

cdef class LLVMDouble(_LLVMLambdify):
cdef vector[symengine.LLVMDoubleVisitor] lambda_double
cdef unique_ptr[symengine.LLVMDoubleVisitor] lambda_visitor
cdef _init(self, symengine.vec_basic& args_, symengine.vec_basic& outs_, cppbool cse)
cdef _load(self, const string &s)
cpdef unsafe_real(self, double[::1] inp, double[::1] out, int inp_offset=*, int out_offset=*)
cpdef as_scipy_low_level_callable(self)
cpdef as_ctypes(self)

cdef class LLVMFloat(_LLVMLambdify):
cdef vector[symengine.LLVMFloatVisitor] lambda_double
cdef unique_ptr[symengine.LLVMFloatVisitor] lambda_visitor
cdef _init(self, symengine.vec_basic& args_, symengine.vec_basic& outs_, cppbool cse)
cdef _load(self, const string &s)
cpdef unsafe_real(self, float[::1] inp, float[::1] out, int inp_offset=*, int out_offset=*)

IF HAVE_SYMENGINE_LLVM_LONG_DOUBLE:
cdef class LLVMLongDouble(_LLVMLambdify):
cdef vector[symengine.LLVMLongDoubleVisitor] lambda_double
cdef unique_ptr[symengine.LLVMLongDoubleVisitor] lambda_visitor
cdef _init(self, symengine.vec_basic& args_, symengine.vec_basic& outs_, cppbool cse)
cdef _load(self, const string &s)
cpdef unsafe_real(self, long double[::1] inp, long double[::1] out, int inp_offset=*, int out_offset=*)
Loading

0 comments on commit 9ce6c5a

Please # to comment.