Skip to content

Commit 738d1b8

Browse files
authored
Merge branch 'main' into drop-support-remainder
2 parents 451eea9 + 0bb4631 commit 738d1b8

File tree

2 files changed

+4
-34
lines changed

2 files changed

+4
-34
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414

1515
### Changed
1616
* Dropped support for `maximum` and `minimum` [gh-104](https://github.com/IntelPython/mkl_umath/pull/104)
17+
* Used a common umath loop for `log2` function to match NumPy [gh-109](https://github.com/IntelPython/mkl_umath/pull/109)
1718
* Dropped support for `remainder` function [gh-110](https://github.com/IntelPython/mkl_umath/pull/110)
1819

1920
## [0.2.0] - 2025-06-03

mkl_umath/src/mkl_umath_loops.c.src

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -836,9 +836,9 @@ mkl_umath_@TYPE@_@kind@(char **args, const npy_intp *dimensions, const npy_intp
836836
/**end repeat1**/
837837

838838
/**begin repeat1
839-
* # kind = cos, sin, tan, arccos, arcsin, arctan, cosh, sinh, tanh, arccosh, arcsinh, arctanh, fabs, floor, ceil, rint, trunc, cbrt, sqrt, expm1, log, log1p, log10#
840-
* # func = cos, sin, tan, acos, asin, atan, cosh, sinh, tanh, acosh, asinh, atanh, fabs, floor, ceil, rint, trunc, cbrt, sqrt, expm1, log, log1p, log10#
841-
* # VML = Cos, Sin, Tan, Acos, Asin, Atan, Cosh, Sinh, Tanh, Acosh, Asinh, Atanh, Abs, Floor, Ceil, Rint, Trunc, Cbrt, Sqrt, Expm1, Ln, Log1p, Log10#
839+
* # 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#
840+
* # 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#
841+
* # VML = Cos, Sin, Tan, Acos, Asin, Atan, Cosh, Sinh, Tanh, Acosh, Asinh, Atanh, Abs, Floor, Ceil, Rint, Trunc, Cbrt, Sqrt, Expm1, Ln, Log2, Log1p, Log10#
842842
*/
843843
void
844844
mkl_umath_@TYPE@_@kind@(char **args, const npy_intp *dimensions, const npy_intp *steps, void *NPY_UNUSED(func))
@@ -901,37 +901,6 @@ mkl_umath_@TYPE@_@kind@(char **args, const npy_intp *dimensions, const npy_intp
901901
}
902902
/**end repeat1**/
903903

904-
void
905-
mkl_umath_@TYPE@_log2(char **args, const npy_intp *dimensions, const npy_intp *steps, void *NPY_UNUSED(func))
906-
{
907-
const int contig = IS_UNARY_CONT(@type@, @type@);
908-
const int disjoint_or_same = DISJOINT_OR_SAME(args[0], args[1], dimensions[0], sizeof(@type@));
909-
const int can_vectorize = contig && disjoint_or_same;
910-
int ignore_fpstatus = 0;
911-
912-
if (can_vectorize && dimensions[0] > VML_TRANSCEDENTAL_THRESHOLD)
913-
{
914-
ignore_fpstatus = 1;
915-
CHUNKED_VML_CALL2(v@s@Log2, dimensions[0], @type@, args[0], args[1]);
916-
/* v@s@Log2(dimensions[0], (@type@*) args[0], (@type@*) args[1]); */
917-
}
918-
else {
919-
UNARY_LOOP_DISPATCH(
920-
@type@, @type@
921-
,
922-
can_vectorize
923-
,
924-
const @type@ in1 = *(@type@ *)ip1;
925-
const int invalid_cases = in1 < 0 || in1 == 0 || npy_isnan(in1) || in1 == -NPY_INFINITY;
926-
ignore_fpstatus |= invalid_cases;
927-
*(@type@ *)op1 = log2@c@(in1);
928-
)
929-
}
930-
if (ignore_fpstatus) {
931-
feclearexcept(FE_DIVBYZERO | FE_INVALID);
932-
}
933-
}
934-
935904
void
936905
mkl_umath_@TYPE@_absolute(char **args, const npy_intp *dimensions, const npy_intp *steps, void *NPY_UNUSED(func))
937906
{

0 commit comments

Comments
 (0)