Skip to content

Commit d773abd

Browse files
author
ripley
committed
avoid assuming Rboolean is int
git-svn-id: https://svn.r-project.org/R/trunk@87856 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 950fbb9 commit d773abd

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/library/stats/src/loessc.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
static
4747
void loess_workspace(int D, int N, double span, int degree,
4848
int nonparametric, const int drop_square[],
49-
int sum_drop_sqr, Rboolean setLf);
49+
int sum_drop_sqr, bool setLf);
5050

5151
static
5252
void loess_prune(int *parameter, int *a,
@@ -113,7 +113,7 @@ loess_raw(double *y, double *x, double *weights, double *robust, int *d,
113113

114114
*trL = 0;
115115

116-
loess_workspace(*d, *n, *span, *degree, *nonparametric, drop_square, *sum_drop_sqr, (Rboolean) *setLf);
116+
loess_workspace(*d, *n, *span, *degree, *nonparametric, drop_square, *sum_drop_sqr, (bool)*setLf);
117117
v[1] = *cell;/* = v(2) in Fortran (!) */
118118

119119
/* NB: surf_stat = (surface / statistics);
@@ -235,7 +235,7 @@ loess_ise(double *y, double *x, double *x_evaluate, double *weights,
235235
void
236236
loess_workspace(int D, int N, double span, int degree,
237237
int nonparametric, const int drop_square[],
238-
int sum_drop_sqr, Rboolean setLf)
238+
int sum_drop_sqr, bool setLf)
239239
{
240240
int nvmax = max(200, N),
241241
nf = min(N, (int) floor(N * span + 1e-5));
@@ -261,8 +261,10 @@ loess_workspace(int D, int N, double span, int degree,
261261
iv = R_Calloc(liv, int);
262262
v = R_Calloc(lv, double);
263263

264+
// Do the initialization in Fortran.
265+
int isetLf = setLf; // This is INTEGER in the Fortran routine
264266
F77_CALL(lowesd)(iv, &liv, &lv, v, &D, &N, &span,
265-
&degree, &nf, &nvmax, (int *) &setLf);
267+
&degree, &nf, &nvmax, &isetLf);
266268
iv[32] = nonparametric;
267269
for(int i = 0; i < D; i++)
268270
iv[i + 40] = drop_square[i];

src/library/stats/src/loessf.f

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1553,7 +1553,7 @@ subroutine lowesb(xx,yy,ww,diagl,infl,iv,wv)
15531553
c ------ called only by loess_workspace() in ./loessc.c
15541554
subroutine lowesd(iv, liv,lv, v, d,n,f,ideg,nf,nvmax, setlf)
15551555
integer liv,lv, d,n, ideg,nf,nvmax, setlf
1556-
c setlf {Rboolean}: if(true) need L [nf x nvmax] matrices
1556+
c setlf if(true) need L [nf x nvmax] matrices
15571557
integer iv(liv)
15581558
double precision f, v(lv)
15591559

0 commit comments

Comments
 (0)