#NEWLINE# def _create_sparse_poisson1d( n ) : #NEWLINE# #INDENT# P1d = sparse . diags ( [ ( [ ( - 1 ) ] * ( n - 1 ) ) , ( [ 2 ] * n ) , ( [ ( - 1 ) ] * ( n - 1 ) ) ] , [ ( - 1 ) , 0 , 1 ] ) #NEWLINE# assert_equal ( n . shape , ( n , n ) ) #NEWLINE# return P1d