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 @@ -14,6 +14,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)

## [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
37 changes: 3 additions & 34 deletions mkl_umath/src/mkl_umath_loops.c.src
Original file line number Diff line number Diff line change
Expand Up @@ -866,9 +866,9 @@ mkl_umath_@TYPE@_remainder(char **args, const npy_intp *dimensions, const npy_in
}

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

void
mkl_umath_@TYPE@_log2(char **args, const npy_intp *dimensions, const npy_intp *steps, void *NPY_UNUSED(func))
{
const int contig = IS_UNARY_CONT(@type@, @type@);
const int disjoint_or_same = DISJOINT_OR_SAME(args[0], args[1], dimensions[0], sizeof(@type@));
const int can_vectorize = contig && disjoint_or_same;
int ignore_fpstatus = 0;

if (can_vectorize && dimensions[0] > VML_TRANSCEDENTAL_THRESHOLD)
{
ignore_fpstatus = 1;
CHUNKED_VML_CALL2(v@s@Log2, dimensions[0], @type@, args[0], args[1]);
/* v@s@Log2(dimensions[0], (@type@*) args[0], (@type@*) args[1]); */
}
else {
UNARY_LOOP_DISPATCH(
@type@, @type@
,
can_vectorize
,
const @type@ in1 = *(@type@ *)ip1;
const int invalid_cases = in1 < 0 || in1 == 0 || npy_isnan(in1) || in1 == -NPY_INFINITY;
ignore_fpstatus |= invalid_cases;
*(@type@ *)op1 = log2@c@(in1);
)
}
if (ignore_fpstatus) {
feclearexcept(FE_DIVBYZERO | FE_INVALID);
}
}

void
mkl_umath_@TYPE@_absolute(char **args, const npy_intp *dimensions, const npy_intp *steps, void *NPY_UNUSED(func))
{
Expand Down
Loading