numexpr 2.11.0__tar.gz → 2.12.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.
- numexpr-2.12.0/ADDFUNCS.rst +222 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/ANNOUNCE.rst +11 -15
- numexpr-2.12.0/LICENSES/cpuinfo.txt +31 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/PKG-INFO +3 -2
- {numexpr-2.11.0 → numexpr-2.12.0}/RELEASE_NOTES.rst +15 -1
- numexpr-2.12.0/VERSION +1 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr/expressions.py +6 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr/functions.hpp +28 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr/interp_body.cpp +18 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr/interpreter.cpp +56 -3
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr/interpreter.hpp +12 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr/module.cpp +4 -1
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr/msvc_function_stubs.hpp +27 -3
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr/necompiler.py +6 -3
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr/numexpr_config.hpp +11 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr/opcodes.hpp +39 -26
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr/tests/conftest.py +1 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr/tests/test_numexpr.py +17 -2
- numexpr-2.12.0/numexpr/version.py +5 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr.egg-info/PKG-INFO +3 -2
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr.egg-info/SOURCES.txt +2 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/pyproject.toml +17 -3
- numexpr-2.11.0/VERSION +0 -1
- numexpr-2.11.0/numexpr/version.py +0 -5
- {numexpr-2.11.0 → numexpr-2.12.0}/AUTHORS.txt +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/LICENSE.txt +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/MANIFEST.in +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/README.rst +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/bench/boolean_timing.py +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/bench/free_threading.py +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/bench/issue-36.py +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/bench/issue-47.py +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/bench/large_array_vs_numpy.py +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/bench/multidim.py +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/bench/poly.py +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/bench/timing.py +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/bench/unaligned-simple.py +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/bench/varying-expr.py +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/bench/vml_timing.py +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/bench/vml_timing2.py +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/bench/vml_timing3.py +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr/__init__.py +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr/complex_functions.hpp +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr/cpuinfo.py +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr/missing_posix_functions.hpp +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr/module.hpp +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr/numexpr_object.cpp +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr/numexpr_object.hpp +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr/str-two-way.hpp +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr/tests/__init__.py +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr/utils.py +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr/win32/pthread.c +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr/win32/pthread.h +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr/win32/stdint.h +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr.egg-info/dependency_links.txt +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr.egg-info/requires.txt +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/numexpr.egg-info/top_level.txt +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/requirements.txt +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/setup.cfg +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/setup.py +0 -0
- {numexpr-2.11.0 → numexpr-2.12.0}/site.cfg.example +0 -0
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
Functions and Function signatures
|
|
2
|
+
=================================
|
|
3
|
+
|
|
4
|
+
Adding functions
|
|
5
|
+
----------------
|
|
6
|
+
|
|
7
|
+
In order to add new functions to ``numexpr``, currently it is necessary to edit several files. Consider adding a function
|
|
8
|
+
``out_type myfunc(arg_type)``.
|
|
9
|
+
|
|
10
|
+
* ``numexpr/expressions.py``
|
|
11
|
+
Add ``'myfunc': func(numpy.myfunc, out_dtype),`` to the dict of functions, ``functions = {...``. If the return type of the function is ``bool``, add
|
|
12
|
+
the function to the list ``if opcode in ("isnan", "isfinite"):`` in the ``__init__`` function of the ``FuncNode`` class.
|
|
13
|
+
In the future it might be nice to refactor this function since it sets the output type based on the type of the inputs in general.
|
|
14
|
+
|
|
15
|
+
* ``numexpr/necompiler.py``
|
|
16
|
+
Add ``"myfunc"`` to the list of functions:
|
|
17
|
+
|
|
18
|
+
.. code-block:: python3
|
|
19
|
+
|
|
20
|
+
"floor",
|
|
21
|
+
"isnan",
|
|
22
|
+
"isfinite",
|
|
23
|
+
"myfunc"
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
* ``numexpr/functions.hpp``
|
|
27
|
+
Find the correct function signature ``FUNC_OA`` where ``O`` is the return type, and ``A`` the argument type(s). For example, if the function
|
|
28
|
+
is ``double myfunc(double)``, one should edit within the ``FUNC_DD`` clause. If you cannot find your function signature you will have to add it,
|
|
29
|
+
following the template of the other functions.
|
|
30
|
+
Most likely, you will want to add support for several function signatures (e.g. double -> bool and float -> bool) and so you will have to add the
|
|
31
|
+
function in two clauses. If your function has a float input, you will see that there are 5 arguments in the
|
|
32
|
+
``FUNC_OA`` macro, and you will have to add ``myfunc2`` here is order to compile on MSVC machines (i.e. Windows, see following).
|
|
33
|
+
Example:
|
|
34
|
+
|
|
35
|
+
.. code-block:: cpp
|
|
36
|
+
:emphasize-lines: 6, 20
|
|
37
|
+
|
|
38
|
+
#ifndef FUNC_DD
|
|
39
|
+
#define ELIDE_FUNC_DD
|
|
40
|
+
#define FUNC_DD(...)
|
|
41
|
+
#endif
|
|
42
|
+
...
|
|
43
|
+
FUNC_DD(FUNC_MYFUNC_DD, "myfunc_dd", myfunc, vdMyfunc)
|
|
44
|
+
FUNC_DD(FUNC_DD_LAST, NULL, NULL, NULL)
|
|
45
|
+
#ifdef ELIDE_FUNC_DD
|
|
46
|
+
#undef ELIDE_FUNC_DD
|
|
47
|
+
#undef FUNC_DD
|
|
48
|
+
#endif
|
|
49
|
+
|
|
50
|
+
...
|
|
51
|
+
|
|
52
|
+
#ifndef FUNC_FF
|
|
53
|
+
#define ELIDE_FUNC_FF
|
|
54
|
+
#define FUNC_FF(...)
|
|
55
|
+
#endif
|
|
56
|
+
...
|
|
57
|
+
FUNC_FF(FUNC_MYFUNC_FF, "myfunc_ff", myfuncf, myfuncf2, vfMyfunc)
|
|
58
|
+
FUNC_FF(FUNC_FF_LAST, NULL, NULL, NULL, NULL)
|
|
59
|
+
#ifdef ELIDE_FUNC_FF
|
|
60
|
+
#undef ELIDE_FUNC_FF
|
|
61
|
+
#undef FUNC_FF
|
|
62
|
+
#endif
|
|
63
|
+
|
|
64
|
+
* ``numexpr/msvc_function_stubs.hpp``
|
|
65
|
+
In order to support float arguments, due to oddities of MSVC, you have to provide explicit support for your function in this file.
|
|
66
|
+
Add ``#define myfuncf(x) ((float)floor((double)(x)))`` (if your function is float -> float) to the ``#if`` clause at the top of the file
|
|
67
|
+
which is for old versions of MSVC which did not have support for single precision fucntions. Then in the body, add an inline function
|
|
68
|
+
|
|
69
|
+
.. code-block:: cpp
|
|
70
|
+
|
|
71
|
+
inline float myfuncf2(float x) {
|
|
72
|
+
return myfuncf(x);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
This is the function that appears as the ``f_win32`` parameter in ``functions.hpp``.
|
|
76
|
+
|
|
77
|
+
* ``numexpr/tests/test_numexpr.py``
|
|
78
|
+
Don't forget to add a test for your function!
|
|
79
|
+
|
|
80
|
+
Adding function signatures
|
|
81
|
+
--------------------------
|
|
82
|
+
It may so happen that you cannot find your desired function signature in ``functions.hpp``. This means you will have to add it yourself!
|
|
83
|
+
This involves editing a few more files. In addition, there may be certain bespoke changes, specific to the function signature
|
|
84
|
+
that you may have to make (see Notes, below)
|
|
85
|
+
|
|
86
|
+
* ``numexpr/functions.hpp``
|
|
87
|
+
Firstly, add clause(s) for your function signature. For example, if the function signature is ``bool(double)`` and ``bool(float)``, add
|
|
88
|
+
``FUNC_BD`` and ``FUNC_BF`` clauses (in the latter case you will need the macro to take 5 arguments for MSVC-compatibility.)
|
|
89
|
+
|
|
90
|
+
.. code-block:: cpp
|
|
91
|
+
|
|
92
|
+
#ifndef FUNC_BD
|
|
93
|
+
#define ELIDE_FUNC_BD
|
|
94
|
+
#define FUNC_BD(...)
|
|
95
|
+
#endif
|
|
96
|
+
...
|
|
97
|
+
FUNC_BD(FUNC_BD_LAST, NULL, NULL, NULL)
|
|
98
|
+
#ifdef ELIDE_FUNC_BD
|
|
99
|
+
#undef ELIDE_FUNC_BD
|
|
100
|
+
#undef FUNC_BD
|
|
101
|
+
#endif
|
|
102
|
+
|
|
103
|
+
#ifndef FUNC_BF
|
|
104
|
+
#define ELIDE_FUNC_BF
|
|
105
|
+
#define FUNC_BF(...)
|
|
106
|
+
#endif
|
|
107
|
+
...
|
|
108
|
+
FUNC_BF(FUNC_BF_LAST, NULL, NULL, NULL, NULL)
|
|
109
|
+
#ifdef ELIDE_FUNC_BF
|
|
110
|
+
#undef ELIDE_FUNC_BF
|
|
111
|
+
#undef FUNC_BF
|
|
112
|
+
#endif
|
|
113
|
+
|
|
114
|
+
The ultimate source of the functions in the macro ``FUNC_BF(...)`` are the headers included in ``numexpr/interpreter.cpp`` (in particular
|
|
115
|
+
``numexpr/numexpr_config.hpp``, which can be used to overwrite ``<math.h>`` functions), so the functions should be available from there.
|
|
116
|
+
|
|
117
|
+
* ``numexpr/interp_body.cpp``
|
|
118
|
+
Add case support for OPCODES associated to your new function signatures via e.g. ``case OP_FUNC_BFN`` and ``case OP_FUNC_BDN``, following
|
|
119
|
+
the framework suggested by the other functions:
|
|
120
|
+
|
|
121
|
+
.. code-block:: cpp
|
|
122
|
+
|
|
123
|
+
case OP_FUNC_BFN:
|
|
124
|
+
#ifdef USE_VML
|
|
125
|
+
VEC_ARG1_VML(functions_bf_vml[arg2](BLOCK_SIZE,
|
|
126
|
+
(float*)x1, (bool*)dest));
|
|
127
|
+
#else
|
|
128
|
+
VEC_ARG1(b_dest = functions_bf[arg2](f1));
|
|
129
|
+
#endif
|
|
130
|
+
|
|
131
|
+
Note that it is important that the out variable matches the output type of the function (i.e. ``b_dest`` for bool, ``f_dest`` for float etc.)
|
|
132
|
+
|
|
133
|
+
* ``numexpr/interpreter.hpp``
|
|
134
|
+
Add clauses to read the ``functions.hpp`` macros correctly
|
|
135
|
+
|
|
136
|
+
.. code-block:: cpp
|
|
137
|
+
|
|
138
|
+
enum FuncBFCodes {
|
|
139
|
+
#define FUNC_BF(fop, ...) fop,
|
|
140
|
+
#include "functions.hpp"
|
|
141
|
+
#undef FUNC_BF
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
* ``numexpr/interpreter.cpp``
|
|
145
|
+
Add clauses to generate the FUNC_CODES from the ``functions.hpp`` header, making sure to include clauses for ``_WIN32`` and
|
|
146
|
+
``VML`` as necessary accoridng to the framework suggested by the other functions.
|
|
147
|
+
|
|
148
|
+
.. code-block:: cpp
|
|
149
|
+
|
|
150
|
+
typedef bool (*FuncBFPtr)(float);
|
|
151
|
+
#ifdef _WIN32
|
|
152
|
+
FuncBFPtr functions_bf[] = {
|
|
153
|
+
#define FUNC_BF(fop, s, f, f_win32, ...) f_win32,
|
|
154
|
+
#include "functions.hpp"
|
|
155
|
+
#undef FUNC_BF
|
|
156
|
+
};
|
|
157
|
+
#else
|
|
158
|
+
FuncBFPtr functions_bf[] = {
|
|
159
|
+
#define FUNC_BF(fop, s, f, ...) f,
|
|
160
|
+
#include "functions.hpp"
|
|
161
|
+
#undef FUNC_BF
|
|
162
|
+
};
|
|
163
|
+
#endif
|
|
164
|
+
|
|
165
|
+
#ifdef USE_VML
|
|
166
|
+
typedef void (*FuncBFPtr_vml)(MKL_INT, const float*, bool*);
|
|
167
|
+
FuncBFPtr_vml functions_bf_vml[] = {
|
|
168
|
+
#define FUNC_BF(fop, s, f, f_win32, f_vml) f_vml,
|
|
169
|
+
#include "functions.hpp"
|
|
170
|
+
#undef FUNC_BF
|
|
171
|
+
};
|
|
172
|
+
#endif
|
|
173
|
+
|
|
174
|
+
Add case handling to the ``check_program`` function
|
|
175
|
+
|
|
176
|
+
.. code-block:: cpp
|
|
177
|
+
|
|
178
|
+
else if (op == OP_FUNC_BDN) {
|
|
179
|
+
if (arg < 0 || arg >= FUNC_BD_LAST) {
|
|
180
|
+
PyErr_Format(PyExc_RuntimeError, "invalid program: funccode out of range (%i) at %i", arg, argloc);
|
|
181
|
+
return -1;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
else if (op == OP_FUNC_BFN) {
|
|
185
|
+
if (arg < 0 || arg >= FUNC_BF_LAST) {
|
|
186
|
+
PyErr_Format(PyExc_RuntimeError, "invalid program: funccode out of range (%i) at %i", arg, argloc);
|
|
187
|
+
return -1;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
* ``numexpr/module.cpp``
|
|
192
|
+
Add code here to define the ``FUNC_OA`` macros you require
|
|
193
|
+
|
|
194
|
+
.. code-block:: cpp
|
|
195
|
+
|
|
196
|
+
#define FUNC_BF(name, sname, ...) add_func(name, sname);
|
|
197
|
+
#define FUNC_BD(name, sname, ...) add_func(name, sname);
|
|
198
|
+
...
|
|
199
|
+
#include "functions.hpp"
|
|
200
|
+
...
|
|
201
|
+
#undef FUNC_BD
|
|
202
|
+
#undef FUNC_BF
|
|
203
|
+
|
|
204
|
+
* ``numexpr/opcodes.hpp``
|
|
205
|
+
Finally, add the ``OP_FUNC_BDN`` etc. codes here. It is necessary for the OPCODES in the file to be in (ascending order) with
|
|
206
|
+
``NOOP`` as 0 and ``OP_LAST`` as the largest number. Secondly, all reduction OPCODES must appear last. Hence, after adding your
|
|
207
|
+
function signatures (just before the reduction OPCODES) it is necessary to increment all succeeding OPCODES.
|
|
208
|
+
|
|
209
|
+
.. code-block:: cpp
|
|
210
|
+
|
|
211
|
+
OPCODE(106, OP_FUNC_BDN, "func_bdn", Tb, Td, Tn, T0)
|
|
212
|
+
OPCODE(107, OP_FUNC_BFN, "func_bfn", Tb, Tf, Tn, T0)
|
|
213
|
+
|
|
214
|
+
Notes
|
|
215
|
+
-----
|
|
216
|
+
In many cases this process will not be very smooth since one relies on the internal C/C++ standard functions (which can be fussy, to varying degrees on different platforms). Some common gotchas are then:
|
|
217
|
+
|
|
218
|
+
* OPCODES are currently only supported up to 255 - if it becomes necessary to increment further, one will have to change the ``latin_1`` encoding used in ``quadrupleToString`` in ``necompiler.py``. In addition, since the OPCDE table is assumed to be of type ``unsigned char`` the ``get_return_sig`` function in ``numexpr/interpreter.cpp`` may have to be changed (possibly other changes too).
|
|
219
|
+
|
|
220
|
+
* Depending on the new function signature (above all if the out type is different to the input types), one may have to edit the ``__init__`` function in the ``FuncNode`` class in ``expressions.py``.
|
|
221
|
+
|
|
222
|
+
* Depending on MSVC support, namespace clashes, casting problems, it may be necessary to make various changes to ``numexpr/numexpr_config.hpp`` and ``numexpr/msvc_function_stubs.hpp``. For example, in PR #523, non-clashing wrappers were introduced for ``isnan`` and ``isfinite`` since the float versions ``isnanf, isfinitef`` were inconsistently defined (and output ints) - depending on how strict the platform interpreter is, the implicit cast from int to bool was acceptable or not for example. In addition, the base functions were in different namespaces or had different names across platforms.
|
|
@@ -1,33 +1,29 @@
|
|
|
1
1
|
=========================
|
|
2
|
-
Announcing NumExpr 2.
|
|
2
|
+
Announcing NumExpr 2.12.0
|
|
3
3
|
=========================
|
|
4
4
|
|
|
5
5
|
Hi everyone,
|
|
6
6
|
|
|
7
|
-
NumExpr 2.
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
NumExpr 2.12.0 comes with new isnan/isfinite/isinf functions.
|
|
8
|
+
Most importantly, we have added instructions for adding new functions
|
|
9
|
+
to the virtual machine. See ADDFUNCS.rst for more details. Thanks to
|
|
10
|
+
Luke Shaw for these contributions.
|
|
10
11
|
|
|
11
12
|
Project documentation is available at:
|
|
12
13
|
|
|
13
14
|
http://numexpr.readthedocs.io/
|
|
14
15
|
|
|
15
|
-
Changes from 2.
|
|
16
|
+
Changes from 2.11.0 to 2.12.0
|
|
16
17
|
-----------------------------
|
|
17
18
|
|
|
18
|
-
*
|
|
19
|
-
This is still experimental, so please report any issues you find.
|
|
20
|
-
For more info, see discussions PRs #504, #505 and #508.
|
|
21
|
-
Thanks to @andfoy, @rgommers and @FrancescAlted for the work.
|
|
19
|
+
* Added isnan/isfinite/isinf functions. Thanks to Luke Shaw.
|
|
22
20
|
|
|
23
|
-
*
|
|
24
|
-
|
|
25
|
-
for the fix.
|
|
21
|
+
* New instructions for adding new functions to the virtual machine.
|
|
22
|
+
They are available at ADDFUNCS.rst. Thanks to Luke Shaw.
|
|
26
23
|
|
|
27
|
-
*
|
|
28
|
-
This should make it easier to run the tests and contribute to the project.
|
|
24
|
+
* We are distributing binary wheels for Python 3.14 and 3.14t now.
|
|
29
25
|
|
|
30
|
-
*
|
|
26
|
+
* We are distributing musllinux wheels too! Thanks to Clément Robert.
|
|
31
27
|
|
|
32
28
|
What's Numexpr?
|
|
33
29
|
---------------
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Copyright statement for `cpuinfo` module.
|
|
2
|
+
|
|
3
|
+
Copyright 2002 Pearu Peterson all rights reserved,
|
|
4
|
+
Pearu Peterson <pearu@cens.ioc.ee>
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
* Redistributions of source code must retain the above copyright
|
|
10
|
+
notice, this list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
* Redistributions in binary form must reproduce the above
|
|
13
|
+
copyright notice, this list of conditions and the following
|
|
14
|
+
disclaimer in the documentation and/or other materials provided
|
|
15
|
+
with the distribution.
|
|
16
|
+
|
|
17
|
+
* Neither the name of Pearu Peterson nor the names of its
|
|
18
|
+
contributors may be used to endorse or promote products derived
|
|
19
|
+
from this software without specific prior written permission.
|
|
20
|
+
|
|
21
|
+
HIS SOFTWARE IS PROVIDED BY PEARU PETERSON ''AS IS'' AND ANY EXPRESS
|
|
22
|
+
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
23
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
24
|
+
DISCLAIMED. IN NO EVENT SHALL PEARU PETERSON BE LIABLE FOR ANY DIRECT,
|
|
25
|
+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
26
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
27
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
28
|
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
29
|
+
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
|
30
|
+
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
31
|
+
POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: numexpr
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.12.0
|
|
4
4
|
Summary: Fast numerical expression evaluator for NumPy
|
|
5
5
|
Author-email: "David M. Cooke, Francesc Alted, and others" <blosc@blosc.org>
|
|
6
6
|
Maintainer-email: Blosc Development Team <blosc@blosc.org>
|
|
@@ -21,10 +21,11 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.11
|
|
22
22
|
Classifier: Programming Language :: Python :: 3.12
|
|
23
23
|
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
24
25
|
Requires-Python: >=3.10
|
|
25
26
|
Description-Content-Type: text/x-rst
|
|
26
27
|
License-File: LICENSE.txt
|
|
27
|
-
License-File:
|
|
28
|
+
License-File: LICENSES/cpuinfo.txt
|
|
28
29
|
Requires-Dist: numpy>=1.23.0
|
|
29
30
|
Dynamic: license-file
|
|
30
31
|
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
=====================================
|
|
2
|
-
Release notes for NumExpr 2.
|
|
2
|
+
Release notes for NumExpr 2.12 series
|
|
3
3
|
=====================================
|
|
4
4
|
|
|
5
|
+
Changes from 2.11.0 to 2.12.0
|
|
6
|
+
-----------------------------
|
|
7
|
+
|
|
8
|
+
* Added isnan/isfinite/isinf functions. Thanks to Luke Shaw.
|
|
9
|
+
|
|
10
|
+
* New instructions for adding new functions to the virtual machine.
|
|
11
|
+
They are available at ADDFUNCS.rst. Thanks to Luke Shaw.
|
|
12
|
+
|
|
13
|
+
* We are distributing binary wheels for Python 3.14 and 3.14t now.
|
|
14
|
+
|
|
15
|
+
* We are distributing musllinux wheels too! Thanks to Clément Robert.
|
|
16
|
+
|
|
17
|
+
|
|
5
18
|
Changes from 2.10.2 to 2.11.0
|
|
6
19
|
-----------------------------
|
|
7
20
|
|
|
@@ -19,6 +32,7 @@ Changes from 2.10.2 to 2.11.0
|
|
|
19
32
|
|
|
20
33
|
* Python 3.10 is now the minimum supported version.
|
|
21
34
|
|
|
35
|
+
|
|
22
36
|
Changes from 2.10.1 to 2.10.2
|
|
23
37
|
-----------------------------
|
|
24
38
|
|
numexpr-2.12.0/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.12.0
|
|
@@ -366,6 +366,10 @@ functions = {
|
|
|
366
366
|
'complex': func(complex, 'complex'),
|
|
367
367
|
'conj': func(numpy.conj, 'complex'),
|
|
368
368
|
|
|
369
|
+
'isnan': func(numpy.isnan, 'bool'),
|
|
370
|
+
'isfinite': func(numpy.isfinite, 'bool'),
|
|
371
|
+
'isinf': func(numpy.isinf, 'bool'),
|
|
372
|
+
|
|
369
373
|
'sum': gen_reduce_axis_func('sum'),
|
|
370
374
|
'prod': gen_reduce_axis_func('prod'),
|
|
371
375
|
'min': gen_reduce_axis_func('min'),
|
|
@@ -521,4 +525,6 @@ class FuncNode(OpNode):
|
|
|
521
525
|
def __init__(self, opcode=None, args=None, kind=None):
|
|
522
526
|
if (kind is None) and (args is not None):
|
|
523
527
|
kind = commonKind(args)
|
|
528
|
+
if opcode in ("isnan", "isfinite", "isinf"): # bodge for boolean return functions
|
|
529
|
+
kind = 'bool'
|
|
524
530
|
OpNode.__init__(self, opcode, args, kind)
|
|
@@ -86,6 +86,34 @@ FUNC_DD(FUNC_DD_LAST, NULL, NULL, NULL)
|
|
|
86
86
|
#undef FUNC_DD
|
|
87
87
|
#endif
|
|
88
88
|
|
|
89
|
+
// double -> boolean functions
|
|
90
|
+
#ifndef FUNC_BD
|
|
91
|
+
#define ELIDE_FUNC_BD
|
|
92
|
+
#define FUNC_BD(...)
|
|
93
|
+
#endif
|
|
94
|
+
FUNC_BD(FUNC_ISNAN_BD, "isnan_bd", isnand, vdIsnan)
|
|
95
|
+
FUNC_BD(FUNC_ISFINITE_BD, "isfinite_bd", isfinited, vdIsfinite)
|
|
96
|
+
FUNC_BD(FUNC_ISINF_BD, "isinf_bd", isinfd, vdIsinf)
|
|
97
|
+
FUNC_BD(FUNC_BD_LAST, NULL, NULL, NULL)
|
|
98
|
+
#ifdef ELIDE_FUNC_BD
|
|
99
|
+
#undef ELIDE_FUNC_BD
|
|
100
|
+
#undef FUNC_BD
|
|
101
|
+
#endif
|
|
102
|
+
|
|
103
|
+
// float -> boolean functions (C99 defines the same function for all types)
|
|
104
|
+
#ifndef FUNC_BF
|
|
105
|
+
#define ELIDE_FUNC_BF
|
|
106
|
+
#define FUNC_BF(...)
|
|
107
|
+
#endif // use wrappers as there is name collision with isnanf in std
|
|
108
|
+
FUNC_BF(FUNC_ISNAN_BF, "isnan_bf", isnanf_, isnanf2, vfIsnan)
|
|
109
|
+
FUNC_BF(FUNC_ISFINITE_BF, "isfinite_bf", isfinitef_, isfinitef2, vfIsfinite)
|
|
110
|
+
FUNC_BF(FUNC_ISINF_BF, "isinf_bf", isinff_, isinff2, vfIsinf)
|
|
111
|
+
FUNC_BF(FUNC_BF_LAST, NULL, NULL, NULL, NULL)
|
|
112
|
+
#ifdef ELIDE_FUNC_BF
|
|
113
|
+
#undef ELIDE_FUNC_BF
|
|
114
|
+
#undef FUNC_BF
|
|
115
|
+
#endif
|
|
116
|
+
|
|
89
117
|
#ifndef FUNC_DDD
|
|
90
118
|
#define ELIDE_FUNC_DDD
|
|
91
119
|
#define FUNC_DDD(...)
|
|
@@ -451,6 +451,24 @@
|
|
|
451
451
|
case OP_COMPLEX_CDD: VEC_ARG2(cr_dest = d1;
|
|
452
452
|
ci_dest = d2);
|
|
453
453
|
|
|
454
|
+
// Boolean return types
|
|
455
|
+
case OP_FUNC_BFN:
|
|
456
|
+
#ifdef USE_VML
|
|
457
|
+
VEC_ARG1_VML(functions_bf_vml[arg2](BLOCK_SIZE,
|
|
458
|
+
(float*)x1, (bool*)dest));
|
|
459
|
+
#else
|
|
460
|
+
VEC_ARG1(b_dest = functions_bf[arg2](f1));
|
|
461
|
+
#endif
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
case OP_FUNC_BDN:
|
|
465
|
+
#ifdef USE_VML
|
|
466
|
+
VEC_ARG1_VML(functions_bd_vml[arg2](BLOCK_SIZE,
|
|
467
|
+
(double*)x1, (bool*)dest));
|
|
468
|
+
#else
|
|
469
|
+
VEC_ARG1(b_dest = functions_bd[arg2](d1));
|
|
470
|
+
#endif
|
|
471
|
+
|
|
454
472
|
/* Reductions */
|
|
455
473
|
case OP_SUM_IIN: VEC_ARG1(i_reduce += i1);
|
|
456
474
|
case OP_SUM_LLN: VEC_ARG1(l_reduce += l1);
|
|
@@ -204,6 +204,47 @@ FuncDDPtr functions_dd[] = {
|
|
|
204
204
|
#undef FUNC_DD
|
|
205
205
|
};
|
|
206
206
|
|
|
207
|
+
// Boolean output functions
|
|
208
|
+
typedef bool (*FuncBFPtr)(float);
|
|
209
|
+
#ifdef _WIN32
|
|
210
|
+
FuncBFPtr functions_bf[] = {
|
|
211
|
+
#define FUNC_BF(fop, s, f, f_win32, ...) f_win32,
|
|
212
|
+
#include "functions.hpp"
|
|
213
|
+
#undef FUNC_BF
|
|
214
|
+
};
|
|
215
|
+
#else
|
|
216
|
+
FuncBFPtr functions_bf[] = {
|
|
217
|
+
#define FUNC_BF(fop, s, f, ...) f,
|
|
218
|
+
#include "functions.hpp"
|
|
219
|
+
#undef FUNC_BF
|
|
220
|
+
};
|
|
221
|
+
#endif
|
|
222
|
+
|
|
223
|
+
#ifdef USE_VML
|
|
224
|
+
typedef void (*FuncBFPtr_vml)(MKL_INT, const float*, bool*);
|
|
225
|
+
FuncBFPtr_vml functions_bf_vml[] = {
|
|
226
|
+
#define FUNC_BF(fop, s, f, f_win32, f_vml) f_vml,
|
|
227
|
+
#include "functions.hpp"
|
|
228
|
+
#undef FUNC_BF
|
|
229
|
+
};
|
|
230
|
+
#endif
|
|
231
|
+
|
|
232
|
+
typedef bool (*FuncBDPtr)(double);
|
|
233
|
+
FuncBDPtr functions_bd[] = {
|
|
234
|
+
#define FUNC_BD(fop, s, f, ...) f,
|
|
235
|
+
#include "functions.hpp"
|
|
236
|
+
#undef FUNC_BD
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
#ifdef USE_VML
|
|
240
|
+
typedef void (*FuncBDPtr_vml)(MKL_INT, const double*, bool*);
|
|
241
|
+
FuncBDPtr_vml functions_bd_vml[] = {
|
|
242
|
+
#define FUNC_BD(fop, s, f, f_vml) f_vml,
|
|
243
|
+
#include "functions.hpp"
|
|
244
|
+
#undef FUNC_BD
|
|
245
|
+
};
|
|
246
|
+
#endif
|
|
247
|
+
|
|
207
248
|
#ifdef USE_VML
|
|
208
249
|
/* Fake vdConj function just for casting purposes inside numexpr */
|
|
209
250
|
static void vdConj(MKL_INT n, const double* x1, double* dest)
|
|
@@ -312,11 +353,11 @@ FuncCCCPtr functions_ccc[] = {
|
|
|
312
353
|
|
|
313
354
|
char
|
|
314
355
|
get_return_sig(PyObject* program)
|
|
315
|
-
{
|
|
356
|
+
{ // use unsigned chars to match OPCODE table and allow OPCODE > 127
|
|
316
357
|
int sig;
|
|
317
|
-
char last_opcode;
|
|
358
|
+
unsigned char last_opcode;
|
|
318
359
|
Py_ssize_t end = PyBytes_Size(program);
|
|
319
|
-
char *program_str = PyBytes_AS_STRING(program);
|
|
360
|
+
unsigned char *program_str = (unsigned char *)PyBytes_AS_STRING(program);
|
|
320
361
|
|
|
321
362
|
do {
|
|
322
363
|
end -= 4;
|
|
@@ -464,6 +505,18 @@ check_program(NumExprObject *self)
|
|
|
464
505
|
PyErr_Format(PyExc_RuntimeError, "invalid program: funccode out of range (%i) at %i", arg, argloc);
|
|
465
506
|
return -1;
|
|
466
507
|
}
|
|
508
|
+
}
|
|
509
|
+
else if (op == OP_FUNC_BDN) {
|
|
510
|
+
if (arg < 0 || arg >= FUNC_BD_LAST) {
|
|
511
|
+
PyErr_Format(PyExc_RuntimeError, "invalid program: funccode out of range (%i) at %i", arg, argloc);
|
|
512
|
+
return -1;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
else if (op == OP_FUNC_BFN) {
|
|
516
|
+
if (arg < 0 || arg >= FUNC_BF_LAST) {
|
|
517
|
+
PyErr_Format(PyExc_RuntimeError, "invalid program: funccode out of range (%i) at %i", arg, argloc);
|
|
518
|
+
return -1;
|
|
519
|
+
}
|
|
467
520
|
} else if (op >= OP_REDUCTION) {
|
|
468
521
|
;
|
|
469
522
|
} else {
|
|
@@ -18,6 +18,12 @@ enum FuncFFCodes {
|
|
|
18
18
|
#undef FUNC_FF
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
+
enum FuncBFCodes {
|
|
22
|
+
#define FUNC_BF(fop, ...) fop,
|
|
23
|
+
#include "functions.hpp"
|
|
24
|
+
#undef FUNC_BF
|
|
25
|
+
};
|
|
26
|
+
|
|
21
27
|
enum FuncFFFCodes {
|
|
22
28
|
#define FUNC_FFF(fop, ...) fop,
|
|
23
29
|
#include "functions.hpp"
|
|
@@ -30,6 +36,12 @@ enum FuncDDCodes {
|
|
|
30
36
|
#undef FUNC_DD
|
|
31
37
|
};
|
|
32
38
|
|
|
39
|
+
enum FuncBDCodes {
|
|
40
|
+
#define FUNC_BD(fop, ...) fop,
|
|
41
|
+
#include "functions.hpp"
|
|
42
|
+
#undef FUNC_BD
|
|
43
|
+
};
|
|
44
|
+
|
|
33
45
|
enum FuncDDDCodes {
|
|
34
46
|
#define FUNC_DDD(fop, ...) fop,
|
|
35
47
|
#include "functions.hpp"
|
|
@@ -506,6 +506,8 @@ PyInit_interpreter(void) {
|
|
|
506
506
|
#define FUNC_FF(name, sname, ...) add_func(name, sname);
|
|
507
507
|
#define FUNC_FFF(name, sname, ...) add_func(name, sname);
|
|
508
508
|
#define FUNC_DD(name, sname, ...) add_func(name, sname);
|
|
509
|
+
#define FUNC_BF(name, sname, ...) add_func(name, sname);
|
|
510
|
+
#define FUNC_BD(name, sname, ...) add_func(name, sname);
|
|
509
511
|
#define FUNC_DDD(name, sname, ...) add_func(name, sname);
|
|
510
512
|
#define FUNC_CC(name, sname, ...) add_func(name, sname);
|
|
511
513
|
#define FUNC_CCC(name, sname, ...) add_func(name, sname);
|
|
@@ -513,7 +515,8 @@ PyInit_interpreter(void) {
|
|
|
513
515
|
#undef FUNC_CCC
|
|
514
516
|
#undef FUNC_CC
|
|
515
517
|
#undef FUNC_DDD
|
|
516
|
-
#undef
|
|
518
|
+
#undef FUNC_BD
|
|
519
|
+
#undef FUNC_BF
|
|
517
520
|
#undef FUNC_DD
|
|
518
521
|
#undef FUNC_FFF
|
|
519
522
|
#undef FUNC_FF
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
#include <float.h> // for _finite, _isnan on MSVC
|
|
2
|
+
|
|
1
3
|
#ifndef NUMEXPR_MSVC_FUNCTION_STUBS_HPP
|
|
2
4
|
#define NUMEXPR_MSVC_FUNCTION_STUBS_HPP
|
|
3
5
|
|
|
@@ -43,9 +45,17 @@
|
|
|
43
45
|
/* The next are directly called from interp_body.cpp */
|
|
44
46
|
#define powf(x, y) ((float)pow((double)(x), (double)(y)))
|
|
45
47
|
#define floorf(x) ((float)floor((double)(x)))
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
#endif // _MSC_VER < 1400
|
|
49
|
+
|
|
50
|
+
/* Due to casting problems (normally return ints not bools, easiest to define
|
|
51
|
+
non-overloaded wrappers for these functions) */
|
|
52
|
+
// MSVC version: use global ::isfinite / ::isnan
|
|
53
|
+
inline bool isfinitef_(float x) { return !!::_finite(x); } // MSVC has _finite
|
|
54
|
+
inline bool isnanf_(float x) { return !!::_isnan(x); } // MSVC has _isnan
|
|
55
|
+
inline bool isfinited(double x) { return !!::_finite(x); }
|
|
56
|
+
inline bool isnand(double x) { return !!::_isnan(x); }
|
|
57
|
+
inline bool isinfd(double x) { return !!::isinf(x); }
|
|
58
|
+
inline bool isinff_(float x) { return !!::isinf(x); }
|
|
49
59
|
|
|
50
60
|
/* Now the actual stubs */
|
|
51
61
|
|
|
@@ -133,6 +143,20 @@ inline float atan2f2(float x, float y) {
|
|
|
133
143
|
return atan2f(x, y);
|
|
134
144
|
}
|
|
135
145
|
|
|
146
|
+
// Boolean output functions
|
|
147
|
+
inline bool isnanf2(float x) {
|
|
148
|
+
return isnanf_(x);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
inline bool isfinitef2(float x) {
|
|
152
|
+
return isfinitef_(x);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
inline bool isinff2(float x) {
|
|
156
|
+
return isinff_(x);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
|
|
136
160
|
// Needed for allowing the internal casting in numexpr machinery for
|
|
137
161
|
// conjugate operations
|
|
138
162
|
inline float fconjf2(float x) {
|
|
@@ -69,7 +69,10 @@ vml_functions = [
|
|
|
69
69
|
"arctan2",
|
|
70
70
|
"fmod",
|
|
71
71
|
"ceil",
|
|
72
|
-
"floor"
|
|
72
|
+
"floor",
|
|
73
|
+
"isnan",
|
|
74
|
+
"isfinite",
|
|
75
|
+
"isinf",
|
|
73
76
|
]
|
|
74
77
|
|
|
75
78
|
|
|
@@ -520,7 +523,7 @@ def compileThreeAddrForm(program):
|
|
|
520
523
|
return bytes([reg.n])
|
|
521
524
|
|
|
522
525
|
def quadrupleToString(opcode, store, a1=None, a2=None):
|
|
523
|
-
cop = chr(interpreter.opcodes[opcode]).encode('
|
|
526
|
+
cop = chr(interpreter.opcodes[opcode]).encode('latin_1')
|
|
524
527
|
cs = nToChr(store)
|
|
525
528
|
ca1 = nToChr(a1)
|
|
526
529
|
ca2 = nToChr(a2)
|
|
@@ -904,7 +907,7 @@ def evaluate(ex: str,
|
|
|
904
907
|
global_dict: Optional[Dict] = None,
|
|
905
908
|
out: numpy.ndarray = None,
|
|
906
909
|
order: str = 'K',
|
|
907
|
-
casting: str = '
|
|
910
|
+
casting: str = 'same_kind',
|
|
908
911
|
sanitize: Optional[bool] = None,
|
|
909
912
|
_frame_depth: int = 3,
|
|
910
913
|
**kwargs) -> numpy.ndarray:
|
|
@@ -46,6 +46,17 @@
|
|
|
46
46
|
#include "missing_posix_functions.hpp"
|
|
47
47
|
#endif
|
|
48
48
|
#include "msvc_function_stubs.hpp"
|
|
49
|
+
#else
|
|
50
|
+
/* GCC/Clang version: use std:: (can't use it for windows)
|
|
51
|
+
msvc_function_stubs contains windows alternatives
|
|
52
|
+
/* Due to casting problems (normally return ints not bools, easiest to define
|
|
53
|
+
non-overloaded wrappers for these functions) */
|
|
54
|
+
inline bool isfinitef_(float x) { return !!::isfinite(x); }
|
|
55
|
+
inline bool isnanf_(float x) { return !!::isnan(x); }
|
|
56
|
+
inline bool isfinited(double x) { return !!::isfinite(x); }
|
|
57
|
+
inline bool isnand(double x) { return !!::isnan(x); }
|
|
58
|
+
inline bool isinff_(float x) { return !!::isinf(x); }
|
|
59
|
+
inline bool isinfd(double x) { return !!::isinf(x); }
|
|
49
60
|
#endif
|
|
50
61
|
|
|
51
62
|
#endif // NUMEXPR_CONFIG_HPP
|
|
@@ -15,6 +15,9 @@ OPCODE(n, enum_name, exported, return_type, arg1_type, arg2_type, arg3_type)
|
|
|
15
15
|
Types are Tb, Ti, Tl, Tf, Td, Tc, Ts, Tn, and T0; these symbols should be
|
|
16
16
|
#defined to whatever is needed. (T0 is the no-such-arg type.)
|
|
17
17
|
|
|
18
|
+
When adding new OPCODES, one has to respect the order of the numeration, as
|
|
19
|
+
there are parts of the code (iterations) which assume that the OPCODES are ordered.
|
|
20
|
+
|
|
18
21
|
*/
|
|
19
22
|
OPCODE(0, OP_NOOP, "noop", T0, T0, T0, T0)
|
|
20
23
|
|
|
@@ -144,36 +147,46 @@ OPCODE(103, OP_COPY_SS, "copy_ss", Ts, Ts, T0, T0)
|
|
|
144
147
|
OPCODE(104, OP_WHERE_BBBB, "where_bbbb", Tb, Tb, Tb, Tb)
|
|
145
148
|
|
|
146
149
|
OPCODE(105, OP_CONTAINS_BSS, "contains_bss", Tb, Ts, Ts, T0)
|
|
150
|
+
//Boolean outputs
|
|
151
|
+
OPCODE(106, OP_FUNC_BDN, "func_bdn", Tb, Td, Tn, T0)
|
|
152
|
+
OPCODE(107, OP_FUNC_BFN, "func_bfn", Tb, Tf, Tn, T0)
|
|
147
153
|
|
|
148
|
-
|
|
154
|
+
// Reductions always have to be at the end - parts of the code
|
|
155
|
+
// use > OP_REDUCTION to decide whether operation is a reduction
|
|
156
|
+
OPCODE(108, OP_REDUCTION, NULL, T0, T0, T0, T0)
|
|
149
157
|
|
|
150
158
|
/* Last argument in a reduction is the axis of the array the
|
|
151
159
|
reduction should be applied along. */
|
|
152
160
|
|
|
153
|
-
OPCODE(
|
|
154
|
-
OPCODE(
|
|
155
|
-
OPCODE(
|
|
156
|
-
OPCODE(
|
|
157
|
-
OPCODE(
|
|
158
|
-
|
|
159
|
-
OPCODE(
|
|
160
|
-
OPCODE(
|
|
161
|
-
OPCODE(
|
|
162
|
-
OPCODE(
|
|
163
|
-
OPCODE(
|
|
164
|
-
OPCODE(
|
|
165
|
-
|
|
166
|
-
OPCODE(
|
|
167
|
-
OPCODE(
|
|
168
|
-
OPCODE(
|
|
169
|
-
OPCODE(
|
|
170
|
-
OPCODE(
|
|
171
|
-
|
|
172
|
-
OPCODE(
|
|
173
|
-
OPCODE(
|
|
174
|
-
OPCODE(
|
|
175
|
-
OPCODE(
|
|
176
|
-
OPCODE(
|
|
161
|
+
OPCODE(109, OP_SUM_IIN, "sum_iin", Ti, Ti, Tn, T0)
|
|
162
|
+
OPCODE(110, OP_SUM_LLN, "sum_lln", Tl, Tl, Tn, T0)
|
|
163
|
+
OPCODE(111, OP_SUM_FFN, "sum_ffn", Tf, Tf, Tn, T0)
|
|
164
|
+
OPCODE(112, OP_SUM_DDN, "sum_ddn", Td, Td, Tn, T0)
|
|
165
|
+
OPCODE(113, OP_SUM_CCN, "sum_ccn", Tc, Tc, Tn, T0)
|
|
166
|
+
|
|
167
|
+
OPCODE(114, OP_PROD, NULL, T0, T0, T0, T0)
|
|
168
|
+
OPCODE(115, OP_PROD_IIN, "prod_iin", Ti, Ti, Tn, T0)
|
|
169
|
+
OPCODE(116, OP_PROD_LLN, "prod_lln", Tl, Tl, Tn, T0)
|
|
170
|
+
OPCODE(117, OP_PROD_FFN, "prod_ffn", Tf, Tf, Tn, T0)
|
|
171
|
+
OPCODE(118, OP_PROD_DDN, "prod_ddn", Td, Td, Tn, T0)
|
|
172
|
+
OPCODE(119, OP_PROD_CCN, "prod_ccn", Tc, Tc, Tn, T0)
|
|
173
|
+
|
|
174
|
+
OPCODE(120, OP_MIN, NULL, T0, T0, T0, T0)
|
|
175
|
+
OPCODE(121, OP_MIN_IIN, "min_iin", Ti, Ti, Tn, T0)
|
|
176
|
+
OPCODE(122, OP_MIN_LLN, "min_lln", Tl, Tl, Tn, T0)
|
|
177
|
+
OPCODE(123, OP_MIN_FFN, "min_ffn", Tf, Tf, Tn, T0)
|
|
178
|
+
OPCODE(124, OP_MIN_DDN, "min_ddn", Td, Td, Tn, T0)
|
|
179
|
+
|
|
180
|
+
OPCODE(125, OP_MAX, NULL, T0, T0, T0, T0)
|
|
181
|
+
OPCODE(126, OP_MAX_IIN, "max_iin", Ti, Ti, Tn, T0)
|
|
182
|
+
OPCODE(127, OP_MAX_LLN, "max_lln", Tl, Tl, Tn, T0)
|
|
183
|
+
OPCODE(128, OP_MAX_FFN, "max_ffn", Tf, Tf, Tn, T0)
|
|
184
|
+
OPCODE(129, OP_MAX_DDN, "max_ddn", Td, Td, Tn, T0)
|
|
177
185
|
|
|
186
|
+
/*
|
|
187
|
+
When we get to 255, will maybe have to change code again
|
|
188
|
+
(change latin_1 encoding in necompiler.py, use something
|
|
189
|
+
other than unsigned char for OPCODE table)
|
|
190
|
+
*/
|
|
178
191
|
/* Should be the last opcode */
|
|
179
|
-
OPCODE(
|
|
192
|
+
OPCODE(130, OP_END, NULL, T0, T0, T0, T0)
|
|
@@ -683,7 +683,6 @@ class test_evaluate(TestCase):
|
|
|
683
683
|
out_l = evaluate('base ** -1.0')
|
|
684
684
|
assert_equal(out_l, np.power(base, -1.0))
|
|
685
685
|
|
|
686
|
-
|
|
687
686
|
def test_ex_uses_vml(self):
|
|
688
687
|
vml_funcs = [ "sin", "cos", "tan", "arcsin", "arccos", "arctan",
|
|
689
688
|
"sinh", "cosh", "tanh", "arcsinh", "arccosh", "arctanh",
|
|
@@ -694,6 +693,23 @@ class test_evaluate(TestCase):
|
|
|
694
693
|
_, ex_uses_vml = numexpr.necompiler.getExprNames(strexpr, {})
|
|
695
694
|
assert_equal(ex_uses_vml, use_vml, strexpr)
|
|
696
695
|
|
|
696
|
+
def test_bool_funcs(self):
|
|
697
|
+
# Test functions with boolean outputs
|
|
698
|
+
array_size = 100
|
|
699
|
+
dtype = np.float32
|
|
700
|
+
a = np.arange(2 * array_size, dtype=dtype)
|
|
701
|
+
a[array_size//2] = np.nan
|
|
702
|
+
a[array_size//3] = np.inf
|
|
703
|
+
|
|
704
|
+
assert np.all(evaluate("isnan(a)") == np.isnan(a))
|
|
705
|
+
assert np.all(evaluate("isfinite(a)") == np.isfinite(a))
|
|
706
|
+
assert np.all(evaluate("isinf(a)") == np.isinf(a))
|
|
707
|
+
a = a.astype(np.float64)
|
|
708
|
+
assert a.dtype == np.float64
|
|
709
|
+
assert np.all(evaluate("isnan(a)") == np.isnan(a))
|
|
710
|
+
assert np.all(evaluate("isfinite(a)") == np.isfinite(a))
|
|
711
|
+
assert np.all(evaluate("isinf(a)") == np.isinf(a))
|
|
712
|
+
|
|
697
713
|
if 'sparc' not in platform.machine():
|
|
698
714
|
# Execution order set here so as to not use too many threads
|
|
699
715
|
# during the rest of the execution. See #33 for details.
|
|
@@ -892,7 +908,6 @@ def test_expressions(
|
|
|
892
908
|
npval={npval!r} ({type(npval)!r} - {shape(npval)!r})
|
|
893
909
|
neval={neval!r} ({type(neval)!r} - {shape(neval)!r}))"""
|
|
894
910
|
|
|
895
|
-
|
|
896
911
|
class test_int64(TestCase):
|
|
897
912
|
def test_neg(self):
|
|
898
913
|
a = array([2 ** 31 - 1, 2 ** 31, 2 ** 32, 2 ** 63 - 1], dtype=int64)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: numexpr
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.12.0
|
|
4
4
|
Summary: Fast numerical expression evaluator for NumPy
|
|
5
5
|
Author-email: "David M. Cooke, Francesc Alted, and others" <blosc@blosc.org>
|
|
6
6
|
Maintainer-email: Blosc Development Team <blosc@blosc.org>
|
|
@@ -21,10 +21,11 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.11
|
|
22
22
|
Classifier: Programming Language :: Python :: 3.12
|
|
23
23
|
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
24
25
|
Requires-Python: >=3.10
|
|
25
26
|
Description-Content-Type: text/x-rst
|
|
26
27
|
License-File: LICENSE.txt
|
|
27
|
-
License-File:
|
|
28
|
+
License-File: LICENSES/cpuinfo.txt
|
|
28
29
|
Requires-Dist: numpy>=1.23.0
|
|
29
30
|
Dynamic: license-file
|
|
30
31
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
[build-system]
|
|
2
2
|
requires = [
|
|
3
|
-
"setuptools",
|
|
4
|
-
"wheel",
|
|
3
|
+
"setuptools>=77.0.0",
|
|
5
4
|
"numpy>=2.0.0",
|
|
6
5
|
]
|
|
7
6
|
build-backend = "setuptools.build_meta"
|
|
@@ -16,6 +15,7 @@ readme = "README.rst"
|
|
|
16
15
|
authors = [{name = "David M. Cooke, Francesc Alted, and others", email = "blosc@blosc.org"}]
|
|
17
16
|
maintainers = [{ name = "Blosc Development Team", email = "blosc@blosc.org"}]
|
|
18
17
|
license = "MIT"
|
|
18
|
+
license-files = ["LICENSE.txt", "LICENSES/*"]
|
|
19
19
|
classifiers = [
|
|
20
20
|
"Development Status :: 6 - Mature",
|
|
21
21
|
"Intended Audience :: Developers",
|
|
@@ -30,6 +30,7 @@ classifiers = [
|
|
|
30
30
|
"Programming Language :: Python :: 3.11",
|
|
31
31
|
"Programming Language :: Python :: 3.12",
|
|
32
32
|
"Programming Language :: Python :: 3.13",
|
|
33
|
+
"Programming Language :: Python :: 3.14",
|
|
33
34
|
]
|
|
34
35
|
requires-python = ">=3.10"
|
|
35
36
|
# Follow guidelines from https://scientific-python.org/specs/spec-0000/
|
|
@@ -43,8 +44,21 @@ homepage = "https://github.com/pydata/numexpr"
|
|
|
43
44
|
documentation = "https://numexpr.readthedocs.io"
|
|
44
45
|
repository = "https://github.com/pydata/numexpr"
|
|
45
46
|
|
|
47
|
+
[dependency-groups]
|
|
48
|
+
test = [
|
|
49
|
+
"pytest>=7.0.0",
|
|
50
|
+
"pytest-run-parallel>=0.6.0",
|
|
51
|
+
]
|
|
52
|
+
|
|
46
53
|
[tool.cibuildwheel]
|
|
47
|
-
|
|
54
|
+
build-verbosity = 1
|
|
55
|
+
skip = ["*-manylinux_i686", "*_ppc64le", "*_s390x"]
|
|
48
56
|
# Let's use a more recent version of the manylinux image for more modern compilers
|
|
49
57
|
manylinux-x86_64-image = "manylinux_2_28"
|
|
50
58
|
manylinux-aarch64-image = "manylinux_2_28"
|
|
59
|
+
test-groups = ["test"]
|
|
60
|
+
test-command = ["python -m pytest --pyargs numexpr"]
|
|
61
|
+
|
|
62
|
+
[[tool.cibuildwheel.overrides]]
|
|
63
|
+
select = "cp31*t-*"
|
|
64
|
+
test-command = ["python -m pytest --parallel-threads=4 --pyargs numexpr"]
|
numexpr-2.11.0/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2.11.0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|