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

Function npyiter_calculate_ndim

numpy/core/src/multiarray/nditer_constr.c:894–918  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

892}
893
894static int
895npyiter_calculate_ndim(int nop, PyArrayObject **op_in,
896 int oa_ndim)
897{
898 /* If 'op_axes' is being used, force 'ndim' */
899 if (oa_ndim >= 0 ) {
900 return oa_ndim;
901 }
902 /* Otherwise it's the maximum 'ndim' from the operands */
903 else {
904 int ndim = 0, iop;
905
906 for (iop = 0; iop < nop; ++iop) {
907 if (op_in[iop] != NULL) {
908 int ondim = PyArray_NDIM(op_in[iop]);
909 if (ondim > ndim) {
910 ndim = ondim;
911 }
912 }
913
914 }
915
916 return ndim;
917 }
918}
919
920/*
921 * Checks the per-operand input flags, and fills in op_itflags.

Callers 1

NpyIter_AdvancedNewFunction · 0.85

Calls 1

PyArray_NDIMFunction · 0.85

Tested by

no test coverage detected