| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
Same as 64-bit divistion, except quad wide divison leads
to inaccurate multiplier in certain cases when the log2 of
the divisor overflow to zero.
|
| |
|
|
| |
data ranges
|
| |
|
|
|
|
| |
The multiplier factor that used for integer division wasn't correctly
calculated due inaccurate implementation of the emulated version
of intrinsic `_udiv128`.
|
| | |
|
| |
|
|
|
|
|
| |
NpyIter_Deallocate returns 0 for failure and 1 for success,
so the check `NpyIter_Deallocate(iter) < 0` is not correct.
(See relevant comments in gh-20069.)
|
| |\
| |
| | |
MAINT: Refactor reductions to use NEP 43 style dispatching/promotion
|
| | |
| |
| |
| |
| |
| | |
In particular, this covers a casting error that currently cannot
be hit for normal ufuncs, because they already check casting during
the legacy dtype resolution (which is called first).
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
More fixups are coming, the biggest change is that the error message
is now improved when a reduction makes no sense such as
`np.subtract.reduce(np.array([1, 2, 3], dtype="M8[s]"))`
where input and output cannot have the same descriptor.
(Some more fixups still to go)
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| | |
At least the reduceat path seems to have been untested before.
The slight change in code layout (added assert) is just to make
the code slightly easier to read. Since otherwise it looks like
there is an additional `else` branch when `out` is given.
|
| | |
| |
| |
| |
| |
| |
| | |
This did not actually trigger any problems, probably because the
reduce fallback mode later just catches it anyway...
On the upside, this probably fixes most of the caching issues ;)
|
| | |
| |
| |
| |
| |
| | |
Mainly to see if this is indeed the problem, but the assert is
not necessary, and it might be we end up with the wrong dtype when
the input is a compatible (but different) integer already?
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| | |
This also implements new promoters for the logical functions.
The reasoning is that any logical function can always be handled
by first casting to boolean without changing the meaning.
This is true (unless the output is object), and already effectively
used for `np.all`/`np.any`.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* ENH: Create an experimental export of the new DType API
This expposes an experimental DType and ufunc API.
It can be used by including the experimental header AND
setting the `NUMPY_EXPERIMENTAL_DTYPE_API=1` environment variable.
A user must further call:
if (import_experimental_dtype_api(version) < 0) {
return NULL;
}
with a strict version check that will error on any mismatch.
At this time, I _know_ that some changes will happen, but it feels like
it may be a good idea to make this public anyway, with all the problems
attached... (e.g. as of now ufunc reductions will just not work, since
that PR is not yet merged.)
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
|
| | |
| |
| |
| | |
Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
|
| | | |
|
| |\ \
| | |
| | | |
ENH: Add annotations for `np.matrix`
|
| | | | |
|
| | | | |
|
| |/ /
| |
| |
| | |
http://cens.ioc.ee/projects/f2py2e/ is unavailable and links to NumPy and SciPy at https://web.archive.org/web/20140822061353/http://cens.ioc.ee:80/projects/f2py2e/ are too outdated.
|
| |\ \
| | |
| | | |
BUG: core: result_type(0, np.timedelta64(4)) would seg. fault.
|
| | | | |
|
| | | |
| | |
| | | |
Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Before this change, the line in convert_datatype.c
result = PyArray_CastDescrToDType(all_descriptors[0], common_dtype);
would trigger a seg. fault with a call such as
np.result_type(0, np.timedelta64(4))
The problem was that `all_descriptors[0]` was NULL, and it was
dereferenced in PyArray_CastDescrToDType.
The code in the loop that followed the above line avoided passing
NULL values in all_descriptors[i] to PyArray_CastDescrToDType by
checking that the corresponding input argument to `result_type`
was not a Python scalar. A different code path was taken in that
case. The seg. fault is fixed by applying that same check to the
first argument.
Closes gh-20077.
|
| | |/
|/|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
LLVM has a bug with AVX-512F masked multiply intrinsic `_mm512_mask_mul_pd`. The multiply operation is performed unmasked with a masked store. This can cause FP exceptions for lanes that should be masked.
LLVM bug report: https://bugs.llvm.org/show_bug.cgi?id=51988.
The bug affects NumPy / SciPy because NumPy has an AVX-512F implementation for log(), which uses a masked multiply intrinsic: `_mm512_mask_mul_pd`.
The bug surfaces in SciPy when trying to setup constants:
```
# The largest [in magnitude] usable floating value.
_XMAX = np.finfo(float).max
# The log of the largest usable floating value; useful for knowing
# when exp(something) will overflow
_LOGXMAX = np.log(_XMAX)
```
The workaround here explicitly masks the inputs before the multiply operation.
**Testing**
- Added a test case to numpy/core/tests/test_umath.py
- Fails on trunk
- Passes after workaround
SciPy testing before:
```
93 failed, 22378 passed, 1385 skipped, 93 xfailed, 7 xpassed, 1128 errors in 117.54s (0:01:57)
```
SciPy testing after:
```
74 failed, 33361 passed, 2230 skipped, 108 xfailed, 8 xpassed in 178.19s (0:02:58)
```
Note, all `1128` errors have been resolved as well as less test failures (`93` --> `74`)
|
| |\ \
| | |
| | | |
DOC: fix typo in docstring of bitwise_or
|
| | |/ |
|
| |\ \
| |/
|/| |
BUG: Add workaround for missing ufunc error propagation
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Some ufuncs (currently `np.power` soon hopefully only some bad user
ufunc) may release the GIL but still set Python errors.
The best bet we have is attempting to blanket check for errors before
returning from the ufunc.
This adds a new ufunc (since we should move `np.power` to the new
style definition with error return), and tests all relevant ufunc
entrypoints.
Closes gh-19634
|
| |\ \
| | |
| | | |
MAINT: LGTM.com recommendations
|
| | | |
| | |
| | |
| | | |
Except block directly handles BaseException.
|
| | | |
| | |
| | |
| | |
| | |
| | | |
Import of 'histogram' is not used.
Import of 'histogramdd' is not used.
Import of 'textwrap' is not used.
|
| |\ \ \
| | | |
| | | | |
MAINT: LGTM.com warnings
|
| | | | |
| | | |
| | | |
| | | | |
File may not be closed if an exception is raised.
|
| | | | |
| | | |
| | | |
| | | | |
Implicit string concatenation. Maybe missing a comma?
|
| |\ \ \ \
| | | | |
| | | | | |
DOC:add an example to show flag writeable cleared upon copy related to #20035
|
| | | | | | |
|
| | |/ / / |
|
| |\ \ \ \
| | | | |
| | | | | |
ENH: Vectorizing umath module using AVX-512 (open sourced from Intel Short Vector Math Library, SVML)
|
| | | | | | |
|
| | | | | | |
|
| | | | | | |
|
| | | | | | |
|
| | | | | | |
|