Example #1
0
    def test_1(self):
        # dimension of the nullspace
        A = sp.array([[1., 2., 3., 1.], [1., 1., 2., 1.], [1., 2., 3., 1.]])

        N = nullspace(A)
        dimension = rank(N)

        assert dimension == 2
Example #2
0
def test_4():
    # numpy 0-D array
    A = sp.array([1, 0])
    assert artools.rank(A) == 1
Example #3
0
def test_3():
    # row vector
    A = sp.array([[1, 0]])
    assert artools.rank(A) == 1
Example #4
0
def test_2():
    # two linearly dependent rows
    A = sp.array([[1, 1], [1, 1]])
    assert artools.rank(A) == 1
Example #5
0
def test_1():
    # identity matrix
    A = sp.array([[1, 0], [0, 1]])
    assert artools.rank(A) == 2
Example #6
0
def test_8():
    # square matrix of independent vectors
    A = sp.array([[1, 2], [3, 1]])

    # rank(A) = number of columns
    assert rank(A) == A.shape[1]
Example #7
0
def test_1():
    # identity matrix
    A = sp.array([[1, 0], [0, 1]])
    assert rank(A) == 2
Example #8
0
def test_6():
    # matrix and its transpose
    A = sp.array([[1, 1, 1], [2, 1, 2], [3, 2, 3], [1, 1, 1]])
    A_transpose = A.T

    assert rank(A) == rank(A_transpose)
Example #9
0
def test_5():
    # linear combination of preceeding vectors
    A = sp.array([[1, 1, 1], [2, 1, 2], [3, 2, 3], [1, 1, 1]])
    assert rank(A) == 2
Example #10
0
def test_4():
    # numpy 0-D array
    A = sp.array([1, 0])
    assert rank(A) == 1
Example #11
0
def test_3():
    # row vector
    A = sp.array([[1, 0]])
    assert rank(A) == 1
Example #12
0
def test_2():
    # two linearly dependent rows
    A = sp.array([[1, 1], [1, 1]])
    assert rank(A) == 1