Example #1
0
    def test_7(self):
        # both row vectors, same elements
        A = sp.array([[1., 0, 0, 0, 0]])

        B = sp.array([[1., 0, 0, 0, 0]])

        assert (sameCols(A, B) is True)
Example #2
0
    def test_8(self):
        # one row vectors, one column vector
        A = sp.array([[1., 0, 0, 0, 0]])

        B = sp.array([[1., 0, 0, 0, 0]]).T

        assert (sameCols(A, B) is False)
Example #3
0
    def test_6(self):
        # both row vectors, different elements
        A = sp.array([[1., 0, 0, 0, 0]])

        B = sp.array([[1., 0, 0, 1, 0]])

        assert (sameCols(A, B) is False)
Example #4
0
    def test_2(self):
        # different shapes
        A = sp.array([[1., 0, 0], [0, 1, 2], [0, 1, 3]])

        B = sp.array([[1., 0], [0, 2], [0, 3]])

        assert (sameCols(A, B) is False)
Example #5
0
    def test_4(self):
        # both column vectors, different elements
        A = sp.array([[1., 0, 0, 0, 0]]).T

        B = sp.array([[1., 0, 0, 1, 0]]).T

        assert (sameCols(A, B) is False)
Example #6
0
    def test_5(self):
        # same shape, just the negative of one another
        A = sp.array([[1., 0, 0], [0, 1, 2], [0, 1, 3]])

        B = -A

        assert (sameCols(A, B) is False)
Example #7
0
    def test_1(self):
        # identical matrices
        A = sp.array([[1., 0, 0], [0, 1, 2], [0, 1, 3]])

        B = sp.array([[1., 0, 0], [0, 1, 2], [0, 1, 3]])

        assert (sameCols(A, B) is True)
Example #8
0
    def test_3(self):
        # same shape, just transposed
        A = sp.array([[1., 0, 0], [0, 1, 2], [0, 1, 3]])

        B = A.T

        assert (sameCols(A, B) is False)
Example #9
0
    def test_4(self):
        # 0-D numpy arrays, with different elements
        A = sp.array([1., 0, 0])

        B = sp.array([1, 2, -3])

        assert (sameCols(A, B) is False)
Example #10
0
    def test_4(self):
        # identical copies
        A = sp.array([[1., 0, 0], [0, 1, 2], [0, 1, 3]])

        B = A

        assert (sameCols(A, B) is True)
Example #11
0
    def test_2(self):
        # same shape, different elements
        A = sp.array([[1., 0, 0], [0, 1, 2], [0, 1, 3]])

        B = sp.array([[0., 0, 0], [0, 0, 0], [0, 0, 0]])

        assert (sameCols(A, B) is False)
Example #12
0
    def test_3(self):
        # 1-D rows
        A = sp.array([[1., 0, 0]])

        B = sp.array([[1., 0, 0]])

        assert (sameCols(A, B) is True)
Example #13
0
    def test_5(self):
        # both column vectors, same elements
        A = sp.array([[1., 2, 3, 4, 5]]).T

        B = sp.array([[1., 2, 3, 4, 5]]).T

        assert (sameCols(A, B) is True)
Example #14
0
    def test_2(self):
        # same rows, different order
        A = sp.array([[1., 0, 0], [0, 1, 2], [0, 1, 3]])

        B = sp.array([[1., 0, 0], [0, 1, 3], [0, 1, 2]])

        assert (sameCols(A, B) is False)
Example #15
0
    def test_3(self):
        # A is a column vector, B is a 0-D array
        A = sp.array([[1., 2, 3, 4, 5]]).T
        B = sp.array([1., 2, 3, 4, 5])

        assert (sameCols(A, B) is False)
Example #16
0
    def test_2(self):
        # A is a row vector, B is a 0-D array
        A = sp.array([[1., 2, 3, 4, 5]])
        B = sp.array([1., 2, 3, 4, 5])

        assert (sameCols(A, B) is False)
Example #17
0
    def test_1(self):
        # both 0-D arrays
        A = sp.array([1., 2, 3, 4, 5])
        B = sp.array([1., 2, 3, 4, 5])

        assert (sameCols(A, B) is True)