code: def extract(self, return_eigenvectors):
      k, n = self.k, self.n
  
      ierr = 0
      howmny = "A"  # return all eigenvectors
      sselect = np.zeros(self.ncv, "int")  # unused
      sigmar = np.real(self.sigma)
      sigmai = np.imag(self.sigma)
      workev = np.zeros(3 * self.ncv, self.tp)
  
      if self.tp in "fd":
          dr = np.zeros(k + 1, self.tp)
          di = np.zeros(k + 1, self.tp)
          zr = np.zeros((n, k + 1), self.tp)
          dr, di, zr, ierr = self._arpack_extract(
              return_eigenvectors,
              howmny,
              sselect,
              sigmar,
              sigmai,
              workev,
              self.bmat,
              self.which,
              k,
              self.tol,
              self.resid,
              self.v,
              self.iparam,
              self.ipntr,
              self.workd,
              self.workl,
              self.info,
          )
          if ierr != 0:
              raise ArpackError(ierr, infodict=self.extract_infodict)
          nreturned = self.iparam[
              4
          ]  # number of good eigenvalues returned
  
          # Build complex eigenvalues from real and imaginary parts
          d = dr + 1.0j * di
  
          # Arrange the eigenvectors: complex eigenvectors are stored as
          # real,imaginary in consecutive columns
          z = zr.astype(self.tp.upper())
  
          # The ARPACK nonsymmetric real and double interface (s,d)naupd
          # return eigenvalues and eigenvectors in real (float,double)
          # arrays.
  
          # Efficiency: this should check that return_eigenvectors == True
          #  before going through this construction.
          if sigmai == 0:
              i = 0
              while i <= k:
                  # check if complex
                  if abs(d[i].imag) != 0:
                      # this is a complex conjugate pair with eigenvalues
                      # in consecutive columns
                      if i < k:
                          z[:, i] = zr[:, i] + 1.0j * zr[:, i + 1]
                          z[:, i + 1] = z[:, i].conjugate()
                          i += 1
                      else:
                          # last eigenvalue is complex: the imaginary part of
                          # the eigenvector has not been returned
                          # this can only happen if nreturned > k, so we'll
                          # throw out this case.
                          nreturned -= 1
                  i += 1
  
          else:
              # real matrix, mode 3 or 4, imag(sigma) is nonzero:
              # see remark 3 in <s,d>neupd.f
              # Build complex eigenvalues from real and imaginary parts
              i = 0
              while i <= k:
                  if abs(d[i].imag) == 0:
                      d[i] = np.dot(zr[:, i], self.matvec(zr[:, i]))
                  else:
                      if i < k:
                          z[:, i] = zr[:, i] + 1.0j * zr[:, i + 1]
                          z[:, i + 1] = z[:, i].conjugate()
                          d[i] = (
                              np.dot(zr[:, i], self.matvec(zr[:, i]))
                              + np.dot(
                                  zr[:, i + 1],
                                  self.matvec(zr[:, i + 1]),
                              )
                          ) + 1j * (
                              np.dot(
                                  zr[:, i], self.matvec(zr[:, i + 1])
                              )
                              - np.dot(
                                  zr[:, i + 1], self.matvec(zr[:, i])
                              )
                          )
                          d[i + 1] = d[i].conj()
                          i += 1
                      else:
                          # last eigenvalue is complex: the imaginary part of
                          # the eigenvector has not been returned
                          # this can only happen if nreturned > k, so we'll
                          # throw out this case.
                          nreturned -= 1
                  i += 1
  
          # Now we have k+1 possible eigenvalues and eigenvectors
          # Return the ones specified by the keyword "which"
  
          if nreturned <= k:
              # we got less or equal as many eigenvalues we wanted
              d = d[:nreturned]
              z = z[:, :nreturned]
          else:
              # we got one extra eigenvalue (likely a cc pair, but which?)
              if self.mode in (1, 2):
                  rd = d
              elif self.mode in (3, 4):
                  rd = 1 / (d - self.sigma)
  
              if self.which in ["LR", "SR"]:
                  ind = np.argsort(rd.real)
              elif self.which in ["LI", "SI"]:
                  # for LI,SI ARPACK returns largest,smallest
                  # abs(imaginary) (complex pairs come together)
                  ind = np.argsort(abs(rd.imag))
              else:
                  ind = np.argsort(abs(rd))
  
              if self.which in ["LR", "LM", "LI"]:
                  ind = ind[-k:][::-1]
              elif self.which in ["SR", "SM", "SI"]:
                  ind = ind[:k]
  
              d = d[ind]
              z = z[:, ind]
      else:
          # complex is so much simpler...
          d, z, ierr = self._arpack_extract(
              return_eigenvectors,
              howmny,
              sselect,
              self.sigma,
              workev,
              self.bmat,
              self.which,
              k,
              self.tol,
              self.resid,
              self.v,
              self.iparam,
              self.ipntr,
              self.workd,
              self.workl,
              self.rwork,
              ierr,
          )
  
          if ierr != 0:
              raise ArpackError(ierr, infodict=self.extract_infodict)
  
          k_ok = self.iparam[4]
          d = d[:k_ok]
          z = z[:, :k_ok]
  
      if return_eigenvectors:
          return d, z
      else:
          return d
  
imports: import numpy
  import warnings
  from scipy.sparse.linalg._interface import aslinearoperator, LinearOperator
  from scipy.sparse import eye, issparse
  from scipy.linalg import eig, eigh, lu_factor, lu_solve
  from scipy.sparse._sputils import isdense, is_pydata_spmatrix
  from scipy.sparse.linalg import gmres, splu
  from scipy._lib._util import _aligned_zeros
  from scipy._lib._threadsafety import ReentrancyLock
  from .None import _arpack
label_desc: Use image node_id 3 for calling the _UnsymmetricArpackParams obj's underlying member method code with example usage: obj.extract(return_eigenvectors) and returns: d,  z, d