def lsmr_operator(Jop, d, active_set):
 (m, n) = Jop.shape
 def matvec(x):
  x_free = x.ravel().copy()
  x_free[active_set] = 0
  return Jop.matvec((x * d))
 def rmatvec(x):
  r = (d * Jop.rmatvec(x))
  r[active_set] = 0
  return r
 return LinearOperator((m, n), matvec=matvec, rmatvec=rmatvec, dtype=float)

def lsmr_operator ( Jop , d , active_set ) : ( m , n ) = Jop . shape def matvec ( x ) : x_free = x . ravel ( ) . copy ( ) x_free [ active_set ] = 0 return Jop . matvec ( ( x * d ) ) def rmatvec ( x ) : r = ( d * Jop . rmatvec ( x ) ) r [ active_set ] = 0 return r return LinearOperator ( ( m , n ) , matvec = matvec , rmatvec = rmatvec , dtype = float )
compute linearoperator to use in lsmr by dogbox algorithm .