[Rcpp-commits] r2001 - in pkg/Rcpp/inst: . include/Rcpp/sugar/functions unitTests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Aug 13 15:20:59 CEST 2010
Author: romain
Date: 2010-08-13 15:20:58 +0200 (Fri, 13 Aug 2010)
New Revision: 2001
Modified:
pkg/Rcpp/inst/ChangeLog
pkg/Rcpp/inst/include/Rcpp/sugar/functions/complex.h
pkg/Rcpp/inst/unitTests/runit.sugar.R
Log:
last complex functions
Modified: pkg/Rcpp/inst/ChangeLog
===================================================================
--- pkg/Rcpp/inst/ChangeLog 2010-08-13 13:13:00 UTC (rev 2000)
+++ pkg/Rcpp/inst/ChangeLog 2010-08-13 13:20:58 UTC (rev 2001)
@@ -5,7 +5,7 @@
* inst/include/Rcpp/sugar/complex.h: new sugar functions operating on
complex expressions: exp, log, sqrt, cos, sin, tan, acos, asin, atan,
- acosh, asinh, atanh, cosh
+ acosh, asinh, atanh, cosh, sinh, tanh
* inst/unitTests/runit.sugar.R: added regression test for complex functions
which did not handle NA properly before
Modified: pkg/Rcpp/inst/include/Rcpp/sugar/functions/complex.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/sugar/functions/complex.h 2010-08-13 13:13:00 UTC (rev 2000)
+++ pkg/Rcpp/inst/include/Rcpp/sugar/functions/complex.h 2010-08-13 13:20:58 UTC (rev 2001)
@@ -209,7 +209,28 @@
r.i = -a.r;
return r ;
}
+inline Rcomplex complex__sinh(Rcomplex z)
+{
+ Rcomplex r, b;
+ b.r = -z.i;
+ b.i = z.r;
+ Rcomplex a = complex__sin(b);
+ r.r = a.i;
+ r.i = -a.r;
+ return r ;
+}
+inline Rcomplex complex__tanh(Rcomplex z)
+{
+ Rcomplex r, b;
+ b.r = -z.i;
+ b.i = z.r;
+ Rcomplex a = complex__tan(b);
+ r.r = a.i;
+ r.i = -a.r;
+ return r ;
+}
+
} // internal
@@ -242,8 +263,9 @@
RCPP_SUGAR_COMPLEX( asinh, Rcomplex )
RCPP_SUGAR_COMPLEX( atanh, Rcomplex )
RCPP_SUGAR_COMPLEX( cosh, Rcomplex )
+RCPP_SUGAR_COMPLEX( sinh, Rcomplex )
+RCPP_SUGAR_COMPLEX( tanh, Rcomplex )
-
#undef RCPP_SUGAR_COMPLEX
} // Rcpp
Modified: pkg/Rcpp/inst/unitTests/runit.sugar.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.sugar.R 2010-08-13 13:13:00 UTC (rev 2000)
+++ pkg/Rcpp/inst/unitTests/runit.sugar.R 2010-08-13 13:20:58 UTC (rev 2001)
@@ -489,7 +489,9 @@
// _["acosh"] = acosh( cx ),
_["asinh"] = asinh( cx ),
_["atanh"] = atanh( cx ),
- _["cosh"] = cosh( cx )
+ _["cosh"] = cosh( cx ),
+ _["sinh"] = sinh( cx ),
+ _["tanh"] = tanh( cx )
) ;
'
),
@@ -1097,7 +1099,9 @@
# acosh = acosh(x),
asinh = asinh(x),
atanh = atanh(x),
- cosh = cosh(x)
+ cosh = cosh(x),
+ sinh = sinh(x),
+ tanh = tanh(x)
)
)
More information about the Rcpp-commits
mailing list