def sin(mat, target=None):
  """
  Apply sin to each element of the matrix mat.
  """

  if not target:
    target = mat

  err_code = _eigenmat.apply_sin(mat.p_mat, target.p_mat)
  if err_code:
    raise generate_exception(err_code)

  return target

  Apply sin to each element of the matrix mat.
  
eigenmat/eigenmat.py