def left_multiply(J, d, copy=True):
 if (copy and (not isinstance(J, LinearOperator))):
  J = J.copy()
 if issparse(J):
  J.data *= np.repeat(d, np.diff(J.indptr))
 elif isinstance(J, LinearOperator):
  J = left_multiplied_operator(J, d)
 else:
  J *= d[:, np.newaxis]
 return J

def left_multiply ( J , d , copy = True ) : if ( copy and ( not isinstance ( J , LinearOperator ) ) ) : J = J . copy ( ) if issparse ( J ) : J . data *= np . repeat ( d , np . diff ( J . indptr ) ) elif isinstance ( J , LinearOperator ) : J = left_multiplied_operator ( J , d ) else : J *= d [ : , np . newaxis ] return J
compute diag(d) j .