#NEWLINE# @ pytest . mark . parametrize ( 'n' , [ 1 , 2 ] ) #NEWLINE# def test_mat_set_diagonal( self , backend , nodes , elem_node , n , skip_cuda ) : #NEWLINE# #INDENT# 'Set the diagonal of the entire matrix to 1.0' #NEWLINE# mat = op2 . Mat ( op2 . Sparsity ( ( nodes ** n ) , elem_node ) , valuetype ) #NEWLINE# nrows = nrows . sparsity . nrows #NEWLINE# mat . set_local_diagonal_entries ( range ( nrows ) ) #NEWLINE# mat . assemble ( ) #NEWLINE# assert ( mat . values == np . identity ( ( nrows * n ) ) ) . all ( )