symengine 0.9.2__tar.gz → 0.11.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. symengine-0.11.0/.github/workflows/ci.yml +193 -0
  2. symengine-0.11.0/.gitignore +45 -0
  3. symengine-0.11.0/.mailmap +23 -0
  4. symengine-0.11.0/AUTHORS +37 -0
  5. {symengine-0.9.2 → symengine-0.11.0}/CMakeLists.txt +12 -0
  6. {symengine-0.9.2/symengine.egg-info → symengine-0.11.0}/PKG-INFO +16 -14
  7. {symengine-0.9.2 → symengine-0.11.0}/README.md +3 -2
  8. symengine-0.11.0/appveyor.yml +144 -0
  9. symengine-0.11.0/benchmarks/6_links_rhs.txt +1 -0
  10. symengine-0.11.0/benchmarks/Lambdify.py +103 -0
  11. symengine-0.11.0/benchmarks/Lambdify_reference.pyx +10 -0
  12. symengine-0.11.0/benchmarks/expand1.py +10 -0
  13. symengine-0.11.0/benchmarks/expand1_sage.py +8 -0
  14. symengine-0.11.0/benchmarks/expand2.py +26 -0
  15. symengine-0.11.0/benchmarks/expand2_sage.py +10 -0
  16. symengine-0.11.0/benchmarks/expand2b_sage.sage +10 -0
  17. symengine-0.11.0/benchmarks/expand2b_sympy.py +10 -0
  18. symengine-0.11.0/benchmarks/expand3.py +11 -0
  19. symengine-0.11.0/benchmarks/expand3_sage.py +9 -0
  20. symengine-0.11.0/benchmarks/expand4.py +12 -0
  21. symengine-0.11.0/benchmarks/expand4_sage.py +13 -0
  22. symengine-0.11.0/benchmarks/expand5.py +12 -0
  23. symengine-0.11.0/benchmarks/expand5_sage.py +10 -0
  24. symengine-0.11.0/benchmarks/expand6.py +34 -0
  25. symengine-0.11.0/benchmarks/expand6b.py +34 -0
  26. symengine-0.11.0/benchmarks/expand7.py +26 -0
  27. symengine-0.11.0/benchmarks/expr.txt +1 -0
  28. symengine-0.11.0/benchmarks/heterogeneous_output_Lambdify.py +83 -0
  29. symengine-0.11.0/benchmarks/kane.py +32 -0
  30. symengine-0.11.0/benchmarks/kane_generate.py +304 -0
  31. symengine-0.11.0/benchmarks/legendre1.py +28 -0
  32. symengine-0.11.0/benchmarks/legendre1_sage.py +28 -0
  33. symengine-0.11.0/benchmarks/pydy_pendulum.py +26 -0
  34. symengine-0.11.0/benchmarks/symbench.py +45 -0
  35. symengine-0.11.0/benchmarks/symbench_def.py +101 -0
  36. symengine-0.11.0/benchmarks/symbench_sage.py +80 -0
  37. symengine-0.11.0/bin/install_travis.sh +33 -0
  38. symengine-0.11.0/bin/test_python.py +18 -0
  39. symengine-0.11.0/bin/test_symengine_unix.sh +22 -0
  40. symengine-0.11.0/bin/test_travis.sh +21 -0
  41. symengine-0.11.0/bin/trigger_feedstock.sh +57 -0
  42. {symengine-0.9.2 → symengine-0.11.0}/cmake/FindCython.cmake +5 -18
  43. symengine-0.11.0/cmake/preprocess.py +38 -0
  44. symengine-0.11.0/docs/conf.py +90 -0
  45. symengine-0.11.0/docs/index.rst +22 -0
  46. {symengine-0.9.2 → symengine-0.11.0}/setup.py +20 -12
  47. symengine-0.11.0/symengine/CMakeLists.txt +10 -0
  48. {symengine-0.9.2 → symengine-0.11.0}/symengine/__init__.py +9 -3
  49. symengine-0.11.0/symengine/lib/CMakeLists.txt +83 -0
  50. {symengine-0.9.2 → symengine-0.11.0}/symengine/lib/pywrapper.cpp +32 -18
  51. {symengine-0.9.2 → symengine-0.11.0}/symengine/lib/pywrapper.h +22 -5
  52. {symengine-0.9.2 → symengine-0.11.0}/symengine/lib/symengine.pxd +274 -432
  53. symengine-0.9.2/symengine/lib/symengine_wrapper.pxd → symengine-0.11.0/symengine/lib/symengine_wrapper.in.pxd +0 -2
  54. symengine-0.9.2/symengine/lib/symengine_wrapper.pyx → symengine-0.11.0/symengine/lib/symengine_wrapper.in.pyx +342 -166
  55. {symengine-0.9.2 → symengine-0.11.0}/symengine/printing.py +3 -3
  56. symengine-0.11.0/symengine/test_utilities.py +95 -0
  57. {symengine-0.9.2 → symengine-0.11.0}/symengine/tests/test_arit.py +21 -10
  58. {symengine-0.9.2 → symengine-0.11.0}/symengine/tests/test_dict_basic.py +4 -4
  59. {symengine-0.9.2 → symengine-0.11.0}/symengine/tests/test_eval.py +2 -2
  60. symengine-0.11.0/symengine/tests/test_expr.py +28 -0
  61. {symengine-0.9.2 → symengine-0.11.0}/symengine/tests/test_functions.py +2 -1
  62. {symengine-0.9.2 → symengine-0.11.0}/symengine/tests/test_lambdify.py +1 -6
  63. {symengine-0.9.2 → symengine-0.11.0}/symengine/tests/test_logic.py +4 -2
  64. {symengine-0.9.2 → symengine-0.11.0}/symengine/tests/test_matrices.py +22 -10
  65. {symengine-0.9.2 → symengine-0.11.0}/symengine/tests/test_ntheory.py +1 -1
  66. {symengine-0.9.2 → symengine-0.11.0}/symengine/tests/test_number.py +1 -1
  67. {symengine-0.9.2 → symengine-0.11.0}/symengine/tests/test_pickling.py +1 -1
  68. {symengine-0.9.2 → symengine-0.11.0}/symengine/tests/test_printing.py +1 -1
  69. {symengine-0.9.2 → symengine-0.11.0}/symengine/tests/test_series_expansion.py +1 -1
  70. {symengine-0.9.2 → symengine-0.11.0}/symengine/tests/test_sets.py +1 -1
  71. {symengine-0.9.2 → symengine-0.11.0}/symengine/tests/test_solve.py +1 -1
  72. {symengine-0.9.2 → symengine-0.11.0}/symengine/tests/test_subs.py +1 -1
  73. {symengine-0.9.2 → symengine-0.11.0}/symengine/tests/test_symbol.py +5 -5
  74. {symengine-0.9.2 → symengine-0.11.0}/symengine/tests/test_sympify.py +2 -2
  75. {symengine-0.9.2 → symengine-0.11.0}/symengine/tests/test_sympy_compat.py +2 -2
  76. {symengine-0.9.2 → symengine-0.11.0}/symengine/tests/test_sympy_conv.py +40 -3
  77. {symengine-0.9.2 → symengine-0.11.0}/symengine/tests/test_var.py +1 -1
  78. {symengine-0.9.2 → symengine-0.11.0}/symengine/utilities.py +0 -93
  79. {symengine-0.9.2 → symengine-0.11.0/symengine.egg-info}/PKG-INFO +16 -14
  80. {symengine-0.9.2 → symengine-0.11.0}/symengine.egg-info/SOURCES.txt +44 -3
  81. symengine-0.11.0/symengine.egg-info/top_level.txt +1 -0
  82. symengine-0.11.0/symengine_version.txt +1 -0
  83. symengine-0.9.2/symengine/CMakeLists.txt +0 -7
  84. symengine-0.9.2/symengine/lib/CMakeLists.txt +0 -50
  85. symengine-0.9.2/symengine/lib/config.pxi.in +0 -6
  86. symengine-0.9.2/symengine/tests/test_expr.py +0 -14
  87. symengine-0.9.2/symengine.egg-info/top_level.txt +0 -1
  88. symengine-0.9.2/symengine_version.txt +0 -1
  89. {symengine-0.9.2 → symengine-0.11.0}/LICENSE +0 -0
  90. {symengine-0.9.2 → symengine-0.11.0}/MANIFEST.in +0 -0
  91. {symengine-0.9.2 → symengine-0.11.0}/cmake/FindNumPy.cmake +0 -0
  92. {symengine-0.9.2 → symengine-0.11.0}/cmake/FindPython.cmake +0 -0
  93. {symengine-0.9.2 → symengine-0.11.0}/cmake/check_python_hypot.cpp +0 -0
  94. {symengine-0.9.2 → symengine-0.11.0}/cmake/cython_test.pyx +0 -0
  95. {symengine-0.9.2 → symengine-0.11.0}/cmake/get_suffix.py +0 -0
  96. {symengine-0.9.2 → symengine-0.11.0}/cmake/version_script.txt +0 -0
  97. {symengine-0.9.2 → symengine-0.11.0}/setup.cfg +0 -0
  98. {symengine-0.9.2 → symengine-0.11.0}/symengine/functions.py +0 -0
  99. {symengine-0.9.2 → symengine-0.11.0}/symengine/lib/__init__.py +0 -0
  100. {symengine-0.9.2 → symengine-0.11.0}/symengine/sympy_compat.py +0 -0
  101. {symengine-0.9.2 → symengine-0.11.0}/symengine/tests/CMakeLists.txt +0 -0
  102. {symengine-0.9.2 → symengine-0.11.0}/symengine/tests/__init__.py +0 -0
  103. {symengine-0.9.2 → symengine-0.11.0}/symengine/tests/test_cse.py +0 -0
  104. {symengine-0.9.2 → symengine-0.11.0}/symengine/tests/test_sage.py +0 -0
  105. {symengine-0.9.2 → symengine-0.11.0}/symengine.egg-info/dependency_links.txt +0 -0
  106. {symengine-0.9.2 → symengine-0.11.0}/symengine.egg-info/not-zip-safe +0 -0
@@ -0,0 +1,193 @@
1
+ name: Build and test symengine
2
+ on: [push, pull_request]
3
+
4
+ jobs:
5
+ build:
6
+ runs-on: ${{ matrix.OS }}
7
+ strategy:
8
+ fail-fast: false
9
+ matrix:
10
+ include:
11
+ - BUILD_TYPE: Debug
12
+ WITH_BFD: yes
13
+ PYTHON_VERSION: '3.12'
14
+ TEST_SYMPY: yes
15
+ OS: ubuntu-20.04
16
+ CC: gcc
17
+
18
+ - BUILD_TYPE: Debug
19
+ WITH_BFD: yes
20
+ PYTHON_VERSION: '3.11'
21
+ TEST_SYMPY: yes
22
+ OS: ubuntu-20.04
23
+ CC: gcc
24
+
25
+ - BUILD_TYPE: Debug
26
+ WITH_BFD: yes
27
+ PYTHON_VERSION: '3.10'
28
+ TEST_SYMPY: yes
29
+ OS: ubuntu-20.04
30
+ CC: gcc
31
+
32
+ - BUILD_TYPE: Debug
33
+ WITH_BFD: yes
34
+ PYTHON_VERSION: '3.9'
35
+ TEST_SYMPY: yes
36
+ OS: ubuntu-20.04
37
+ CC: gcc
38
+
39
+ - BUILD_TYPE: Release
40
+ PYTHON_VERSION: '3.8'
41
+ BUILD_SHARED_LIBS: yes
42
+ OS: ubuntu-20.04
43
+ CC: gcc
44
+
45
+ - BUILD_TYPE: Release
46
+ PYTHON_VERSION: '3.8'
47
+ WITH_MPFR: yes
48
+ INTEGER_CLASS: gmpxx
49
+ WITH_NUMPY: no
50
+ OS: ubuntu-20.04
51
+ CC: gcc
52
+
53
+ - BUILD_TYPE: Release
54
+ PYTHON_VERSION: '3.8'
55
+ WITH_MPC: yes
56
+ OS: ubuntu-20.04
57
+ CC: gcc
58
+
59
+ - BUILD_TYPE: Release
60
+ WITH_MPFR: yes
61
+ PYTHON_VERSION: '3.8'
62
+ OS: ubuntu-20.04
63
+ CC: gcc
64
+
65
+ - BUILD_TYPE: Release
66
+ PYTHON_VERSION: '3.9'
67
+ WITH_MPC: yes
68
+ OS: ubuntu-20.04
69
+ CC: gcc
70
+
71
+ - BUILD_TYPE: Release
72
+ PYTHON_VERSION: '3.9'
73
+ WITH_MPC: yes
74
+ INTEGER_CLASS: flint
75
+ WITH_FLINT: yes
76
+ OS: ubuntu-20.04
77
+ CC: gcc
78
+
79
+ #- BUILD_TYPE: Debug
80
+ # PYTHON_VERSION: '3.9'
81
+ # WITH_BFD: yes
82
+ # WITH_PIRANHA: yes
83
+ # OS: ubuntu-20.04
84
+ # CC: gcc
85
+
86
+ - BUILD_TYPE: Debug
87
+ PYTHON_VERSION: '3.8'
88
+ WITH_BFD: yes
89
+ BUILD_SHARED_LIBS: yes
90
+ OS: ubuntu-20.04
91
+ CC: clang
92
+
93
+ - BUILD_TYPE: Release
94
+ PYTHON_VERSION: '3.8'
95
+ WITH_NUMPY: yes
96
+ OS: ubuntu-20.04
97
+ CC: clang
98
+
99
+ - BUILD_TYPE: Debug
100
+ PYTHON_VERSION: '3.10'
101
+ WITH_SYMPY: yes
102
+ WITH_LLVM: 14
103
+ WITH_SCIPY: yes
104
+ INTEGER_CLASS: 'boostmp'
105
+ PYTEST_ADDOPTS: '-k "not integer_nthroot"'
106
+ OS: ubuntu-22.04
107
+ EXTRA_APT_REPOSITORY: 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-14 main'
108
+ EXTRA_APT_PACKAGES: 'llvm-14'
109
+
110
+ - BUILD_TYPE: Debug
111
+ PYTHON_VERSION: '3.8'
112
+ WITH_SCIPY: yes
113
+ WITH_LLVM: 5.0
114
+ OS: macos-latest
115
+ CC: clang
116
+
117
+ - BUILD_TYPE: Release
118
+ PYTHON_VERSION: '3.9'
119
+ WITH_NUMPY: no
120
+ OS: macos-latest
121
+ CC: clang
122
+
123
+ - BUILD_TYPE: Debug
124
+ PYTHON_VERSION: '3.8'
125
+ WITH_NUMPY: no
126
+ OS: macos-latest
127
+ CC: gcc
128
+
129
+ - BUILD_TYPE: Release
130
+ PYTHON_VERSION: '3.8'
131
+ OS: macos-latest
132
+ CC: gcc
133
+
134
+ - BUILD_TYPE: Release
135
+ PYTHON_VERSION: '3.8'
136
+ OS: ubuntu-20.04
137
+ WITH_MPC: yes
138
+ WITH_MPFR: yes
139
+ WITH_FLINT: yes
140
+ WITH_SCIPY: yes
141
+ WITH_DOCS: yes
142
+ INTEGER_CLASS: flint
143
+ TEST_SYMPY: yes
144
+ CC: gcc
145
+
146
+ steps:
147
+ - name: Checkout code
148
+ uses: actions/checkout@v4
149
+
150
+ - name: Build and test symengine
151
+ shell: bash
152
+ run: |
153
+ source bin/test_symengine_unix.sh
154
+ env:
155
+ PYTEST_ADDOPTS: ${{ matrix.PYTEST_ADDOPTS }}
156
+ USE_GLIBCXX_DEBUG: ${{ matrix.USE_GLIBCXX_DEBUG }}
157
+ WITH_MPFR: ${{ matrix.WITH_MPFR }}
158
+ BUILD_BENCHMARKS: ${{ matrix.BUILD_BENCHMARKS }}
159
+ WITH_LLVM: ${{ matrix.WITH_LLVM }}
160
+ WITH_BENCHMARKS_NONIUS: ${{ matrix.WITH_BENCHMARKS_NONIUS }}
161
+ WITH_SYMENGINE_RCP: ${{ matrix.WITH_SYMENGINE_RCP }}
162
+ TEST_IN_TREE: ${{ matrix.TEST_IN_TREE }}
163
+ WITH_SYMENGINE_THREAD_SAFE: ${{ matrix.WITH_SYMENGINE_THREAD_SAFE }}
164
+ WITH_PRIMESIEVE: ${{ matrix.WITH_PRIMESIEVE }}
165
+ INTEGER_CLASS: ${{ matrix.INTEGER_CLASS }}
166
+ WITH_ARB: ${{ matrix.WITH_ARB }}
167
+ WITH_PIRANHA: ${{ matrix.WITH_PIRANHA }}
168
+ WITH_GCC_6: ${{ matrix.WITH_GCC_6 }}
169
+ CONDA_ENV_FILE: ${{ matrix.CONDA_ENV_FILE }}
170
+ WITH_BFD: ${{ matrix.WITH_BFD }}
171
+ WITH_FLINT: ${{ matrix.WITH_FLINT }}
172
+ EXTRA_APT_REPOSITORY: ${{ matrix.EXTRA_APT_REPOSITORY }}
173
+ EXTRA_APT_PACKAGES: ${{ matrix.EXTRA_APT_PACKAGES }}
174
+ TEST_CLANG_FORMAT: ${{ matrix.TEST_CLANG_FORMAT }}
175
+ WITH_ECM: ${{ matrix.WITH_ECM }}
176
+ WITH_LATEST_GCC: ${{ matrix.WITH_LATEST_GCC }}
177
+ OS: ${{ matrix.OS }}
178
+ WITH_FLINT_DEV: ${{ matrix.WITH_FLINT_DEV }}
179
+ CC: ${{ matrix.CC }}
180
+ WITH_COVERAGE: ${{ matrix.WITH_COVERAGE }}
181
+ BUILD_TYPE: ${{ matrix.BUILD_TYPE }}
182
+ WITH_SANITIZE: ${{ matrix.WITH_SANITIZE }}
183
+ WITH_MPC: ${{ matrix.WITH_MPC }}
184
+ MAKEFLAGS: ${{ matrix.MAKEFLAGS }}
185
+ BUILD_SHARED_LIBS: ${{ matrix.BUILD_SHARED_LIBS }}
186
+ PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
187
+
188
+ - name: Deploy Documentation
189
+ if: ${{ (github.ref == 'refs/heads/main' && github.repository == 'Symengine/symengine.py') || (github.ref == 'refs/heads/master' && github.repository == 'Symengine/symengine.py')}}
190
+ uses: peaceiris/actions-gh-pages@v3
191
+ with:
192
+ github_token: ${{ secrets.GITHUB_TOKEN }}
193
+ publish_dir: ./genDocs
@@ -0,0 +1,45 @@
1
+ # CMake
2
+ CMakeCache.txt
3
+ CMakeFiles
4
+ Makefile
5
+ cmake_install.cmake
6
+ install_manifest.txt
7
+ CTestTestfile.cmake
8
+ cython_test.cpp
9
+
10
+ # Compiled Object Files, Static/Dynamic Libraries
11
+ *.so
12
+ *.a
13
+ *.o
14
+ *.out
15
+ *.exe
16
+ *.pyd
17
+ *.sln
18
+ *.vcxproj
19
+ *.filters
20
+ symengine/lib/symengine_wrapper.cpp
21
+ symengine/lib/symengine_wrapper.pyx
22
+ symengine/lib/symengine_wrapper.pxd
23
+
24
+ # Config Files
25
+ symengine/lib/config.pxi
26
+
27
+ # Python build files
28
+ build*
29
+ *__pycache__*
30
+ *.pyc
31
+ MANIFEST
32
+ *.egg-info
33
+ dist/
34
+ .*cache/
35
+ symengine.egg-info/
36
+
37
+ # Temp files
38
+ *~
39
+ .eggs/
40
+
41
+ # Docs
42
+ genDocs/
43
+ docs/_build/
44
+ docs/source/
45
+ symengine/lib/version_script_symengine_wrapper.txt
@@ -0,0 +1,23 @@
1
+ # Prevent git from showing duplicate names with commands like "git shortlog"
2
+ # See the manpage of git-shortlog for details.
3
+ # The syntax is:
4
+ # Name that should be used <email that should be used> Bad name <bad email>
5
+ #
6
+ # You can skip Bad name if it is the same as the one that should be used, and is unique.
7
+ #
8
+ # This file is up-to-date if the command git log --format="%aN <%aE>" | sort -u
9
+ # gives no duplicates.
10
+
11
+ Ondřej Čertík <ondrej@certik.us> <ondrej.certik@gmail.com>
12
+ Peter Brady <petertbrady@gmail.com> <ptb@lanl.gov>
13
+ Isuru Fernando <isuruf@gmail.com> <isuru.11@cse.mrt.ac.lk>
14
+ Isuru Fernando <isuruf@gmail.com> <idf2@illinois.edu>
15
+ Alan Hu <alanlh2@illinois.edu> <31489167+alanlh@users.noreply.github.com>
16
+ Shivam Vats <shivamvats.iitkgp@gmail.com> <shivamvats@users.noreply.github.com>
17
+ Shikhar Jaiswal <jaiswalshikhar87@gmail.com>
18
+ Sumith Kulal <sumith1896@gmail.com>
19
+ Sushant Hiray <hiraysushant@gmail.com>
20
+ Abhinav Agarwal <abhinavagarwal1996@gmail.com>
21
+ Nilay Pochhi <pochhi.nilay@gmail.com>
22
+ Björn Dahlgren <bjodah@gmail.com>
23
+ Richard Otis <richard.otis@outlook.com> richardotis
@@ -0,0 +1,37 @@
1
+ All people who contributed to symengine.py by sending at least a patch or more
2
+ (Note that this repository was a subfolder of symengine repo and early contributors
3
+ to the python bindings maybe listed in AUTHORS of symengine repo).
4
+ You can generate this file by: bin/update_authors.sh.
5
+
6
+ Ondřej Čertík <ondrej@certik.us>
7
+ Thilina Bandara Rathanyake <thilinarmtb@gmail.com>
8
+ Isuru Fernando <isuruf@gmail.com>
9
+ Sushant Hiray <hiraysushant@gmail.com>
10
+ Peter Brady <petertbrady@gmail.com>
11
+ Thilina Bandara Rathnayake <thilinarmtb@gmail.com>
12
+ Shivam Vats <shivamvats.iitkgp@gmail.com>
13
+ Sumith Kulal <sumith1896@gmail.com>
14
+ Connor Behan <connor.behan@gmail.com>
15
+ Ralf Stephan <ralf@ark.in-berlin.de>
16
+ Björn Dahlgren <bjodah@gmail.com>
17
+ Indrek Mandre <indrek@mare.ee>
18
+ Abhinav Agarwal <abhinavagarwal1996@gmail.com>
19
+ Matt Wala <wala1@illinois.edu>
20
+ Shikhar Jaiswal <jaiswalshikhar87@gmail.com>
21
+ Nilay Pochhi <pochhi.nilay@gmail.com>
22
+ xoviat <xoviat@users.noreply.github.com>
23
+ Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com>
24
+ Moritz E. Beber <morbeb@biosustain.dtu.dk>
25
+ Alan Hu <alanlh2@illinois.edu>
26
+ Richard Otis <richard.otis@outlook.com>
27
+ Erik Jansson Agnvall <erikjansson90@gmail.com>
28
+ Simon Stelter <stelter@uni-bremen.de>
29
+ Jialin Ma <marlin@inventati.org>
30
+ Rikard Nordgren <rikard.nordgren@farmaci.uu.se>
31
+ Rohit Goswami <rgoswami@ieee.org>
32
+ Matthew Treinish <mtreinish@kortar.org>
33
+ Michał Górny <mgorny@gentoo.org>
34
+ Garming Sam <garming@catalyst.net.nz>
35
+ Pieter Eendebak <pieter.eendebak@gmail.com>
36
+ Ayush Kumar <ayushk7102@gmail.com>
37
+ Christian Clauss <cclauss@me.com>
@@ -1,7 +1,18 @@
1
1
  cmake_minimum_required(VERSION 2.8.12)
2
+
3
+ if (POLICY CMP0057)
4
+ cmake_policy(SET CMP0057 NEW) # needed for llvm >= 16
5
+ endif ()
6
+ if (POLICY CMP0074)
7
+ cmake_policy(SET CMP0074 NEW) # allow user to set *_ROOT variables
8
+ endif()
9
+
2
10
  project(python_wrapper)
3
11
 
4
12
  set(CMAKE_PREFIX_PATH ${SymEngine_DIR} ${CMAKE_PREFIX_PATH})
13
+
14
+ include(GNUInstallDirs)
15
+
5
16
  find_package(SymEngine 0.8.1 REQUIRED CONFIG
6
17
  PATH_SUFFIXES lib/cmake/symengine cmake/symengine CMake/)
7
18
  message("SymEngine_DIR : " ${SymEngine_DIR})
@@ -44,6 +55,7 @@ foreach (PKG MPC MPFR PIRANHA FLINT LLVM)
44
55
  set(HAVE_SYMENGINE_${PKG} False)
45
56
  endif()
46
57
  endforeach()
58
+ option(SYMENGINE_INSTALL_PY_FILES "Install python files" ON)
47
59
 
48
60
  message("CMAKE_SYSTEM_PROCESSOR : ${CMAKE_SYSTEM_PROCESSOR}")
49
61
  message("CMAKE_BUILD_TYPE : ${CMAKE_BUILD_TYPE}")
@@ -1,29 +1,31 @@
1
- Metadata-Version: 1.2
1
+ Metadata-Version: 2.1
2
2
  Name: symengine
3
- Version: 0.9.2
3
+ Version: 0.11.0
4
4
  Summary: Python library providing wrappers to SymEngine
5
5
  Home-page: https://github.com/symengine/symengine.py
6
6
  Author: SymEngine development team
7
7
  Author-email: symengine@googlegroups.com
8
8
  License: MIT
9
- Description:
10
- SymEngine is a standalone fast C++ symbolic manipulation library.
11
- Optional thin Python wrappers (SymEngine) allow easy usage from Python and
12
- integration with SymPy and Sage.
13
-
14
- See https://github.com/symengine/symengine.py for information about License
15
- and dependencies of wheels
16
-
17
-
18
- Platform: UNKNOWN
19
9
  Classifier: License :: OSI Approved :: MIT License
20
10
  Classifier: Operating System :: OS Independent
21
11
  Classifier: Programming Language :: Python
22
12
  Classifier: Topic :: Scientific/Engineering
23
13
  Classifier: Topic :: Scientific/Engineering :: Mathematics
24
14
  Classifier: Topic :: Scientific/Engineering :: Physics
25
- Classifier: Programming Language :: Python :: 3.7
26
15
  Classifier: Programming Language :: Python :: 3.8
27
16
  Classifier: Programming Language :: Python :: 3.9
28
17
  Classifier: Programming Language :: Python :: 3.10
29
- Requires-Python: >=3.7,<4
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Requires-Python: >=3.8,<4
21
+ License-File: LICENSE
22
+ License-File: AUTHORS
23
+
24
+
25
+ SymEngine is a standalone fast C++ symbolic manipulation library.
26
+ Optional thin Python wrappers (SymEngine) allow easy usage from Python and
27
+ integration with SymPy and Sage.
28
+
29
+ See https://github.com/symengine/symengine.py for information about License
30
+ and dependencies of wheels
31
+
@@ -26,7 +26,7 @@ optionally, you may choose to install an early [developer preview](https://githu
26
26
  Install prerequisites.
27
27
 
28
28
  CMake >= 2.8.12
29
- Python3 >= 3.7
29
+ Python3 >= 3.8
30
30
  Cython >= 0.29.24
31
31
  SymEngine >= 0.7.0
32
32
 
@@ -72,7 +72,8 @@ symengine.py is MIT licensed and uses several LGPL, BSD-3 and MIT licensed libra
72
72
  Licenses for the dependencies of pip wheels are as follows,
73
73
 
74
74
  pip wheels on Unix use GMP (LGPL-3.0-or-later), MPFR (LGPL-3.0-or-later),
75
- MPC (LGPL-3.0-or-later), LLVM (Apache-2.0), zlib (Zlib) and symengine (MIT AND BSD-3-Clause).
75
+ MPC (LGPL-3.0-or-later), LLVM (Apache-2.0), zlib (Zlib), libxml2 (MIT),
76
+ zstd (BSD-3-Clause) and symengine (MIT AND BSD-3-Clause).
76
77
  pip wheels on Windows use MPIR (LGPL-3.0-or-later) instead of GMP above and
77
78
  pthreads-win32 (LGPL-3.0-or-later) additionally.
78
79
  NumPy (BSD-3-Clause) and SymPy (BSD-3-Clause) are optional dependencies.
@@ -0,0 +1,144 @@
1
+ version: '{build}'
2
+
3
+ image: "Visual Studio 2019"
4
+
5
+ environment:
6
+ global:
7
+ PLATFORMTOOLSET: "v140"
8
+
9
+ matrix:
10
+ - BUILD_TYPE: "Release"
11
+ COMPILER: MSVC15
12
+ PLATFORM: "x64"
13
+ PYTHON_VERSION: 310-x64
14
+ CONDA_INSTALL_LOCN: C:\\Miniconda36-x64
15
+ WITH_MPFR: yes
16
+ WITH_MPC: yes
17
+ - BUILD_TYPE: "Release"
18
+ COMPILER: MSVC15
19
+ PLATFORM: "x64"
20
+ PYTHON_VERSION: 38-x64
21
+ CONDA_INSTALL_LOCN: C:\\Miniconda36-x64
22
+ - BUILD_TYPE: "Release"
23
+ COMPILER: MSVC15
24
+ PLATFORM: "x64"
25
+ PYTHON_VERSION: 39-x64
26
+ WITH_SYMPY: no
27
+ CONDA_INSTALL_LOCN: C:\\Miniconda36-x64
28
+ - BUILD_TYPE: "Release"
29
+ COMPILER: MSVC15
30
+ PLATFORM: "x64"
31
+ PYTHON_VERSION: 311-x64
32
+ WITH_NUMPY: no
33
+ CONDA_INSTALL_LOCN: C:\\Miniconda36-x64
34
+ #- BUILD_TYPE: "Debug"
35
+ # COMPILER: MinGW-w64
36
+ # PYTHON_VERSION: 39-x64
37
+ # WITH_NUMPY: no
38
+ #- BUILD_TYPE: "Release"
39
+ # COMPILER: MinGW-w64
40
+ # PYTHON_VERSION: 39-x64
41
+ #- BUILD_TYPE: "Debug"
42
+ # COMPILER: MinGW-w64
43
+ # PYTHON_VERSION: 39-x64
44
+ # 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
52
+ - BUILD_TYPE: "Release"
53
+ COMPILER: MSVC15
54
+ PLATFORM: "x64"
55
+ PYTHON_VERSION: 310-x64
56
+ CONDA_INSTALL_LOCN: C:\\Miniconda36-x64
57
+ WITH_MPFR: yes
58
+ WITH_MPC: yes
59
+ WITH_LLVM: yes
60
+
61
+ install:
62
+ - set PYTHON_SOURCE_DIR=%CD%
63
+ - git clone https://github.com/sympy/symengine symengine-cpp
64
+
65
+ - 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
70
+ - if [%COMPILER%]==[MSVC15] echo %CONDA_PREFIX%
71
+ - if [%COMPILER%]==[MSVC15] echo %PATH%
72
+ - if [%COMPILER%]==[MSVC15] set "PATH=%PATH%;%CONDA_PREFIX%\\Library\\bin;%CONDA_PREFIX%"
73
+ - 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
77
+
78
+ - if [%COMPILER%]==[MinGW] set "PATH=C:\MinGW\bin;%PATH%"
79
+ - if [%COMPILER%]==[MinGW] mingw-get update
80
+ # workaround for https://github.com/appveyor/ci/issues/996
81
+ - if [%COMPILER%]==[MinGW] mingw-get upgrade mingw32-libstdc++
82
+ - if [%COMPILER%]==[MinGW] mingw-get install mingw32-gmp
83
+
84
+ - if [%COMPILER%]==[MinGW-w64] set "PATH=C:\mingw64\bin;%PATH%"
85
+
86
+ - rename "C:\Program Files\Git\usr\bin\sh.exe" "sh2.exe"
87
+
88
+ - if [%COMPILER%]==[MinGW-w64] call symengine-cpp\bin\appveyor-download.cmd "https://raw.githubusercontent.com/symengine/dependencies/5cff7d1736877336cf9fb58267111beea4fa152f/x86_64-4.9.1-release-posix-seh-rt_v3-rev1.7z" -FileName mw64.7z
89
+ - if [%COMPILER%]==[MinGW-w64] 7z x -oC:\ mw64.7z > NUL
90
+ - if [%COMPILER%]==[MinGW-w64] call symengine-cpp\bin\appveyor-download.cmd "https://raw.githubusercontent.com/symengine/dependencies/5cff7d1736877336cf9fb58267111beea4fa152f/gmp-6.0.0-x86_64-w64-mingw32.7z" -FileName gmp.7z
91
+ - if [%COMPILER%]==[MinGW-w64] 7z x -oC:\mingw64 gmp.7z > NUL
92
+
93
+ - if NOT [%COMPILER%]==[MSVC15] call symengine-cpp\bin\appveyor-download.cmd "https://raw.githubusercontent.com/symengine/dependencies/dcc10cce2133e2b57e61c5ced6120139bbcdfa20/python-libs-mingw32.7z" -FileName pylibs.7z
94
+ - if NOT [%COMPILER%]==[MSVC15] 7z x -aoa -oC:\ pylibs.7z > NUL
95
+
96
+ - set "PATH=C:\Python%PYTHON_VERSION%;C:\Python%PYTHON_VERSION%\Scripts;%PATH%"
97
+ - echo %PATH%
98
+ - pip install nose pytest cython
99
+ - if NOT [%WITH_NUMPY%]==[no] pip install numpy
100
+ - if NOT [%WITH_SYMPY%]==[no] pip install sympy
101
+
102
+ - set /p commit=<symengine_version.txt
103
+ - cd symengine-cpp
104
+ - git checkout %commit%
105
+ - mkdir build
106
+ - cd build
107
+
108
+ - if [%COMPILER%]==[MSVC15] if [%PLATFORM%]==[Win32] set "CMAKE_GENERATOR=Visual Studio 14 2015"
109
+ - if [%COMPILER%]==[MSVC15] if [%PLATFORM%]==[x64] set "CMAKE_GENERATOR=Visual Studio 14 2015 Win64"
110
+ - if [%COMPILER%]==[MinGW] set "CMAKE_GENERATOR=MinGW Makefiles"
111
+ - if [%COMPILER%]==[MinGW-w64] set "CMAKE_GENERATOR=MinGW Makefiles"
112
+
113
+ - if [%COMPILER%]==[MSVC15] set "CMAKE_ARGS=-DCMAKE_PREFIX_PATH=%CONDA_PREFIX%\\Library"
114
+ - if [%COMPILER%]==[MinGW] set "CMAKE_ARGS=-DCMAKE_PREFIX_PATH=C:\MinGW -DCMAKE_BUILD_TYPE=%BUILD_TYPE%"
115
+ - if [%COMPILER%]==[MinGW-w64] set "CMAKE_ARGS=-DCMAKE_PREFIX_PATH=C:\mingw64 -DCMAKE_BUILD_TYPE=%BUILD_TYPE%"
116
+
117
+ - if [%WITH_MPFR%]==[yes] set "CMAKE_ARGS=%CMAKE_ARGS% -DWITH_MPFR=yes"
118
+ - if [%WITH_MPC%]==[yes] set "CMAKE_ARGS=%CMAKE_ARGS% -DWITH_MPC=yes"
119
+ - if [%WITH_LLVM%]==[yes] set "CMAKE_ARGS=%CMAKE_ARGS% -DWITH_LLVM=yes -DMSVC_USE_MT=no"
120
+
121
+ - echo "CMAKE_ARGS=%CMAKE_ARGS%"
122
+ - cmake %CMAKE_ARGS% -DBUILD_SHARED_LIBS=yes -DBUILD_TESTS=no -DBUILD_BENCHMARKS=no -DCMAKE_INSTALL_PREFIX=C:\symengine ..
123
+
124
+ - cmake --build . --config %BUILD_TYPE% --target install
125
+ - cd ../../
126
+
127
+ build_script:
128
+ - set "PATH=C:\symengine\bin\;%PATH%"
129
+ - set "SYMENGINE_PY_ADD_PATH_TO_SEARCH_DIRS=1"
130
+ - echo %PATH%
131
+ - if [%COMPILER%]==[MSVC15] python setup.py install build_ext --compiler=msvc --build-type=%BUILD_TYPE%
132
+ - if [%COMPILER%]==[MinGW] python setup.py install build_ext --compiler=mingw --inplace
133
+ - if [%COMPILER%]==[MinGW-w64] python setup.py install build_ext --compiler=mingw --inplace
134
+
135
+ test_script:
136
+ - if not [%COMPILER%]==[MSVC15] nosetests
137
+ - mkdir empty && cd empty
138
+ - python %PYTHON_SOURCE_DIR%\bin\test_python.py
139
+
140
+ # Enable this to be able to login to the build worker. You can use the
141
+ # `remmina` program in Ubuntu, use the login information that the line below
142
+ # prints into the log.
143
+ # #on_finish:
144
+ #- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
@@ -0,0 +1 @@
1
+ [y0, y1, y2, y3, y4, y5, y6, l0*m1*y1**2*cos(x1) + l0*m2*y1**2*cos(x1) + l0*m3*y1**2*cos(x1) + l0*m4*y1**2*cos(x1) + l0*m5*y1**2*cos(x1) + l0*m6*y1**2*cos(x1) + l1*m2*y2**2*cos(x2) + l1*m3*y2**2*cos(x2) + l1*m4*y2**2*cos(x2) + l1*m5*y2**2*cos(x2) + l1*m6*y2**2*cos(x2) + l2*m3*y3**2*cos(x3) + l2*m4*y3**2*cos(x3) + l2*m5*y3**2*cos(x3) + l2*m6*y3**2*cos(x3) + l3*m4*y4**2*cos(x4) + l3*m5*y4**2*cos(x4) + l3*m6*y4**2*cos(x4) + l4*m5*y5**2*cos(x5) + l4*m6*y5**2*cos(x5) + l5*m6*y6**2*cos(x6), -g*l0*m1*cos(x1) - g*l0*m2*cos(x1) - g*l0*m3*cos(x1) - g*l0*m4*cos(x1) - g*l0*m5*cos(x1) - g*l0*m6*cos(x1) + l0*l1*m2*y2**2*(-sin(x1)*cos(x2) + sin(x2)*cos(x1)) + l0*l1*m3*y2**2*(-sin(x1)*cos(x2) + sin(x2)*cos(x1)) + l0*l1*m4*y2**2*(-sin(x1)*cos(x2) + sin(x2)*cos(x1)) + l0*l1*m5*y2**2*(-sin(x1)*cos(x2) + sin(x2)*cos(x1)) + l0*l1*m6*y2**2*(-sin(x1)*cos(x2) + sin(x2)*cos(x1)) + l0*l2*m3*y3**2*(-sin(x1)*cos(x3) + sin(x3)*cos(x1)) + l0*l2*m4*y3**2*(-sin(x1)*cos(x3) + sin(x3)*cos(x1)) + l0*l2*m5*y3**2*(-sin(x1)*cos(x3) + sin(x3)*cos(x1)) + l0*l2*m6*y3**2*(-sin(x1)*cos(x3) + sin(x3)*cos(x1)) + l0*l3*m4*y4**2*(-sin(x1)*cos(x4) + sin(x4)*cos(x1)) + l0*l3*m5*y4**2*(-sin(x1)*cos(x4) + sin(x4)*cos(x1)) + l0*l3*m6*y4**2*(-sin(x1)*cos(x4) + sin(x4)*cos(x1)) + l0*l4*m5*y5**2*(-sin(x1)*cos(x5) + sin(x5)*cos(x1)) + l0*l4*m6*y5**2*(-sin(x1)*cos(x5) + sin(x5)*cos(x1)) + l0*l5*m6*y6**2*(-sin(x1)*cos(x6) + sin(x6)*cos(x1)), -g*l1*m2*cos(x2) - g*l1*m3*cos(x2) - g*l1*m4*cos(x2) - g*l1*m5*cos(x2) - g*l1*m6*cos(x2) + l0*l1*m2*y1**2*(sin(x1)*cos(x2) - sin(x2)*cos(x1)) + l0*l1*m3*y1**2*(sin(x1)*cos(x2) - sin(x2)*cos(x1)) + l0*l1*m4*y1**2*(sin(x1)*cos(x2) - sin(x2)*cos(x1)) + l0*l1*m5*y1**2*(sin(x1)*cos(x2) - sin(x2)*cos(x1)) + l0*l1*m6*y1**2*(sin(x1)*cos(x2) - sin(x2)*cos(x1)) + l1*l2*m3*y3**2*(-sin(x2)*cos(x3) + sin(x3)*cos(x2)) + l1*l2*m4*y3**2*(-sin(x2)*cos(x3) + sin(x3)*cos(x2)) + l1*l2*m5*y3**2*(-sin(x2)*cos(x3) + sin(x3)*cos(x2)) + l1*l2*m6*y3**2*(-sin(x2)*cos(x3) + sin(x3)*cos(x2)) + l1*l3*m4*y4**2*(-sin(x2)*cos(x4) + sin(x4)*cos(x2)) + l1*l3*m5*y4**2*(-sin(x2)*cos(x4) + sin(x4)*cos(x2)) + l1*l3*m6*y4**2*(-sin(x2)*cos(x4) + sin(x4)*cos(x2)) + l1*l4*m5*y5**2*(-sin(x2)*cos(x5) + sin(x5)*cos(x2)) + l1*l4*m6*y5**2*(-sin(x2)*cos(x5) + sin(x5)*cos(x2)) + l1*l5*m6*y6**2*(-sin(x2)*cos(x6) + sin(x6)*cos(x2)), -g*l2*m3*cos(x3) - g*l2*m4*cos(x3) - g*l2*m5*cos(x3) - g*l2*m6*cos(x3) + l0*l2*m3*y1**2*(sin(x1)*cos(x3) - sin(x3)*cos(x1)) + l0*l2*m4*y1**2*(sin(x1)*cos(x3) - sin(x3)*cos(x1)) + l0*l2*m5*y1**2*(sin(x1)*cos(x3) - sin(x3)*cos(x1)) + l0*l2*m6*y1**2*(sin(x1)*cos(x3) - sin(x3)*cos(x1)) + l1*l2*m3*y2**2*(sin(x2)*cos(x3) - sin(x3)*cos(x2)) + l1*l2*m4*y2**2*(sin(x2)*cos(x3) - sin(x3)*cos(x2)) + l1*l2*m5*y2**2*(sin(x2)*cos(x3) - sin(x3)*cos(x2)) + l1*l2*m6*y2**2*(sin(x2)*cos(x3) - sin(x3)*cos(x2)) + l2*l3*m4*y4**2*(-sin(x3)*cos(x4) + sin(x4)*cos(x3)) + l2*l3*m5*y4**2*(-sin(x3)*cos(x4) + sin(x4)*cos(x3)) + l2*l3*m6*y4**2*(-sin(x3)*cos(x4) + sin(x4)*cos(x3)) + l2*l4*m5*y5**2*(-sin(x3)*cos(x5) + sin(x5)*cos(x3)) + l2*l4*m6*y5**2*(-sin(x3)*cos(x5) + sin(x5)*cos(x3)) + l2*l5*m6*y6**2*(-sin(x3)*cos(x6) + sin(x6)*cos(x3)), -g*l3*m4*cos(x4) - g*l3*m5*cos(x4) - g*l3*m6*cos(x4) + l0*l3*m4*y1**2*(sin(x1)*cos(x4) - sin(x4)*cos(x1)) + l0*l3*m5*y1**2*(sin(x1)*cos(x4) - sin(x4)*cos(x1)) + l0*l3*m6*y1**2*(sin(x1)*cos(x4) - sin(x4)*cos(x1)) + l1*l3*m4*y2**2*(sin(x2)*cos(x4) - sin(x4)*cos(x2)) + l1*l3*m5*y2**2*(sin(x2)*cos(x4) - sin(x4)*cos(x2)) + l1*l3*m6*y2**2*(sin(x2)*cos(x4) - sin(x4)*cos(x2)) + l2*l3*m4*y3**2*(sin(x3)*cos(x4) - sin(x4)*cos(x3)) + l2*l3*m5*y3**2*(sin(x3)*cos(x4) - sin(x4)*cos(x3)) + l2*l3*m6*y3**2*(sin(x3)*cos(x4) - sin(x4)*cos(x3)) + l3*l4*m5*y5**2*(-sin(x4)*cos(x5) + sin(x5)*cos(x4)) + l3*l4*m6*y5**2*(-sin(x4)*cos(x5) + sin(x5)*cos(x4)) + l3*l5*m6*y6**2*(-sin(x4)*cos(x6) + sin(x6)*cos(x4)), -g*l4*m5*cos(x5) - g*l4*m6*cos(x5) + l0*l4*m5*y1**2*(sin(x1)*cos(x5) - sin(x5)*cos(x1)) + l0*l4*m6*y1**2*(sin(x1)*cos(x5) - sin(x5)*cos(x1)) + l1*l4*m5*y2**2*(sin(x2)*cos(x5) - sin(x5)*cos(x2)) + l1*l4*m6*y2**2*(sin(x2)*cos(x5) - sin(x5)*cos(x2)) + l2*l4*m5*y3**2*(sin(x3)*cos(x5) - sin(x5)*cos(x3)) + l2*l4*m6*y3**2*(sin(x3)*cos(x5) - sin(x5)*cos(x3)) + l3*l4*m5*y4**2*(sin(x4)*cos(x5) - sin(x5)*cos(x4)) + l3*l4*m6*y4**2*(sin(x4)*cos(x5) - sin(x5)*cos(x4)) + l4*l5*m6*y6**2*(-sin(x5)*cos(x6) + sin(x6)*cos(x5)), -g*l5*m6*cos(x6) + l0*l5*m6*y1**2*(sin(x1)*cos(x6) - sin(x6)*cos(x1)) + l1*l5*m6*y2**2*(sin(x2)*cos(x6) - sin(x6)*cos(x2)) + l2*l5*m6*y3**2*(sin(x3)*cos(x6) - sin(x6)*cos(x3)) + l3*l5*m6*y4**2*(sin(x4)*cos(x6) - sin(x6)*cos(x4)) + l4*l5*m6*y5**2*(sin(x5)*cos(x6) - sin(x6)*cos(x5))]
@@ -0,0 +1,103 @@
1
+ #!/usr/bin/env python
2
+ from time import clock
3
+ import numpy as np
4
+ import sympy as sp
5
+ import symengine as se
6
+ import warnings
7
+
8
+ # Real-life example (ion speciation problem in water chemistry)
9
+
10
+ x = sp.symarray('x', 14)
11
+ p = sp.symarray('p', 14)
12
+ args = np.concatenate((x, p))
13
+ exp = sp.exp
14
+ exprs = [x[0] + x[1] - x[4] + 36.252574322669, x[0] - x[2] + x[3] + 21.3219379611249, x[3] + x[5] - x[6] + 9.9011158998744, 2*x[3] + x[5] - x[7] + 18.190422234653, 3*x[3] + x[5] - x[8] + 24.8679190043357, 4*x[3] + x[5] - x[9] + 29.9336062089226, -x[10] + 5*x[3] + x[5] + 28.5520551531262, 2*x[0] + x[11] - 2*x[4] - 2*x[5] + 32.4401680272417, 3*x[1] - x[12] + x[5] + 34.9992934135095, 4*x[1] - x[13] + x[5] + 37.0716199972041, p[0] - p[1] + 2*p[10] + 2*p[11] - p[12] - 2*p[13] + p[2] + 2*p[5] + 2*p[6] + 2*p[7] + 2*p[8] + 2*p[9] - exp(x[0]) + exp(x[1]) - 2*exp(x[10]) - 2*exp(x[11]) + exp(x[12]) + 2*exp(x[13]) - exp(x[2]) - 2*exp(x[5]) - 2*exp(x[6]) - 2*exp(x[7]) - 2*exp(x[8]) - 2*exp(x[9]), -p[0] - p[1] - 15*p[10] - 2*p[11] - 3*p[12] - 4*p[13] - 4*p[2] - 3*p[3] - 2*p[4] - 3*p[6] - 6*p[7] - 9*p[8] - 12*p[9] + exp(x[0]) + exp(x[1]) + 15*exp(x[10]) + 2*exp(x[11]) + 3*exp(x[12]) + 4*exp(x[13]) + 4*exp(x[2]) + 3*exp(x[3]) + 2*exp(x[4]) + 3*exp(x[6]) + 6*exp(x[7]) + 9*exp(x[8]) + 12*exp(x[9]), -5*p[10] - p[2] - p[3] - p[6] - 2*p[7] - 3*p[8] - 4*p[9] + 5*exp(x[10]) + exp(x[2]) + exp(x[3]) + exp(x[6]) + 2*exp(x[7]) + 3*exp(x[8]) + 4*exp(x[9]), -p[1] - 2*p[11] - 3*p[12] - 4*p[13] - p[4] + exp(x[1]) + 2*exp(x[11]) + 3*exp(x[12]) + 4*exp(x[13]) + exp(x[4]), -p[10] - 2*p[11] - p[12] - p[13] - p[5] - p[6] - p[7] - p[8] - p[9] + exp(x[10]) + 2*exp(x[11]) + exp(x[12]) + exp(x[13]) + exp(x[5]) + exp(x[6]) + exp(x[7]) + exp(x[8]) + exp(x[9])]
15
+
16
+ lmb_sp = sp.lambdify(args, exprs, modules='math')
17
+ lmb_se = se.Lambdify(args, exprs)
18
+ lmb_se_cse = se.LambdifyCSE(args, exprs)
19
+ lmb_se_llvm = se.Lambdify(args, exprs, backend='llvm')
20
+
21
+ inp = np.ones(28)
22
+
23
+ lmb_sp(*inp)
24
+ tim_sympy = clock()
25
+ for i in range(500):
26
+ res_sympy = lmb_sp(*inp)
27
+ tim_sympy = clock() - tim_sympy
28
+
29
+ lmb_se(inp)
30
+ tim_se = clock()
31
+ res_se = np.empty(len(exprs))
32
+ for i in range(500):
33
+ res_se = lmb_se(inp)
34
+ tim_se = clock() - tim_se
35
+
36
+ lmb_se_cse(inp)
37
+ tim_se_cse = clock()
38
+ res_se_cse = np.empty(len(exprs))
39
+ for i in range(500):
40
+ res_se_cse = lmb_se_cse(inp)
41
+ tim_se_cse = clock() - tim_se_cse
42
+
43
+ lmb_se_llvm(inp)
44
+ tim_se_llvm = clock()
45
+ res_se_llvm = np.empty(len(exprs))
46
+ for i in range(500):
47
+ res_se_llvm = lmb_se_llvm(inp)
48
+ tim_se_llvm = clock() - tim_se_llvm
49
+
50
+
51
+ print('SymEngine (lambda double) speed-up factor (higher is better) vs sympy: %12.5g' %
52
+ (tim_sympy/tim_se))
53
+
54
+ print('symengine (lambda double + CSE) speed-up factor (higher is better) vs sympy: %12.5g' %
55
+ (tim_sympy/tim_se_cse))
56
+
57
+ print('symengine (LLVM) speed-up factor (higher is better) vs sympy: %12.5g' %
58
+ (tim_sympy/tim_se_llvm))
59
+
60
+ import itertools
61
+ from functools import reduce
62
+ from operator import mul
63
+
64
+ def ManualLLVM(inputs, *outputs):
65
+ outputs_ravel = list(itertools.chain(*outputs))
66
+ cb = se.Lambdify(inputs, outputs_ravel, backend="llvm")
67
+ def func(*args):
68
+ result = []
69
+ n = np.empty(len(outputs_ravel))
70
+ t = cb.unsafe_real(np.concatenate([arg.ravel() for arg in args]), n)
71
+ start = 0
72
+ for output in outputs:
73
+ elems = reduce(mul, output.shape)
74
+ result.append(n[start:start+elems].reshape(output.shape))
75
+ start += elems
76
+ return result
77
+ return func
78
+
79
+ lmb_se_llvm_manual = ManualLLVM(args, np.array(exprs))
80
+ lmb_se_llvm_manual(inp)
81
+ tim_se_llvm_manual = clock()
82
+ res_se_llvm_manual = np.empty(len(exprs))
83
+ for i in range(500):
84
+ res_se_llvm_manual = lmb_se_llvm_manual(inp)
85
+ tim_se_llvm_manual = clock() - tim_se_llvm_manual
86
+ print('symengine (ManualLLVM) speed-up factor (higher is better) vs sympy: %12.5g' %
87
+ (tim_sympy/tim_se_llvm_manual))
88
+
89
+ if tim_se_llvm_manual < tim_se_llvm:
90
+ warnings.warn("Cython code for Lambdify.__call__ is slow.")
91
+
92
+ import setuptools
93
+ import pyximport
94
+ pyximport.install()
95
+ from Lambdify_reference import _benchmark_reference_for_Lambdify as lmb_ref
96
+
97
+ lmb_ref(inp)
98
+ tim_ref = clock()
99
+ for i in range(500):
100
+ res_ref = lmb_ref(inp)
101
+ tim_ref = clock() - tim_ref
102
+ print('Hard-coded Cython code speed-up factor (higher is better) vs sympy: %12.5g' %
103
+ (tim_sympy/tim_ref))
@@ -0,0 +1,10 @@
1
+ # Benchmark reference:
2
+ cimport numpy as cnp
3
+ import numpy as np
4
+ from libc.math cimport exp as exp_
5
+
6
+ def _benchmark_reference_for_Lambdify(cnp.ndarray[cnp.float64_t] x):
7
+ cdef cnp.ndarray[cnp.float64_t] out = np.empty(14)
8
+ cdef double * data = <double *>out.data
9
+ data[:] = [x[0] + x[1] - x[4] + 36.252574322669, x[0] - x[2] + x[3] + 21.3219379611249, x[3] + x[5] - x[6] + 9.9011158998744, 2*x[3] + x[5] - x[7] + 18.190422234653, 3*x[3] + x[5] - x[8] + 24.8679190043357, 4*x[3] + x[5] - x[9] + 29.9336062089226, -x[10] + 5*x[3] + x[5] + 28.5520551531262, 2*x[0] + x[11] - 2*x[4] - 2*x[5] + 32.4401680272417, 3*x[1] - x[12] + x[5] + 34.9992934135095, 4*x[1] - x[13] + x[5] + 37.0716199972041, x[14+0] - x[14+1] + 2*x[14+10] + 2*x[14+11] - x[14+12] - 2*x[14+13] + x[14+2] + 2*x[14+5] + 2*x[14+6] + 2*x[14+7] + 2*x[14+8] + 2*x[14+9] - exp_(x[0]) + exp_(x[1]) - 2*exp_(x[10]) - 2*exp_(x[11]) + exp_(x[12]) + 2*exp_(x[13]) - exp_(x[2]) - 2*exp_(x[5]) - 2*exp_(x[6]) - 2*exp_(x[7]) - 2*exp_(x[8]) - 2*exp_(x[9]), -x[14+0] - x[14+1] - 15*x[14+10] - 2*x[14+11] - 3*x[14+12] - 4*x[14+13] - 4*x[14+2] - 3*x[14+3] - 2*x[14+4] - 3*x[14+6] - 6*x[14+7] - 9*x[14+8] - 12*x[14+9] + exp_(x[0]) + exp_(x[1]) + 15*exp_(x[10]) + 2*exp_(x[11]) + 3*exp_(x[12]) + 4*exp_(x[13]) + 4*exp_(x[2]) + 3*exp_(x[3]) + 2*exp_(x[4]) + 3*exp_(x[6]) + 6*exp_(x[7]) + 9*exp_(x[8]) + 12*exp_(x[9]), -5*x[14+10] - x[14+2] - x[14+3] - x[14+6] - 2*x[14+7] - 3*x[14+8] - 4*x[14+9] + 5*exp_(x[10]) + exp_(x[2]) + exp_(x[3]) + exp_(x[6]) + 2*exp_(x[7]) + 3*exp_(x[8]) + 4*exp_(x[9]), -x[14+1] - 2*x[14+11] - 3*x[14+12] - 4*x[14+13] - x[14+4] + exp_(x[1]) + 2*exp_(x[11]) + 3*exp_(x[12]) + 4*exp_(x[13]) + exp_(x[4]), -x[14+10] - 2*x[14+11] - x[14+12] - x[14+13] - x[14+5] - x[14+6] - x[14+7] - x[14+8] - x[14+9] + exp_(x[10]) + 2*exp_(x[11]) + exp_(x[12]) + exp_(x[13]) + exp_(x[5]) + exp_(x[6]) + exp_(x[7]) + exp_(x[8]) + exp_(x[9])]
10
+ return out
@@ -0,0 +1,10 @@
1
+ import sys
2
+ sys.path.append("..")
3
+ from timeit import default_timer as clock
4
+ from symengine import var
5
+ var("x y z w")
6
+ e = (x+y+z+w)**60
7
+ t1 = clock()
8
+ g = e.expand()
9
+ t2 = clock()
10
+ print("Total time:", t2-t1, "s")