code: def inv(self):
          
  
          if self.isdiagonal:
              inv = 1.0 / self.__x
              if (np.any(~np.isfinite(inv))):
                  idx = np.isfinite(inv)
                  np.savetxt("testboo.dat",idx)
                  invalid = [self.row_names[i] for i in range(idx.shape[0]) if idx[i] == 0.0]
                  raise Exception("Matrix.inv has produced invalid floating points " +
                                  " for the following elements:" + ','.join(invalid))
              return type(self)(x=inv, isdiagonal=True,
                                row_names=self.row_names,
                                col_names=self.col_names,
                                autoalign=self.autoalign)
          else:
              return type(self)(x=la.inv(self.__x), row_names=self.row_names,
                                col_names=self.col_names,
                                autoalign=self.autoalign)
docs: inversion operation of self
  
          Returns
          -------
          Matrix : Matrix
              inverse of self