File tree Expand file tree Collapse file tree 5 files changed +12
-0
lines changed
include/Rcpp/sugar/functions Expand file tree Collapse file tree 5 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 1+ 2017-01-07 James J Balamuta <
[email protected] >
2+
3+ * inst/include/Rcpp/sugar/functions/complex.h: Added Arg() function
4+ * inst/unitTests/runit.sugar.R: Added Arg() unit test to complex list
5+ * inst/unitTests/cpp/sugar.cpp: Idem
6+
172017-01-06 Dirk Eddelbuettel <
[email protected] >
28
39 * DESCRIPTION (Version, Date): Mark new minor version
Original file line number Diff line number Diff line change 1818 \itemize {
1919 \item Added new Sugar function \code {sample()} (Nathan Russell in
2020 \ghpr {610 }).
21+ \item Added new Sugar function \code {Arg()} (James Balamuta in
22+ \ghpr {626 } addressing \ghit {625 }).
2123 }
2224 \item Changes in Rcpp unit tests
2325 \itemize {
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ inline double complex__Re( Rcomplex x){ return x.r ; }
6868 y.i = -x.i ;
6969 return y ;
7070 }
71+ inline double complex__Arg ( Rcomplex x ){ return ::atan2 (x.i , x.r ); }
7172 // TODO: this does not use HAVE_C99_COMPLEX as in R, perhaps it should
7273 inline Rcomplex complex__exp ( Rcomplex x){
7374 Rcomplex y ;
@@ -249,6 +250,7 @@ inline Rcomplex complex__tanh(Rcomplex z)
249250RCPP_SUGAR_COMPLEX ( Re, double )
250251RCPP_SUGAR_COMPLEX ( Im, double )
251252RCPP_SUGAR_COMPLEX ( Mod, double )
253+ RCPP_SUGAR_COMPLEX ( Arg, double )
252254RCPP_SUGAR_COMPLEX ( Conj, Rcomplex )
253255RCPP_SUGAR_COMPLEX ( exp, Rcomplex )
254256RCPP_SUGAR_COMPLEX ( log, Rcomplex )
Original file line number Diff line number Diff line change @@ -402,6 +402,7 @@ List runit_complex( ComplexVector cx ){
402402 _[" Im" ] = Im ( cx ),
403403 _[" Conj" ] = Conj ( cx ),
404404 _[" Mod" ] = Mod ( cx ),
405+ _[" Arg" ] = Arg ( cx ),
405406 _[" exp" ] = exp ( cx ),
406407 _[" log" ] = log ( cx ),
407408 _[" sqrt" ] = sqrt ( cx ),
Original file line number Diff line number Diff line change @@ -441,6 +441,7 @@ if (.runThisTest) {
441441 Im = Im(x ),
442442 Conj = Conj(x ),
443443 Mod = Mod(x ),
444+ Arg = Arg(x ),
444445 exp = exp(x ),
445446 log = log(x ),
446447 sqrt = sqrt(x ),
You can’t perform that action at this time.
0 commit comments