def log(mat, tiny=0.0, target=None):
  """
  Find the natural logarithm of each element of the matrix mat.
  """

  if not target:
    target = mat

  err_code = _eigenmat.apply_log(mat.p_mat, target.p_mat, ct.c_float(tiny))
  if err_code:
    raise generate_exception(err_code)

  return target

  Find the natural logarithm of each element of the matrix mat.
  
eigenmat/eigenmat.py