MCPcopy
hub / github.com/numpy/numpy / _vectorize_call

Method _vectorize_call

numpy/lib/_function_base_impl.py:2600–2617  ·  view source on GitHub ↗

Vectorized call to `func` over positional `args`.

(self, func, args)

Source from the content-addressed store, hash-verified

2598 return ufunc, otypes
2599
2600 def _vectorize_call(self, func, args):
2601 """Vectorized call to `func` over positional `args`."""
2602 if self.signature is not None:
2603 res = self._vectorize_call_with_signature(func, args)
2604 elif not args:
2605 res = func()
2606 else:
2607 ufunc, otypes = self._get_ufunc_and_otypes(func=func, args=args)
2608 # gh-29196: `dtype=object` should eventually be removed
2609 args = [asanyarray(a, dtype=object) for a in args]
2610 outputs = ufunc(*args, out=...)
2611
2612 if ufunc.nout == 1:
2613 res = asanyarray(outputs, dtype=otypes[0])
2614 else:
2615 res = tuple(asanyarray(x, dtype=t)
2616 for x, t in zip(outputs, otypes))
2617 return res
2618
2619 def _vectorize_call_with_signature(self, func, args):
2620 """Vectorized call over positional arguments with a signature."""

Callers 1

_call_as_normalMethod · 0.95

Calls 4

_get_ufunc_and_otypesMethod · 0.95
asanyarrayFunction · 0.85
funcFunction · 0.70

Tested by

no test coverage detected