Python 是什么原因使numpy MGrid成为复数索引约定?

Python 是什么原因使numpy MGrid成为复数索引约定?,python,numpy,Python,Numpy,我在理解上有些问题。我读到以下内容: class MGridClass(nd_grid): """ `nd_grid` instance which returns a dense multi-dimensional "meshgrid". An instance of `numpy.lib.index_tricks.nd_grid` which returns an dense (or fleshed out) mesh-grid when indexed,

我在理解上有些问题。我读到以下内容:

class MGridClass(nd_grid):
    """
    `nd_grid` instance which returns a dense multi-dimensional "meshgrid".

    An instance of `numpy.lib.index_tricks.nd_grid` which returns an dense
    (or fleshed out) mesh-grid when indexed, so that each returned argument
    has the same shape.  The dimensions and number of the output arrays are
    equal to the number of indexing dimensions.  If the step length is not a
    complex number, then the stop is not inclusive.

    However, if the step length is a **complex number** (e.g. 5j), then
    the integer part of its magnitude is interpreted as specifying the
    number of points to create between the start and stop values, where
    the stop value **is inclusive**.
因此,如果我给出实数,则内容是‘模n==0’-除以:

>>> numpy.mgrid[0:4:1, 10:15:2] 
array([[[ 0,  0,  0],
        [ 1,  1,  1],
        [ 2,  2,  2],
        [ 3,  3,  3]],

       [[10, 12, 14],
        [10, 12, 14],
        [10, 12, 14],
        [10, 12, 14]]])
对于复数——后缀为j的整数,而不是技术上的i——它是相应轴上结果值的长度

>>> numpy.mgrid[0:4:3j, 10:15:5j] 
array([[[ 0.  ,  0.  ,  0.  ,  0.  ,  0.  ],
        [ 2.  ,  2.  ,  2.  ,  2.  ,  2.  ],
        [ 4.  ,  4.  ,  4.  ,  4.  ,  4.  ]],

       [[10.  , 11.25, 12.5 , 13.75, 15.  ],
        [10.  , 11.25, 12.5 , 13.75, 15.  ],
        [10.  , 11.25, 12.5 , 13.75, 15.  ]]])

但复数有什么特别之处,它们可以适当地反映视角的变化,而不是简单的标志?这是numpy真正的幻想的另一部分吗?

这只是代码开发人员选择使用的一种输入约定。请看这个类的代码。这个片段用
np展开。arange
步骤
是真实的,用
np.linspace
如果步骤很复杂。好的,那它就像一个标志,谢谢!