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
11 changes: 1 addition & 10 deletions src/csrc/umath/comparison_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,16 +288,7 @@ NPY_NO_EXPORT int
comparison_ufunc_promoter(PyObject *ufunc_obj, PyArray_DTypeMeta *const op_dtypes[],
PyArray_DTypeMeta *const signature[], PyArray_DTypeMeta *new_op_dtypes[])
{
// Reduction: accumulator is Bool, element is QuadPrecDType, output is Bool
if (op_dtypes[0] == NULL) {
Py_INCREF(&PyArray_BoolDType);
new_op_dtypes[0] = &PyArray_BoolDType;
Py_INCREF(op_dtypes[1]);
new_op_dtypes[1] = op_dtypes[1];
Py_INCREF(&PyArray_BoolDType);
new_op_dtypes[2] = &PyArray_BoolDType;
return 0;
}
assert(op_dtypes[0] != NULL);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I didn't know that numpy in case of NULL, fills the 0th dtype slot with the Quad itself.


PyUFuncObject *ufunc = (PyUFuncObject *)ufunc_obj;
if (quad_ufunc_has_object_input(ufunc, op_dtypes)) {
Expand Down
10 changes: 1 addition & 9 deletions src/include/umath/promoters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,7 @@ quad_ufunc_promoter(PyObject *ufunc_obj, PyArray_DTypeMeta *const op_dtypes[],
PyUFuncObject *ufunc = (PyUFuncObject *)ufunc_obj;
int nargs = ufunc->nargs;

// Handle the special case for reductions
if (op_dtypes[0] == NULL) {
assert(ufunc->nin == 2 && ufunc->nout == 1); /* must be reduction */
for (int i = 0; i < 3; i++) {
Py_INCREF(op_dtypes[1]);
new_op_dtypes[i] = op_dtypes[1];
}
return 0;
}
assert(op_dtypes[0] != NULL);

if (quad_ufunc_has_object_input(ufunc, op_dtypes)) {
for (int i = 0; i < nargs; i++) {
Expand Down
Loading