| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
This file had two functions called flatten_dtype, which did similar but
different things.
|
| |
|
|
|
|
| |
Add "np." prefix to meshgrid calls for consistency
|
| |
|
| |
|
|\
| |
| | |
BUG: Prevent crash in poly1d.__eq__
|
| | |
|
| |
| |
| |
| |
| | |
Presumably written long before @property existed. This means we don't need
__dict__ everywhere
|
| |
| |
| |
| | |
Fixes #8760
|
| |
| |
| |
| |
| |
| |
| |
| | |
BUG: fix issue #8250 where np.random.permutation fail.
This reverts commit 7a73bad2d9c04e4f16e87dbed9d7b627327fe814.
Closes #8776.
|
|\ \
| | |
| | | |
BUG: fix issue #8250 when np.array gets called on an invalid sequence
|
| | |
| | |
| | |
| | | |
called on an invalid sequence.
|
|\ \ \
| | | |
| | | | |
BLD: rewrite np.distutils.exec_command.exec_command()
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
exec_command() is currently a mess of several implementations using outdated
Python APIs and various hacks. This rewrites it to use the standard
subprocess module. See PR #7614 for previous discussion.
|
|\ \ \ \
| | | | |
| | | | |
| | | | |
| | | | | |
AndresGuzman-Ballen/automatic-compiler-vectorization
ENH: Allows building npy_math with static inlining
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Code Overview:
Numpy currently decouples the math function definitions in `npy_math.c.src`
from the function declarations found in `npy_math.h`. This patch allows
definitions to be included along with the inclusion of the `npy_math.h`
header.
Keeping the declarations and definitions separate is usually the right
approach, but mathematical code like this might be better off as an
exception to this common practice. Because the definitions are in the source
file instead of the header, the compiler does not have any clue what lies
underneath these math functions. This means the compiler can't make
important optimizations like inlining and vectorization. Extensions that
utilize these functions could greatly benefit from this, specifically
`loops.c.src` from the umath extension.
Implementation Details:
+ Renames `npy_math.c.src` to `npy_math_internal.h.src`
+ Generates `npy_math_internal.h` from template by adding to
`npymath_sources` list and adding `npymath` directory to include paths in
`generate_numpyconfig_h` function of `numpy/core/setup.py`
+ Numpy's core distutils defines `#NPY_INTERNAL_BUILD` macro to make sure
`npy_math_internal.h` is not included when other modules try to include
public header `npy_math.h`
- Currently do not know how to ship headers generated from template
files
+ Adds `npy_math.c`, a file that includes the `npy_math_internal.h.src`
file (but does not add NPY_INLINE static)
- This is to keep the same static npy_math library as it exists now
+ Appends `numpy/npy_math.h` with `npy_math_internal.h` under condition that
it's not being included in npy_math.c.src
- The conditional macros mean `loops.c.src` will have definitions
included, and the compiler will vectorize accordingly
+ Adds `NPY_INLINE` static to function declarations and definitions when
necessary
+ Replaces `sqrtf` with `npy_sqrtf` in `numpy/core/src/umath/umath_tests.c`
to make function portable
- `_sqrtf` was not found on certain Windows environments compiling with
Py2
|
| | | | |
| | | | |
| | | | |
| | | | | |
Addresses comment of @stefanv on gh-7131.
|
|\ \ \ \ \
| |_|_|_|/
|/| | | | |
BUG: Fix np.average for object arrays
|
| | | | |
| | | | |
| | | | |
| | | | | |
Fixes #8696
|
| | | | | |
|
| | | | | |
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Previously, these had different rules for unmasking values, and even different
arguments to decide how to do so.
Fixes #8664
|
| | | | | |
|
| | | | | |
|
| |/ / /
|/| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Fixes #8686
This PR centers around this piece of code in `numpy/core/src/umath/loops.c.src`:
```c
UNARY_LOOP {
const @type@ in1 = *(@type@ *)ip1;
const @type@ tmp = in1 > 0 ? in1 : -in1;
/* add 0 to clear -0.0 */
*((@type@ *)op1) = tmp + 0;
}
```
If in1 is `NaN`, the C99 standard requires that the comparison `in1 > 0`
signals `FE_INVALID`, but the usual semantics for the absolute function are
that no FP exceptions should be generated (eg compare to C `fabs` and Python
`abs`). This was probably never noticed due to a bug in GCC x86 where all
floating point comparisons do not signal exceptions, however Clang on x86 and
GCC on other architectures (including ARM and MIPS) do signal an FP exception
here.
Fix by clearing the floating point exceptions after the loop has
finished. The alternative of rewriting the loop to use `npy_fabs`
instead would also work but has performance issues because that function
is not inlined. The `test_abs_neg_blocked` is adjusted not to ignore
`FE_INVALID` errors because now both absolute and negate should never
produce an FP exceptions.
|
|\ \ \ \
| |/ / /
|/| | | |
BUG: Preserve identity of dtypes in make_mask_descr
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Cleans up make_mask_descr, and adds a private _replace_dtype_fields, which
we need elsewhere to replace all dtypes with `object` instead of `bool`.
This new version also removes repeated calls to `np.dtype`, doing the conversion
only once.
|
| | | |
| | | |
| | | |
| | | | |
Partially addresses #8666
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
* BLD: Remove unused _numpyconfig.h.in
That file was needed for the bento build, for which support
was removed in numpy 1.11.0
* BLD: Remove unused PYTHON_HAS_UNICODE_WIDE
The need for variable also went away for Bento.
|
|/ / /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Fixes #8212
det: return ones of the right shape
slogdet: return sign=ones, log=zeros of the right shape
pinv, eigvals(h?), eig(h?): return empty array(s?) of the right shape
svd & qr: not implemented, due to complex return value rules
|
| | |
| | |
| | |
| | |
| | |
| | | |
This bug is mentioned, fixed, but not described, in cadbb5f2ec84cb774023bbe8cbe6f39a93e837d7
To be safe, we patch it for the equivalent float32 function.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Previously, the dlamch function was a manually-edited file, precluding
autogeneration. We fix this by putting the manual edits in a patch file, and
then generating f2c_config.c from install/*.f, which includes dlamch.
While these functions exist in more than once place in lapack 3.0.0, they only
exist in lapack/install in newer versions. A side effect of this is that some
functions have been pulled out of `f2c_blas.c` and `f2c_s_lapack.c` into this
new file.
The edits in the patch were introduced in cadbb5f2ec84cb774023bbe8cbe6f39a93e837d7,
for a reason that is lost to time.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Also uses this splitting as an excuse to ditch the _lite suffix, in
favor of a f2c_ prefix for all generated files.
Before:
* `zlapack_lite.c` - Functions for the `complex128` type.
* `dlapack_lite.c` - Every other lapack function
After:
* `f2c_z_lapack.c` - Functions for the `complex128` type.
* `f2c_c_lapack.c` - Functions for the `complex64` type.
* `f2c_d_lapack.c` - Functions for the `float64` type.
* `f2c_s_lapack.c` - Functions for the `float32` type.
* `f2c_lapack.c` - Every other lapack function
|
| | |
| | |
| | |
| | |
| | | |
Since we can use 2.7+ features now, we can have the with statement and
subprocess.check_call
|
|\ \ \
| | | |
| | | | |
MAINT: Mark some tests with slow decorator
|
| | | |
| | | |
| | | |
| | | |
| | | | |
They all are in released versions so running them all the time should
not be required anymore.
|
|\ \ \ \
| | | | |
| | | | | |
BUG: Fix assert statements in random.choice tests
|
| | | | |
| | | | |
| | | | |
| | | | | |
Unless I am very much mistaken these 'assert_(x,y)' calls should really be 'assert_equal(x,y)'.
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | | |
Fixes #8459
* DOC: add release note [ci skip]
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Using the np.median function on MaskedArrays uses the not-overriden
partition method of a plain np.ndarray without error or warning. (#7330)
This PR overrides the partition method on MaskedArrays but simply to
throw a Warning. This will make users aware that something ignores the
mask without breaking backwards-compatibility. This also applies to
the argpartition method (even if it's not called by np.median).
|
|\ \ \ \
| | | | |
| | | | | |
DOC: Fixed minor typos in temp_elide.c
|
| |/ / /
| | | |
| | | |
| | | | |
[ci skip]
|
|\ \ \ \
| |/ / /
|/| | | |
BUG MaskedArray __eq__ wrong for masked scalar, multi-d recarray
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
In the process of trying to fix the "questionable behaviour in
`MaskedArray.__eq__`" (gh-8589), it became clear that the code was
buggy. E.g., `ma == ma[0]` failed if `ma` held a structured dtype;
multi-d structured dtypes failed generally; and, more worryingly,
a masked scalar comparison could be wrong:
`np.ma.MaskedArray(1, mask=True) == 0` yields True.
This commit solves these problems, adding tests to prevent regression.
In the process, it also ensures that the results for structured arrays
always equals what one would get by logically combining the results
over individual parts of the structure.
|
|\ \ \ \
| | | | |
| | | | | |
BUG: fix ma.median for empty ndarrays
|
| |/ / /
| | | |
| | | |
| | | |
| | | | |
return nan as it did in 1.11 and same as normal median.
closes gh-8703
|
|\ \ \ \
| |/ / /
|/| | | |
BUG: Fix deepcopy regression for empty arrays.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Deepcopy of empty arrays was failing because the nditer was constructed
without the NPY_ITER_ZEROSIZE_OK flag.
Closes #8536.
|