code: def matrix2cube(data_matrix, im_shape):
      r
  
      return data_matrix.T.reshape([data_matrix.shape[1]] + list(im_shape))
docs: r"""Matrix to Cube
  
      This method transforms a 2D matrix to a 3D cube
  
      Parameters
      ----------
      data_matrix : np.ndarray
          Input data cube, 2D array
      im_shape : tuple
          2D shape of the individual images
  
      Returns
      -------
      np.ndarray 3D cube
  
      Examples
      --------
      >>> from modopt.base.transform import matrix2cube
      >>> a = np.array([[0, 4, 8, 12], [1, 5, 9, 13], [2, 6, 10, 14],
      [3, 7, 11, 15]])
      >>> matrix2cube(a, (2, 2))
      array([[[ 0,  1],
              [ 2,  3]],
  
             [[ 4,  5],
              [ 6,  7]],
  
             [[ 8,  9],
              [10, 11]],
  
             [[12, 13],
              [14, 15]]])