def test_mat_partition(): N = 100 A = poisson_1d(N) A_sub = partition_mat_by_num(A, 10) A_block = [[A_sub[i, j] for j in xrange(10)] for i in xrange(10)] A_reconstructed_from_block = sparse.bmat(A_block).tocsr() assert (A - A_reconstructed_from_block).nnz == 0
def test_poisson_1d(): N = 10 A = poisson_1d(N) assert np.sum(A.data) == 0.0