Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing complex number function Arg(X) #625

Closed
coatless opened this issue Jan 7, 2017 · 0 comments
Closed

Missing complex number function Arg(X) #625

coatless opened this issue Jan 7, 2017 · 0 comments

Comments

@coatless
Copy link
Contributor

coatless commented Jan 7, 2017

Complex sugar ops have support for the following R equivalents:

  • Re
  • Im
  • Mod
  • Conj

but no support for the Arg function that determines the angle between the real and complex plane (counter-clockwise).

Given the availability of the cpp port of the fortran atan2 inverse function, the base R imp of Arg is easy to mirror. Two-liner addition to the complex header:

inline double complex__Arg( Rcomplex x ){ return ::atan2(x.i, x.r); }
RCPP_SUGAR_COMPLEX( Arg, double )
eddelbuettel added a commit that referenced this issue Jan 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant