code: def to_dense(self) -> np.ndarray:
      matrix = np.empty((self.n, self.m))
      matrix.fill(np.inf)
  
      if isinstance(self.window, CRWindow):
          ranges = self.window.column_ranges
          lengths = self.window.column_lengths()
  
          # TODO express only in terms of numpy operations
          for i in range(1, self.n + 1):
              start = ranges[i * 2 + 0] - 1
              end = ranges[i * 2 + 1] - 1
              len = lengths[i]
              offset = self.offsets[i]
  
              matrix[i - 1][start:end] = self.dense[
                  offset : offset + len
              ]
      else:
          for i in range(1, self.n + 1):
              column_start = self.offsets[i]
  
              for j in range(1, self.m + 1):
                  column_idx = self.window.column_index(i)
                  if column_idx == -1:
                      continue
  
                  matrix[i - 1, j - 1] = self.dense[
                      column_start + column_idx
                  ]
  
      return matrix
  
imports: import array
  from abc import ABC, abstractmethod
  from itertools import repeat
  from typing import Tuple
  import numpy
  from .window import CRWindow, Window
label_desc: Use image node_id 3 for calling the SparseCostMatrix obj's underlying member method code with example usage: obj.to_dense() and returns: matrix