def _makeOperator(operatorInput, expectedShape):
 if (operatorInput is None):
  def ident(x):
   return x
  operator = LinearOperator(expectedShape, ident, matmat=ident)
 else:
  operator = aslinearoperator(operatorInput)
 if (operator.shape != expectedShape):
  raise ValueError('operator has invalid shape')
 return operator

def _makeOperator ( operatorInput , expectedShape ) : if ( operatorInput is None ) : def ident ( x ) : return x operator = LinearOperator ( expectedShape , ident , matmat = ident ) else : operator = aslinearoperator ( operatorInput ) if ( operator . shape != expectedShape ) : raise ValueError ( 'operator has invalid shape' ) return operator
takes a dense numpy array or a sparse matrix or a function and makes an operator performing matrix * blockvector products .