Skip to content

Missing complex number function Arg(X) #625

@coatless

Description

@coatless

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 )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions