MCPcopy Create free account
hub / github.com/numpy/numpy / can_elide_temp_unary

Function can_elide_temp_unary

numpy/core/src/multiarray/temp_elide.c:367–387  ·  view source on GitHub ↗

try elide unary temporary */

Source from the content-addressed store, hash-verified

365
366/* try elide unary temporary */
367NPY_NO_EXPORT int
368can_elide_temp_unary(PyArrayObject * m1)
369{
370 int cannot;
371 if (Py_REFCNT(m1) != 1 || !PyArray_CheckExact(m1) ||
372 !PyArray_ISNUMBER(m1) ||
373 !PyArray_CHKFLAGS(m1, NPY_ARRAY_OWNDATA) ||
374 !PyArray_ISWRITEABLE(m1) ||
375 PyArray_NBYTES(m1) < NPY_MIN_ELIDE_BYTES) {
376 return 0;
377 }
378 if (check_callers(&cannot)) {
379#if NPY_ELIDE_DEBUG != 0
380 puts("elided temporary in unary op");
381#endif
382 return 1;
383 }
384 else {
385 return 0;
386 }
387}
388#else /* unsupported interpreter or missing backtrace */
389NPY_NO_EXPORT int
390can_elide_temp_unary(PyArrayObject * m1)

Callers 5

fast_scalar_powerFunction · 0.85
array_positiveFunction · 0.85
array_negativeFunction · 0.85
array_absoluteFunction · 0.85
array_invertFunction · 0.85

Calls 2

PyArray_CHKFLAGSFunction · 0.85
check_callersFunction · 0.85

Tested by

no test coverage detected