def compute_log_moment(q, sigma, steps, lmbd, verify=False, verbose=False):
 moment = compute_a(sigma, q, lmbd, verbose=verbose)
 if verify:
  mp.dps = 50
  moment_a_mp = compute_a_mp(sigma, q, lmbd, verbose=verbose)
  moment_b_mp = compute_b_mp(sigma, q, lmbd, verbose=verbose)
  np.testing.assert_allclose(moment, moment_a_mp, rtol=1e-10)
  if (not np.isinf(moment_a_mp)):
   np.testing.assert_array_less(moment_b_mp, moment_a_mp)
 if np.isinf(moment):
  return np.inf
 else:
  return (np.log(moment) * steps)

def compute_log_moment ( q , sigma , steps , lmbd , verify = False , verbose = False ) : moment = compute_a ( sigma , q , lmbd , verbose = verbose ) if verify : mp . dps = 50 moment_a_mp = compute_a_mp ( sigma , q , lmbd , verbose = verbose ) moment_b_mp = compute_b_mp ( sigma , q , lmbd , verbose = verbose ) np . testing . assert_allclose ( moment , moment_a_mp , rtol = 1e-10 ) if ( not np . isinf ( moment_a_mp ) ) : np . testing . assert_array_less ( moment_b_mp , moment_a_mp ) if np . isinf ( moment ) : return np . inf else : return ( np . log ( moment ) * steps )
compute the log moment of gaussian mechanism for given parameters .