示例#1
0
    def test_1(self):
        Xs = sp.array([[1.0, 2.0, 3.0], [2.0, -1.0, 3.0]])

        bounds_ref = sp.array([[1.0, -1.0, 3.0], [2.0, 2.0, 3.0]])

        bounds = getExtrema(Xs)

        assert (sameRows(bounds, bounds_ref) is True)
示例#2
0
    def test_3(self):
        # test along rows instead of columns

        Xs = sp.array([[1.0, 2.0, 3.0], [2.0, -1.0, 3.0]])

        bounds_ref = sp.array([[1.0, -1.0], [3.0, 3.0]])

        bounds = getExtrema(Xs, axis=1)

        assert (sameRows(bounds, bounds_ref) is True)
示例#3
0
    def test_2(self):
        Xs_1 = sp.array([[1.0, 2.0, 3.0], [2.0, -1.0, 3.0]])

        Xs_2 = sp.array([[-1.0, -4.5, 6.5], [0.0, 1.0, -10.0]])

        Xs_list = [Xs_1, Xs_2, Xs_2]

        bounds_ref = sp.array([[-1.0, -4.5, -10.0], [2.0, 2.0, 6.5]])

        bounds = getExtrema(Xs_list)

        assert (sameRows(bounds, bounds_ref) is True)
示例#4
0
    def test_3(self):
        # test along rows instead of columns

        Xs_1 = sp.array([[1.0, 2.0, 3.0], [2.0, -1.0, 3.0]])

        Xs_2 = sp.array([[-1.0, -4.5, 6.5], [0.0, 1.0, -10.0]])

        Xs_list = [Xs_1, Xs_2, Xs_2]

        bounds_ref = sp.array([[1.0, -1.0, -4.5, -10.0, -4.5, -10.0],
                               [3.0, 3.0, 6.5, 1.0, 6.5, 1.0]])

        bounds = getExtrema(Xs_list, axis=1)

        assert (sameRows(bounds, bounds_ref) is True)