Skip to content

Commit 6de2b43

Browse files
authored
Merge pull request #110 from IntelPython/drop-support-remainder
Drop support for `remainder` ufunc
2 parents 0bb4631 + 738d1b8 commit 6de2b43

File tree

6 files changed

+10
-43
lines changed

6 files changed

+10
-43
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
### Changed
1616
* Dropped support for `maximum` and `minimum` [gh-104](https://github.com/IntelPython/mkl_umath/pull/104)
1717
* Used a common umath loop for `log2` function to match NumPy [gh-109](https://github.com/IntelPython/mkl_umath/pull/109)
18+
* Dropped support for `remainder` function [gh-110](https://github.com/IntelPython/mkl_umath/pull/110)
1819

1920
## [0.2.0] - 2025-06-03
2021
This release updates `mkl_umath` to be aligned with both numpy-1.26.x and numpy-2.x.x.

mkl_umath/generate_umath.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -532,8 +532,8 @@ def english_upper(s):
532532
None,
533533
TD(inexactvec + cmplxvec, out='?'),
534534
),
535-
# 'maximum':
536-
# 'minimum':
535+
# 'maximum': no dedicated Intel(R) MKL function
536+
# 'minimum': no dedicated Intel(R) MKL function
537537
# 'clip':
538538
'fmax':
539539
Ufunc(2, 1, ReorderableNone,
@@ -717,13 +717,9 @@ def english_upper(s):
717717
TD(inexactvec),
718718
),
719719
# 'arctan2':
720-
'remainder':
721-
Ufunc(2, 1, None,
722-
docstrings.get('numpy._core.umath.remainder'),
723-
None,
724-
TD(inexactvec),
725-
),
726-
# 'divmod':
720+
# 'remainder': Intel(R) MKL function v?Remainder follows C's modulo operator,
721+
# but NumPy is expecting Python's one
722+
# 'divmod': TODO: check if it can be added
727723
# 'hypot':
728724
'isnan':
729725
Ufunc(1, 1, None,

mkl_umath/src/blocking_utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
#include "numpy/arrayobject.h"
2929

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

3333
/*

mkl_umath/src/fast_loop_macros.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
#define NPY_ASSUME_ALIGNED(p, b)
5252
#endif
5353

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

5757
/**

mkl_umath/src/mkl_umath_loops.c.src

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
#define USE_NUMPY_2
4949
#endif
5050

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

5454
/*
@@ -835,36 +835,6 @@ mkl_umath_@TYPE@_@kind@(char **args, const npy_intp *dimensions, const npy_intp
835835
}
836836
/**end repeat1**/
837837

838-
void
839-
mkl_umath_@TYPE@_remainder(char **args, const npy_intp *dimensions, const npy_intp *steps, void *NPY_UNUSED(func))
840-
{
841-
const int contig = IS_BINARY_CONT(@type@, @type@);
842-
const int disjoint_or_same1 = DISJOINT_OR_SAME(args[0], args[2], dimensions[0], sizeof(@type@));
843-
const int disjoint_or_same2 = DISJOINT_OR_SAME(args[1], args[2], dimensions[0], sizeof(@type@));
844-
const int can_vectorize = contig && disjoint_or_same1 && disjoint_or_same2;
845-
int ignore_fpstatus = 0;
846-
847-
if (can_vectorize && dimensions[0] > VML_TRANSCEDENTAL_THRESHOLD) {
848-
ignore_fpstatus = 1;
849-
CHUNKED_VML_CALL3(v@s@Remainder, dimensions[0], @type@, args[0], args[1], args[2]);
850-
/* v@s@Remainder(dimensions[0], (@type@*) args[0], (@type@*) args[1], (@type@*) args[2]); */
851-
}
852-
else {
853-
BINARY_LOOP {
854-
const @type@ in1 = *(@type@ *)ip1;
855-
const @type@ in2 = *(@type@ *)ip2;
856-
int invalid_cases = !npy_isnan(in1) && in2 == 0;
857-
invalid_cases |= (in1 == NPY_INFINITY || in1 == -NPY_INFINITY) && !npy_isnan(in2);
858-
invalid_cases |= (in1 != NPY_INFINITY && in1 != -NPY_INFINITY) && (in2 == NPY_INFINITY || in2 == -NPY_INFINITY);
859-
ignore_fpstatus |= invalid_cases;
860-
divmod@c@(in1, in2, (@type@ *)op1);
861-
}
862-
}
863-
if (ignore_fpstatus) {
864-
feclearexcept(FE_UNDERFLOW | FE_INVALID);
865-
}
866-
}
867-
868838
/**begin repeat1
869839
* # 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#
870840
* # 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#

mkl_umath/src/mkl_umath_loops.h.src

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
copysign, cos, cosh, divide, divmod, isfinite, isinf, isnan, equal, exp, exp2, expm1, fabs,
5959
floor, fmax, fmin, frexp, greater, greater_equal, ldexp, less, less_equal, log, log2, log10,
6060
log1p, logical_and, logical_not, logical_or, logical_xor, multiply, modf,
61-
negative, nextafter, not_equal, positive, reciprocal, remainder, rint, sign, signbit, sin,
61+
negative, nextafter, not_equal, positive, reciprocal, rint, sign, signbit, sin,
6262
sinh, spacing, sqrt, square, subtract, tan, tanh, trunc#
6363
*/
6464
MKL_UMATH_API

0 commit comments

Comments
 (0)