예제 #1
0
def test_input_A_empty_row():
    A, b = create_test_A_b_rand(25, 0.7)
    A = np.array(A.todense())
    A[0,:] = 0
    A[1, 0] = 1
    Asp = sp.csr_matrix(A)
    with pytest.raises(ValueError):
        basic_solve(Asp,b)
예제 #2
0
def test_input_b_dtypes():
    A, b = create_test_A_b_rand()
    for dt in [np.float16, np.float32, np.int16, np.int32, np.int64]:
        bdt = b.astype(dt)
        with pytest.warns(PyPardisoWarning):
            basic_solve(A, bdt)
            
    for dt in [np.complex64, np.complex128, np.complex128, np.uint16, np.uint32, np.uint64]:
        bdt = b.astype(dt)
        with pytest.raises(TypeError):
            basic_solve(A, bdt)
예제 #3
0
def test_bvector_smoketest():
    A, b = create_test_A_b_rand()
    basic_solve(A, b)
예제 #4
0
def test_bmatrix_smoketest():
    A, b = create_test_A_b_rand(matrix=True)
    basic_solve(A, b)
예제 #5
0
def test_input_b_wrong_shape():
    A, b = create_test_A_b_rand()
    b = np.append(b, 1)
    with pytest.raises(ValueError):
        basic_solve(A,b)
예제 #6
0
def test_input_A_nonsquare():
    A, b = create_test_A_b_rand()
    A = sp.csr_matrix(np.concatenate([A.todense(), np.ones((A.shape[0], 1))], axis=1))
    with pytest.raises(ValueError):
        basic_solve(A,b)
예제 #7
0
def test_input_A_unsorted_indices():
    A, b = create_test_A_b_small(sort_indices=False)
    assert not A.has_sorted_indices
    ps._check_A(A)
    assert A.has_sorted_indices
    basic_solve(A,b)