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

Method _vectorize_call

numpy/lib/function_base.py:2443–2462  ·  view source on GitHub ↗

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

(self, func, args)

Source from the content-addressed store, hash-verified

2441 return ufunc, otypes
2442
2443 def _vectorize_call(self, func, args):
2444 """Vectorized call to `func` over positional `args`."""
2445 if self.signature is not None:
2446 res = self._vectorize_call_with_signature(func, args)
2447 elif not args:
2448 res = func()
2449 else:
2450 ufunc, otypes = self._get_ufunc_and_otypes(func=func, args=args)
2451
2452 # Convert args to object arrays first
2453 inputs = [asanyarray(a, dtype=object) for a in args]
2454
2455 outputs = ufunc(*inputs)
2456
2457 if ufunc.nout == 1:
2458 res = asanyarray(outputs, dtype=otypes[0])
2459 else:
2460 res = tuple([asanyarray(x, dtype=t)
2461 for x, t in zip(outputs, otypes)])
2462 return res
2463
2464 def _vectorize_call_with_signature(self, func, args):
2465 """Vectorized call over positional arguments with a signature."""

Callers 1

_call_as_normalMethod · 0.95

Calls 5

_get_ufunc_and_otypesMethod · 0.95
asanyarrayFunction · 0.85
ufuncClass · 0.85
funcFunction · 0.70

Tested by

no test coverage detected