def right_multiply(J, d, copy=True):
 if (copy and (not isinstance(J, LinearOperator))):
  J = J.copy()
 if issparse(J):
  J.data *= d.take(J.indices, mode='clip')
 elif isinstance(J, LinearOperator):
  J = right_multiplied_operator(J, d)
 else:
  J *= d
 return J

def right_multiply ( J , d , copy = True ) : if ( copy and ( not isinstance ( J , LinearOperator ) ) ) : J = J . copy ( ) if issparse ( J ) : J . data *= d . take ( J . indices , mode = 'clip' ) elif isinstance ( J , LinearOperator ) : J = right_multiplied_operator ( J , d ) else : J *= d return J
compute j diag(d) .