Skip to content

Commit c0d6185

Browse files
committed
Merge pull request #444 from RcppCore/feature/pr437-postprocessing
Feature/pr437 postprocessing
2 parents 59cfb9e + 99d5e74 commit c0d6185

File tree

7 files changed

+79
-68
lines changed

7 files changed

+79
-68
lines changed

ChangeLog

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
2016-03-05 Dirk Eddelbuettel <[email protected]>
2+
3+
* inst/include/Rcpp/stats/exp.h: Replaced initial Emacs header line with
4+
current one, ran M-x untabify and streamlined indentation
5+
* inst/include/Rcpp/stats/lnorm.h: Idem
6+
* inst/include/Rcpp/stats/logis.h: Idem
7+
* inst/include/Rcpp/stats/norm.h: Idem
8+
* inst/include/Rcpp/stats/weibull.h: Idem
9+
110
2016-03-04 Dirk Eddelbuettel <[email protected]>
211

312
* inst/unitTests/runit.Function.R: Switched to '/usr/bin/env r'

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: Rcpp
22
Title: Seamless R and C++ Integration
3-
Version: 0.12.3.2
4-
Date: 2016-01-30
3+
Version: 0.12.3.3
4+
Date: 2016-03-05
55
Author: Dirk Eddelbuettel, Romain Francois, JJ Allaire, Kevin Ushey,
66
Qiang Kou, Douglas Bates and John Chambers
77
Maintainer: Dirk Eddelbuettel <[email protected]>

inst/include/Rcpp/stats/exp.h

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
2-
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*-
1+
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
32
//
43
// auto generated file (from script/stats.R)
54
//
65
// exp.h: Rcpp R/C++ interface class library --
76
//
8-
// Copyright (C) 2010 - 2011 Douglas Bates, Dirk Eddelbuettel and Romain Francois
7+
// Copyright (C) 2010 - 2016 Douglas Bates, Dirk Eddelbuettel and Romain Francois
98
//
109
// This file is part of Rcpp.
1110
//
@@ -27,45 +26,48 @@
2726

2827
namespace Rcpp {
2928
namespace stats {
30-
inline double d_exp_0(double x, int give_log) {
31-
32-
#ifdef IEEE_754
33-
/* NaNs propagated correctly */
34-
if (ISNAN(x)) return x + 1.0;
35-
#endif
36-
37-
if (x < 0.)
38-
return R_D__0;
39-
return give_log ? (-x) : ::exp(-x);
40-
}
41-
inline double q_exp_0(double p, int lower_tail, int log_p) {
42-
#ifdef IEEE_754
43-
if (ISNAN(p)) return p + 1.0;
44-
#endif
45-
46-
if ((log_p && p > 0) || (!log_p && (p < 0 || p > 1))) return R_NaN;
47-
if (p == R_DT_0)
48-
return 0;
49-
50-
return - R_DT_Clog(p);
51-
}
52-
inline double p_exp_0(double x, int lower_tail, int log_p) {
53-
#ifdef IEEE_754
54-
if (ISNAN(x)) return x + 1.0;
55-
#endif
56-
57-
if (x <= 0.)
58-
return R_DT_0;
59-
/* same as weibull(shape = 1): */
60-
x = -x;
61-
if (lower_tail)
62-
return (log_p
63-
/* log(1 - exp(x)) for x < 0 : */
64-
? (x > -M_LN2 ? ::log(-::expm1(x)) : ::log1p(-::exp(x)))
65-
: -::expm1(x));
66-
/* else: !lower_tail */
67-
return R_D_exp(x);
68-
}
29+
30+
inline double d_exp_0(double x, int give_log) {
31+
32+
#ifdef IEEE_754
33+
/* NaNs propagated correctly */
34+
if (ISNAN(x)) return x + 1.0;
35+
#endif
36+
37+
if (x < 0.)
38+
return R_D__0;
39+
return give_log ? (-x) : ::exp(-x);
40+
}
41+
42+
inline double q_exp_0(double p, int lower_tail, int log_p) {
43+
#ifdef IEEE_754
44+
if (ISNAN(p)) return p + 1.0;
45+
#endif
46+
47+
if ((log_p && p > 0) || (!log_p && (p < 0 || p > 1))) return R_NaN;
48+
if (p == R_DT_0)
49+
return 0;
50+
51+
return - R_DT_Clog(p);
52+
}
53+
54+
inline double p_exp_0(double x, int lower_tail, int log_p) {
55+
#ifdef IEEE_754
56+
if (ISNAN(x)) return x + 1.0;
57+
#endif
58+
59+
if (x <= 0.)
60+
return R_DT_0;
61+
/* same as weibull(shape = 1): */
62+
x = -x;
63+
if (lower_tail)
64+
return (log_p
65+
/* log(1 - exp(x)) for x < 0 : */
66+
? (x > -M_LN2 ? ::log(-::expm1(x)) : ::log1p(-::exp(x)))
67+
: -::expm1(x));
68+
/* else: !lower_tail */
69+
return R_D_exp(x);
70+
}
6971

7072
} // stats
7173
} // Rcpp
@@ -77,17 +79,17 @@ namespace Rcpp{
7779
// we cannot use the RCPP_DPQ_1 macro here because of rate and shape
7880
template <bool NA, typename T>
7981
inline stats::D1<REALSXP,NA,T> dexp( const Rcpp::VectorBase<REALSXP,NA,T>& x, double shape, bool log = false ) {
80-
return stats::D1<REALSXP,NA,T>( ::Rf_dexp, x, 1.0/shape, log );
82+
return stats::D1<REALSXP,NA,T>( ::Rf_dexp, x, 1.0/shape, log );
8183
}
8284

8385
template <bool NA, typename T>
8486
inline stats::P1<REALSXP,NA,T> pexp( const Rcpp::VectorBase<REALSXP,NA,T>& x, double shape, bool lower = true, bool log = false ) {
85-
return stats::P1<REALSXP,NA,T>( ::Rf_pexp, x, 1.0/shape, lower, log );
87+
return stats::P1<REALSXP,NA,T>( ::Rf_pexp, x, 1.0/shape, lower, log );
8688
}
8789

8890
template <bool NA, typename T>
8991
inline stats::Q1<REALSXP,NA,T> qexp( const Rcpp::VectorBase<REALSXP,NA,T>& x, double shape, bool lower = true, bool log = false ) {
90-
return stats::Q1<REALSXP,NA,T>( ::Rf_qexp, x, 1.0/shape, lower, log );
92+
return stats::Q1<REALSXP,NA,T>( ::Rf_qexp, x, 1.0/shape, lower, log );
9193
}
9294

9395
} // Rcpp

inst/include/Rcpp/stats/lnorm.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
2-
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*-
1+
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
32
//
43
// auto generated file (from script/stats.R)
54
//
65
// lnorm.h: Rcpp R/C++ interface class library --
76
//
8-
// Copyright (C) 2010 - 2011 Douglas Bates, Dirk Eddelbuettel and Romain Francois
7+
// Copyright (C) 2010 - 2016 Douglas Bates, Dirk Eddelbuettel and Romain Francois
98
//
109
// This file is part of Rcpp.
1110
//
@@ -43,7 +42,6 @@ inline double dlnorm_0(double x, int log_p){
4342
-(M_LN_SQRT_2PI + 0.5 * y * y + ::log(x)) :
4443
M_1_SQRT_2PI * ::exp(-0.5 * y * y) / x);
4544
/* M_1_SQRT_2PI = 1 / sqrt(2 * pi) */
46-
4745
}
4846

4947
inline double dlnorm_1(double x, double meanlog, int log_p){
@@ -64,7 +62,6 @@ inline double dlnorm_1(double x, double meanlog, int log_p){
6462

6563
}
6664

67-
6865
inline double plnorm_0(double x, int lower_tail, int log_p){
6966
#ifdef IEEE_754
7067
if (ISNAN(x))

inst/include/Rcpp/stats/logis.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*-
1+
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
22
//
33
// logis.h: Rcpp R/C++ interface class library --
44
//
5-
// Copyright (C) 2010 - 2011 Douglas Bates, Dirk Eddelbuettel and Romain Francois
5+
// Copyright (C) 2010 - 2016 Douglas Bates, Dirk Eddelbuettel and Romain Francois
66
//
77
// This file is part of Rcpp.
88
//
@@ -81,9 +81,8 @@ inline double plogis_1(double x, double location /*, double scale [=1.0] */,
8181
return (log_p ? -::log1p(x) : 1 / (1 + x));
8282
}
8383

84-
85-
inline double qlogis_0(double p /*, double location [=0.0], double scale [=1.0] */, int lower_tail, int log_p)
86-
{
84+
inline double qlogis_0(double p /*, double location [=0.0], double scale [=1.0] */,
85+
int lower_tail, int log_p) {
8786
#ifdef IEEE_754
8887
if (ISNAN(p))
8988
return p + 1.0;
@@ -104,8 +103,8 @@ inline double qlogis_0(double p /*, double location [=0.0], double scale [=1.0]
104103
}
105104

106105

107-
inline double qlogis_1(double p, double location /*, double scale [=1.0] */, int lower_tail, int log_p)
108-
{
106+
inline double qlogis_1(double p, double location /*, double scale [=1.0] */,
107+
int lower_tail, int log_p) {
109108
#ifdef IEEE_754
110109
if (ISNAN(p) || ISNAN(location))
111110
return p + location + 1.0;

inst/include/Rcpp/stats/norm.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*-
1+
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
22
//
33
// norm.h: Rcpp R/C++ interface class library -- normal distribution
44
//
5-
// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois
5+
// Copyright (C) 2010 - 2016 Dirk Eddelbuettel and Romain Francois
66
//
77
// This file is part of Rcpp.
88
//
@@ -40,7 +40,8 @@ inline double dnorm_1(double x, double mu /*, double sigma [=1.0]*/ , int give_l
4040
/* M_1_SQRT_2PI = 1 / sqrt(2 * pi) */
4141
}
4242

43-
inline double dnorm_0(double x /*, double mu [=0.0], double sigma [=1.0]*/ , int give_log) {
43+
inline double dnorm_0(double x /*, double mu [=0.0], double sigma [=1.0]*/ ,
44+
int give_log) {
4445
#ifdef IEEE_754
4546
if (ISNAN(x))
4647
return x + 1.0;
@@ -52,7 +53,8 @@ inline double dnorm_0(double x /*, double mu [=0.0], double sigma [=1.0]*/ , int
5253
/* M_1_SQRT_2PI = 1 / sqrt(2 * pi) */
5354
}
5455

55-
inline double pnorm_1(double x, double mu /*, double sigma [=1.]*/ , int lower_tail, int log_p){
56+
inline double pnorm_1(double x, double mu /*, double sigma [=1.]*/ ,
57+
int lower_tail, int log_p) {
5658
double p, cp;
5759

5860
/* Note: The structure of these checks has been carefully thought through.
@@ -93,10 +95,13 @@ inline double pnorm_0(double x /*, double mu [=0.] , double sigma [=1.]*/ , int
9395
return(lower_tail ? p : cp);
9496
}
9597

96-
inline double qnorm_1(double p, double mu /*, double sigma [=1.] */, int lower_tail, int log_p){
98+
inline double qnorm_1(double p, double mu /*, double sigma [=1.] */,
99+
int lower_tail, int log_p){
97100
return ::Rf_qnorm5(p, mu, 1.0, lower_tail, log_p);
98101
}
99-
inline double qnorm_0(double p /*, double mu [=0.], double sigma [=1.] */, int lower_tail, int log_p){
102+
103+
inline double qnorm_0(double p /*, double mu [=0.], double sigma [=1.] */,
104+
int lower_tail, int log_p){
100105
return ::Rf_qnorm5(p, 0.0, 1.0, lower_tail, log_p);
101106
}
102107

inst/include/Rcpp/stats/weibull.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
2-
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*-
1+
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
32
//
43
// auto generated file (from script/stats.R)
54
//
65
// weibull.h: Rcpp R/C++ interface class library --
76
//
8-
// Copyright (C) 2010 - 2011 Douglas Bates, Dirk Eddelbuettel and Romain Francois
7+
// Copyright (C) 2010 - 2016 Douglas Bates, Dirk Eddelbuettel and Romain Francois
98
//
109
// This file is part of Rcpp.
1110
//

0 commit comments

Comments
 (0)