Skip to content

Commit 9ce6c5a

Browse files
authored
Merge pull request #481 from bjodah/fix-Equality-func
Fix cython syntax, add tests
2 parents b87a4a2 + 3eaf921 commit 9ce6c5a

File tree

7 files changed

+82
-67
lines changed

7 files changed

+82
-67
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,32 +111,33 @@ jobs:
111111
PYTHON_VERSION: '3.8'
112112
WITH_SCIPY: yes
113113
WITH_LLVM: 5.0
114-
OS: macos-latest
114+
OS: macos-13
115115
CC: clang
116116

117117
- BUILD_TYPE: Release
118118
PYTHON_VERSION: '3.9'
119119
WITH_NUMPY: no
120-
OS: macos-latest
120+
OS: macos-13
121121
CC: clang
122122

123123
- BUILD_TYPE: Debug
124124
PYTHON_VERSION: '3.8'
125125
WITH_NUMPY: no
126-
OS: macos-latest
126+
OS: macos-13
127127
CC: gcc
128128

129129
- BUILD_TYPE: Release
130130
PYTHON_VERSION: '3.8'
131-
OS: macos-latest
131+
OS: macos-13
132132
CC: gcc
133133

134134
- BUILD_TYPE: Release
135-
PYTHON_VERSION: '3.8'
135+
PYTHON_VERSION: '3.11'
136136
OS: ubuntu-20.04
137137
WITH_MPC: yes
138138
WITH_MPFR: yes
139139
WITH_FLINT: yes
140+
WITH_FLINT_PY: yes
140141
WITH_SCIPY: yes
141142
WITH_DOCS: yes
142143
INTEGER_CLASS: flint

appveyor.yml

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,37 @@ environment:
77
PLATFORMTOOLSET: "v140"
88

99
matrix:
10+
- BUILD_TYPE: "Release"
11+
COMPILER: MSVC15
12+
PLATFORM: "Win32"
13+
PYTHON_VERSION: 39
14+
CONDA_INSTALL_LOCN: C:\\Miniconda38-x64
15+
WITH_MPFR: yes
16+
WITH_MPC: yes
1017
- BUILD_TYPE: "Release"
1118
COMPILER: MSVC15
1219
PLATFORM: "x64"
1320
PYTHON_VERSION: 310-x64
14-
CONDA_INSTALL_LOCN: C:\\Miniconda36-x64
21+
CONDA_INSTALL_LOCN: C:\\Miniconda38-x64
1522
WITH_MPFR: yes
1623
WITH_MPC: yes
1724
- BUILD_TYPE: "Release"
1825
COMPILER: MSVC15
1926
PLATFORM: "x64"
2027
PYTHON_VERSION: 38-x64
21-
CONDA_INSTALL_LOCN: C:\\Miniconda36-x64
28+
CONDA_INSTALL_LOCN: C:\\Miniconda38-x64
2229
- BUILD_TYPE: "Release"
2330
COMPILER: MSVC15
2431
PLATFORM: "x64"
2532
PYTHON_VERSION: 39-x64
2633
WITH_SYMPY: no
27-
CONDA_INSTALL_LOCN: C:\\Miniconda36-x64
34+
CONDA_INSTALL_LOCN: C:\\Miniconda38-x64
2835
- BUILD_TYPE: "Release"
2936
COMPILER: MSVC15
3037
PLATFORM: "x64"
3138
PYTHON_VERSION: 311-x64
3239
WITH_NUMPY: no
33-
CONDA_INSTALL_LOCN: C:\\Miniconda36-x64
40+
CONDA_INSTALL_LOCN: C:\\Miniconda38-x64
3441
#- BUILD_TYPE: "Debug"
3542
# COMPILER: MinGW-w64
3643
# PYTHON_VERSION: 39-x64
@@ -42,38 +49,33 @@ environment:
4249
# COMPILER: MinGW-w64
4350
# PYTHON_VERSION: 39-x64
4451
# WITH_SYMPY: no
45-
- BUILD_TYPE: "Release"
46-
COMPILER: MSVC15
47-
PLATFORM: "Win32"
48-
PYTHON_VERSION: 39
49-
CONDA_INSTALL_LOCN: C:\\Miniconda36
50-
WITH_MPFR: yes
51-
WITH_MPC: yes
5252
- BUILD_TYPE: "Release"
5353
COMPILER: MSVC15
5454
PLATFORM: "x64"
5555
PYTHON_VERSION: 310-x64
56-
CONDA_INSTALL_LOCN: C:\\Miniconda36-x64
56+
CONDA_INSTALL_LOCN: C:\\Miniconda38-x64
5757
WITH_MPFR: yes
5858
WITH_MPC: yes
5959
WITH_LLVM: yes
6060

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

6566
- if [%COMPILER%]==[MSVC15] call %CONDA_INSTALL_LOCN%\Scripts\activate.bat
66-
- if [%COMPILER%]==[MSVC15] conda install --yes --quiet conda python=3.6
67-
- if [%COMPILER%]==[MSVC15] conda config --add channels conda-forge
68-
- if [%COMPILER%]==[MSVC15] if [%BUILD_TYPE%]==[Debug] conda config --add channels symengine/label/debug
69-
- if [%COMPILER%]==[MSVC15] conda install --yes mpir=3.0.0 vc=14
67+
- if [%COMPILER%]==[MSVC15] set "CONDA_DEPS=mpir=3.0.0 vc=14"
68+
- if [%COMPILER%]==[MSVC15] if [%WITH_MPFR%]==[yes] set "CONDA_DEPS=%CONDA_DEPS% mpfr=3.1.5"
69+
- if [%COMPILER%]==[MSVC15] if [%WITH_MPC%]==[yes] set "CONDA_DEPS=%CONDA_DEPS% mpc=1.0.3"
70+
- if [%COMPILER%]==[MSVC15] if [%WITH_LLVM%]==[yes] set "CONDA_DEPS=%CONDA_DEPS% llvmdev=4.0"
71+
- if [%COMPILER%]==[MSVC15] set "CONDA_DEPS=%CONDA_DEPS% -c conda-forge"
72+
- if [%COMPILER%]==[MSVC15] if [%BUILD_TYPE%]==[Debug] set "CONDA_DEPS=%CONDA_DEPS% -c symengine/label/debug"
73+
- if [%COMPILER%]==[MSVC15] conda create -n deps --yes %CONDA_DEPS%
74+
- if [%COMPILER%]==[MSVC15] call conda activate deps
7075
- if [%COMPILER%]==[MSVC15] echo %CONDA_PREFIX%
7176
- if [%COMPILER%]==[MSVC15] echo %PATH%
7277
- if [%COMPILER%]==[MSVC15] set "PATH=%PATH%;%CONDA_PREFIX%\\Library\\bin;%CONDA_PREFIX%"
7378
- if [%COMPILER%]==[MSVC15] echo %PATH%
74-
- if [%COMPILER%]==[MSVC15] if [%WITH_MPFR%]==[yes] conda install --yes mpfr=3.1.5
75-
- if [%COMPILER%]==[MSVC15] if [%WITH_MPC%]==[yes] conda install --yes mpc=1.0.3
76-
- if [%COMPILER%]==[MSVC15] if [%WITH_LLVM%]==[yes] conda install --yes llvmdev=4.0
7779

7880
- if [%COMPILER%]==[MinGW] set "PATH=C:\MinGW\bin;%PATH%"
7981
- if [%COMPILER%]==[MinGW] mingw-get update

bin/install_travis.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ if [[ "${WITH_DOCS}" == "yes" ]]; then
1616
export conda_pkgs="${conda_pkgs} sphinx recommonmark";
1717
fi
1818

19+
if [[ "${WITH_FLINT_PY}" == "yes" ]]; then
20+
export conda_pkgs="${conda_pkgs} python-flint"; # python-flint affects sympy, see e.g. sympy/sympy#26645
21+
fi
22+
1923
if [[ "${WITH_SAGE}" == "yes" ]]; then
2024
# This is split to avoid the 10 minute limit
2125
conda install -q sagelib=8.1

symengine/lib/symengine_wrapper.in.pxd

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
cimport symengine
44
from symengine cimport RCP, map_basic_basic, rcp_const_basic
5+
from libcpp.memory cimport unique_ptr
56
from libcpp.vector cimport vector
67
from libcpp.string cimport string
78
from libcpp cimport bool as cppbool
@@ -44,7 +45,7 @@ cdef class _Lambdify(object):
4445
cpdef unsafe_eval(sef, inp, out, unsigned nbroadcast=*)
4546

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

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

@@ -63,22 +64,22 @@ IF HAVE_SYMENGINE_LLVM:
6364
cdef int opt_level
6465

6566
cdef class LLVMDouble(_LLVMLambdify):
66-
cdef vector[symengine.LLVMDoubleVisitor] lambda_double
67+
cdef unique_ptr[symengine.LLVMDoubleVisitor] lambda_visitor
6768
cdef _init(self, symengine.vec_basic& args_, symengine.vec_basic& outs_, cppbool cse)
6869
cdef _load(self, const string &s)
6970
cpdef unsafe_real(self, double[::1] inp, double[::1] out, int inp_offset=*, int out_offset=*)
7071
cpdef as_scipy_low_level_callable(self)
7172
cpdef as_ctypes(self)
7273

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

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

0 commit comments

Comments
 (0)