code: def find_local_row_costs_and_remaining_coo(
      self, csr_mat, dof_to_packet_nr, old2new_fetch_indices
  ):
      h, w = self.shape
      local_row_costs = [0] * h
      rem_coo_values = []
      rem_coo_i = []
      rem_coo_j = []
  
      iptr = csr_mat.indptr
      indices = csr_mat.indices
      data = csr_mat.data
  
      for i in range(h):
          for idx in range(iptr[i], iptr[i + 1]):
              j = indices[idx]
  
              if dof_to_packet_nr[i] == dof_to_packet_nr[j]:
                  local_row_costs[i] += 1
              else:
                  rem_coo_values.append(data[idx])
                  rem_coo_i.append(old2new_fetch_indices[i])
                  rem_coo_j.append(old2new_fetch_indices[j])
  
      from scipy.sparse import coo_matrix
  
      remaining_coo = coo_matrix(
          (rem_coo_values, (rem_coo_i, rem_coo_j)),
          self.shape,
          dtype=self.dtype,
      )
  
      return local_row_costs, remaining_coo
  
file_path: pycuda/pycuda/sparse/packeted.py
imports: from __future__ import division
  from __future__ import absolute_import
  from __future__ import print_function
  from pytools import memoize_method
  import pycuda.gpuarray
  from pycuda.compiler import SourceModule
  import numpy
label_desc: Use image node_id 3 for calling the PacketedSpMV obj's underlying member method code with example usage: obj.find_local_row_costs_and_remaining_coo(csr_mat, dof_to_packet_nr, old2new_fetch_indices) and returns: local_row_costs,  remaining_coo