Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
* Dropped support for `maximum` and `minimum` [gh-104](https://github.com/IntelPython/mkl_umath/pull/104)
* Used a common umath loop for `log2` function to match NumPy [gh-109](https://github.com/IntelPython/mkl_umath/pull/109)
* Dropped support for `remainder` function [gh-110](https://github.com/IntelPython/mkl_umath/pull/110)

## [0.2.0] - 2025-06-03
This release updates `mkl_umath` to be aligned with both numpy-1.26.x and numpy-2.x.x.
Expand Down
14 changes: 5 additions & 9 deletions mkl_umath/generate_umath.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,8 @@ def english_upper(s):
None,
TD(inexactvec + cmplxvec, out='?'),
),
# 'maximum':
# 'minimum':
# 'maximum': no dedicated Intel(R) MKL function
# 'minimum': no dedicated Intel(R) MKL function
# 'clip':
'fmax':
Ufunc(2, 1, ReorderableNone,
Expand Down Expand Up @@ -717,13 +717,9 @@ def english_upper(s):
TD(inexactvec),
),
# 'arctan2':
'remainder':
Ufunc(2, 1, None,
docstrings.get('numpy._core.umath.remainder'),
None,
TD(inexactvec),
),
# 'divmod':
# 'remainder': Intel(R) MKL function v?Remainder follows C's modulo operator,
# but NumPy is expecting Python's one
# 'divmod': TODO: check if it can be added
# 'hypot':
'isnan':
Ufunc(1, 1, None,
Expand Down
2 changes: 1 addition & 1 deletion mkl_umath/src/blocking_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#include "numpy/arrayobject.h"

/* Adapated from NumPy's source code.
/* Adapted from NumPy's source code.
* https://github.com/numpy/numpy/blob/main/LICENSE.txt */

/*
Expand Down
2 changes: 1 addition & 1 deletion mkl_umath/src/fast_loop_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
#define NPY_ASSUME_ALIGNED(p, b)
#endif

/* Adapated from NumPy's source code.
/* Adapted from NumPy's source code.
* https://github.com/numpy/numpy/blob/main/LICENSE.txt */

/**
Expand Down
32 changes: 1 addition & 31 deletions mkl_umath/src/mkl_umath_loops.c.src
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#define USE_NUMPY_2
#endif

/* Adapated from NumPy's source code.
/* Adapted from NumPy's source code.
* https://github.com/numpy/numpy/blob/main/LICENSE.txt */

/*
Expand Down Expand Up @@ -835,36 +835,6 @@ mkl_umath_@TYPE@_@kind@(char **args, const npy_intp *dimensions, const npy_intp
}
/**end repeat1**/

void
mkl_umath_@TYPE@_remainder(char **args, const npy_intp *dimensions, const npy_intp *steps, void *NPY_UNUSED(func))
{
const int contig = IS_BINARY_CONT(@type@, @type@);
const int disjoint_or_same1 = DISJOINT_OR_SAME(args[0], args[2], dimensions[0], sizeof(@type@));
const int disjoint_or_same2 = DISJOINT_OR_SAME(args[1], args[2], dimensions[0], sizeof(@type@));
const int can_vectorize = contig && disjoint_or_same1 && disjoint_or_same2;
int ignore_fpstatus = 0;

if (can_vectorize && dimensions[0] > VML_TRANSCEDENTAL_THRESHOLD) {
ignore_fpstatus = 1;
CHUNKED_VML_CALL3(v@s@Remainder, dimensions[0], @type@, args[0], args[1], args[2]);
/* v@s@Remainder(dimensions[0], (@type@*) args[0], (@type@*) args[1], (@type@*) args[2]); */
}
else {
BINARY_LOOP {
const @type@ in1 = *(@type@ *)ip1;
const @type@ in2 = *(@type@ *)ip2;
int invalid_cases = !npy_isnan(in1) && in2 == 0;
invalid_cases |= (in1 == NPY_INFINITY || in1 == -NPY_INFINITY) && !npy_isnan(in2);
invalid_cases |= (in1 != NPY_INFINITY && in1 != -NPY_INFINITY) && (in2 == NPY_INFINITY || in2 == -NPY_INFINITY);
ignore_fpstatus |= invalid_cases;
divmod@c@(in1, in2, (@type@ *)op1);
}
}
if (ignore_fpstatus) {
feclearexcept(FE_UNDERFLOW | FE_INVALID);
}
}

/**begin repeat1
* # kind = cos, sin, tan, arccos, arcsin, arctan, cosh, sinh, tanh, arccosh, arcsinh, arctanh, fabs, floor, ceil, rint, trunc, cbrt, sqrt, expm1, log, log2, log1p, log10#
* # func = cos, sin, tan, acos, asin, atan, cosh, sinh, tanh, acosh, asinh, atanh, fabs, floor, ceil, rint, trunc, cbrt, sqrt, expm1, log, log2, log1p, log10#
Expand Down
2 changes: 1 addition & 1 deletion mkl_umath/src/mkl_umath_loops.h.src
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
copysign, cos, cosh, divide, divmod, isfinite, isinf, isnan, equal, exp, exp2, expm1, fabs,
floor, fmax, fmin, frexp, greater, greater_equal, ldexp, less, less_equal, log, log2, log10,
log1p, logical_and, logical_not, logical_or, logical_xor, multiply, modf,
negative, nextafter, not_equal, positive, reciprocal, remainder, rint, sign, signbit, sin,
negative, nextafter, not_equal, positive, reciprocal, rint, sign, signbit, sin,
sinh, spacing, sqrt, square, subtract, tan, tanh, trunc#
*/
MKL_UMATH_API
Expand Down
Loading