示例#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
示例#2
0
def test_4():
    # numpy 0-D array
    A = sp.array([1, 0])
    assert artools.rank(A) == 1
示例#3
0
def test_3():
    # row vector
    A = sp.array([[1, 0]])
    assert artools.rank(A) == 1
示例#4
0
def test_2():
    # two linearly dependent rows
    A = sp.array([[1, 1], [1, 1]])
    assert artools.rank(A) == 1
示例#5
0
def test_1():
    # identity matrix
    A = sp.array([[1, 0], [0, 1]])
    assert artools.rank(A) == 2
示例#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]
示例#7
0
def test_1():
    # identity matrix
    A = sp.array([[1, 0], [0, 1]])
    assert rank(A) == 2
示例#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)
示例#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
示例#10
0
def test_4():
    # numpy 0-D array
    A = sp.array([1, 0])
    assert rank(A) == 1
示例#11
0
def test_3():
    # row vector
    A = sp.array([[1, 0]])
    assert rank(A) == 1
示例#12
0
def test_2():
    # two linearly dependent rows
    A = sp.array([[1, 1], [1, 1]])
    assert rank(A) == 1