input: 
  class MatrixOperations:
      """ A class that provides various matrix operations such as addition, subtraction,
      multiplication, and transpose.
      >>> m1 = MatrixOperations(2, 2, [1, 2, 3, 4])
      >>> m2 = MatrixOperations(2, 2, [5, 6, 7, 8])
      >>> m1.add(m2)
      >>> print(m1)
      6 8 
      10 12 
      >>> m1.mul(m2)
      >>> print(m1)
      19 22 
      43 50 
      >>> m1.transpose()
      >>> print(m1)
      19 43 
      22 50 
      """
      
      def add(self, mat2):
          # Implementation for matrix addition
          pass
  
      def sub(self, mat2):
          # Implementation for matrix subtraction
          pass
  
      def mul(self, mat2):
          # Implementation for matrix multiplication
          pass
  
      def transpose(self):
          # Implementation for matrix transpose
          pass
  
output:     
  class MatrixOperations:
      """ A class that provides various matrix operations such as addition, subtraction,
      multiplication, and transpose.
      >>> m1 = MatrixOperations(2, 2, [1, 2, 3, 4])
      >>> m2 = MatrixOperations(2, 2, [5, 6, 7, 8])
      >>> m1.add(m2)
      >>> print(m1)
      6 8 
      10 12 
      >>> m1.mul(m2)
      >>> print(m1)
      19 22 
      43 50 
      >>> m1.transpose()
      >>> print(m1)
      19 43 
      22 50 
      """
      
      def __init__(self, rows, cols, data):
          self.rows = rows
          self.cols = cols
          self.data = data
  
      def add(self, mat2):
          # Implementation for matrix addition
          if self.rows != mat2.rows or self.cols != mat2.cols:
              raise ValueError("Matrices must have the same dimensions for addition")
          self.data = [self.data[i] + mat2.data[i] for i in range(len(self.data))]
  
      def sub(self, mat2):
          # Implementation for matrix subtraction
          if self.rows != mat2.rows or self.cols != mat2.cols:
              raise ValueError("Matrices must have the same dimensions for subtraction")
          self.data = [self.data[i] - mat2.data[i] for i in range(len(self.data))]
  
      def mul(self, mat2):
          # Implementation for matrix multiplication
          if self.cols != mat2.rows:
              raise ValueError("Number of columns in the first matrix must be equal to the number of rows in the second matrix")
          result = []
          for i in range(self.rows):
              for j in range(mat2.cols):
                  sum = 0
                  for k in range(self.cols):
                      sum += self.data[i * self.cols + k] * mat2.data[k * mat2.cols + j]
                  result.append(sum)
          self.data = result
          self.cols = mat2.cols
  
      def transpose(self):
          # Implementation for matrix transpose
          new_data = []
          for j in range(self.cols):
              for i in range(self.rows):
                  new_data.append(self.data[i * self.cols + j])
          self.data = new_data
          self.rows, self.cols = self.cols, self.rows
  
      def __str__(self):
          return "\n".join(" ".join(str(self.data[i * self.cols + j]) for j in range(self.cols)) for i in range(self.rows))
  