class_docstr: IterOpInv:
     helper class to repeatedly solve [A-sigma*M]*x = b
     using an iterative method
code: def __init__(self, A, M, sigma, ifunc=gmres_loose, tol=0):
      self.A = A
      self.M = M
      self.sigma = sigma
  
      def mult_func(x):
          return A.matvec(x) - sigma * M.matvec(x)
  
      def mult_func_M_None(x):
          return A.matvec(x) - sigma * x
  
      x = np.zeros(A.shape[1])
      if M is None:
          dtype = mult_func_M_None(x).dtype
          self.OP = LinearOperator(
              self.A.shape, mult_func_M_None, dtype=dtype
          )
      else:
          dtype = mult_func(x).dtype
          self.OP = LinearOperator(self.A.shape, mult_func, dtype=dtype)
      self.shape = A.shape
  
      if tol <= 0:
          # when tol=0, ARPACK uses machine tolerance as calculated
          # by LAPACK's _LAMCH function.  We should match this
          tol = 2 * np.finfo(self.OP.dtype).eps
      self.ifunc = ifunc
      self.tol = tol
  
imports: from __future__ import division, print_function, absolute_import
  from .None import _arpack
  import numpy
  import warnings
  from scipy.sparse.linalg.interface import aslinearoperator, LinearOperator
  from scipy.sparse import eye, issparse, isspmatrix, isspmatrix_csr
  from scipy.linalg import eig, eigh, lu_factor, lu_solve
  from scipy.sparse.sputils import isdense
  from scipy.sparse.linalg import gmres, splu
  from scipy._lib._util import _aligned_zeros
  from scipy._lib._threadsafety import ReentrancyLock
label_desc: Use image node_id 1 to create a new IterOpInv object from inherited base classes: LinearOperator with example: obj = IterOpInv(A, M, sigma, ifunc, tol)