def get_spacing_matrix(size, spacing, offset):
 val_arr = []
 row_arr = []
 col_arr = []
 for var_row in range(size[1]):
  val_arr.append(1.0)
  row_arr.append(((spacing * var_row) + offset))
  col_arr.append(var_row)
 mat = sp.coo_matrix((val_arr, (row_arr, col_arr)), size).tocsc()
 return lu.create_const(mat, size, sparse=True)

def get_spacing_matrix ( size , spacing , offset ) : val_arr = [ ] row_arr = [ ] col_arr = [ ] for var_row in range ( size [ 1 ] ) : val_arr . append ( 1.0 ) row_arr . append ( ( ( spacing * var_row ) + offset ) ) col_arr . append ( var_row ) mat = sp . coo_matrix ( ( val_arr , ( row_arr , col_arr ) ) , size ) . tocsc ( ) return lu . create_const ( mat , size , sparse = True )
returns a sparse matrix linop that spaces out an expression .