Quansight-Labs / numpy.net

A port of NumPy to .Net
BSD 3-Clause "New" or "Revised" License
131 stars 14 forks source link

array.shape[] #14

Closed yangjiandendi closed 3 years ago

yangjiandendi commented 3 years ago

how can i get the value from .shape? like in numpy i have a=[1,2,3], and i could get x=a.shape[0].

KevinBaselinesw commented 3 years ago

The shape class has iDims array. See the 2 unit tests below.

def test_simpleShape_1(self):

    a=np.array([1,2,3])
    x=a.shape[0]

    print(x)

    [TestMethod]
    public void test_simpleShape_1()
    {
        var a = np.array(new int[] { 1, 2, 3 });
        var x = a.shape.iDims[0];
        print(x);

        return;
    }
yangjiandendi commented 3 years ago

The shape class has iDims array. See the 2 unit tests below.

def test_simpleShape_1(self):

    a=np.array([1,2,3])
    x=a.shape[0]

    print(x)
    [TestMethod]
    public void test_simpleShape_1()
    {
        var a = np.array(new int[] { 1, 2, 3 });
        var x = a.shape.iDims[0];
        print(x);

        return;
    }