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

Function ufunc_outer

numpy/core/src/umath/ufunc_object.c:5765–5789  ·  view source on GitHub ↗

* op.outer(a,b) is equivalent to op(a[:,NewAxis,NewAxis,etc.],b) * where a has b.ndim NewAxis terms appended. * * The result has dimensions a.ndim + b.ndim */

Source from the content-addressed store, hash-verified

5763 * The result has dimensions a.ndim + b.ndim
5764 */
5765static PyObject *
5766ufunc_outer(PyUFuncObject *ufunc,
5767 PyObject *const *args, Py_ssize_t len_args, PyObject *kwnames)
5768{
5769 if (ufunc->core_enabled) {
5770 PyErr_Format(PyExc_TypeError,
5771 "method outer is not allowed in ufunc with non-trivial"\
5772 " signature");
5773 return NULL;
5774 }
5775
5776 if (ufunc->nin != 2) {
5777 PyErr_SetString(PyExc_ValueError,
5778 "outer product only supported "\
5779 "for binary functions");
5780 return NULL;
5781 }
5782
5783 if (len_args != 2) {
5784 PyErr_SetString(PyExc_TypeError, "exactly two arguments expected");
5785 return NULL;
5786 }
5787
5788 return ufunc_generic_fastcall(ufunc, args, len_args, kwnames, NPY_TRUE);
5789}
5790
5791
5792static PyObject *

Callers

nothing calls this directly

Calls 1

ufunc_generic_fastcallFunction · 0.85

Tested by

no test coverage detected