Skip to content

Commit 388990f

Browse files
author
ripley
committed
move fft_* to header
git-svn-id: https://svn.r-project.org/R/trunk@87857 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent d773abd commit 388990f

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

src/library/stats/src/fft.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* R : A Computer Language for Statistical Data Analysis
3-
* Copyright (C) 1998--2019 The R Core Team
3+
* Copyright (C) 1998--2025 The R Core Team
44
* Copyright (C) 1995, 1996, 1997 Robert Gentleman and Ross Ihaka
55
*
66
* This program is free software; you can redistribute it and/or modify
@@ -845,7 +845,7 @@ void fft_factor(int n, int *pmaxf, int *pmaxp)
845845
}
846846

847847

848-
Rboolean fft_work(double *a, double *b, int nseg, int n, int nspn, int isn,
848+
bool fft_work(double *a, double *b, int nseg, int n, int nspn, int isn,
849849
double *work, int *iwork)
850850
{
851851
/* check that factorization was successful */

src/library/stats/src/fourier.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,9 @@
2727
#include <Rinternals.h>
2828
#include "statsErr.h"
2929

30-
// workhorse routines from fft.c
31-
void fft_factor(int n, int *pmaxf, int *pmaxp);
32-
Rboolean fft_work(double *a, double *b, int nseg, int n, int nspn,
33-
int isn, double *work, int *iwork);
3430

3531
#include "statsR.h"
32+
#include "stats.h"
3633

3734
/* Fourier Transform for Univariate Spatial and Time Series */
3835

@@ -180,22 +177,22 @@ SEXP mvfft(SEXP z, SEXP inverse)
180177
return z;
181178
}
182179

183-
static Rboolean ok_n(int n, const int f[], int nf)
180+
static bool ok_n(int n, const int f[], int nf)
184181
{
185182
for (int i = 0; i < nf; i++) {
186183
while(n % f[i] == 0) {
187184
if ((n = n / f[i]) == 1)
188-
return TRUE;
185+
return true;
189186
}
190187
}
191188
return n == 1;
192189
}
193-
static Rboolean ok_n_64(uint64_t n, const int f[], int nf)
190+
static bool ok_n_64(uint64_t n, const int f[], int nf)
194191
{
195192
for (int i = 0; i < nf; i++) {
196193
while(n % f[i] == 0) {
197194
if ((n = n / f[i]) == 1)
198-
return TRUE;
195+
return true;
199196
}
200197
}
201198
return n == 1;
@@ -240,7 +237,7 @@ SEXP nextn(SEXP n, SEXP f)
240237
if (f_[i] == NA_INTEGER || f_[i] <= 1)
241238
error(_("invalid factors"));
242239

243-
Rboolean use_int = TYPEOF(n) == INTSXP;
240+
bool use_int = TYPEOF(n) == INTSXP;
244241
if(!use_int && TYPEOF(n) != REALSXP)
245242
error(_("'n' must have typeof(.) \"integer\" or \"double\""));
246243
R_xlen_t nn = XLENGTH(n);
@@ -250,7 +247,7 @@ SEXP nextn(SEXP n, SEXP f)
250247
if (!ISNAN(d_n[i]) && d_n[i] > n_max) n_max = d_n[i];
251248
}
252249
if(n_max <= INT_MAX / f_[0]) { // maximal n[] should not be too large to find "next n"
253-
use_int = TRUE;
250+
use_int = true;
254251
n = PROTECT(n = coerceVector(n, INTSXP)); nprot++;
255252
}
256253
}

src/library/stats/src/stats.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* R : A Computer Language for Statistical Data Analysis
3-
* Copyright (C) 2005-2024 The R Core Team
3+
* Copyright (C) 2005-2025 The R Core Team
44
*
55
* This program is free software; you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -55,5 +55,10 @@ double R_zeroin2(double ax, double bx, double fa, double fb,
5555
double (*f)(double x, void *info), void *info,
5656
double *Tol, int *Maxit);
5757

58+
/* from fft.c, formerly in fourier.c */
59+
void fft_factor(int n, int *pmaxf, int *pmaxp);
60+
bool fft_work(double *a, double *b, int nseg, int n, int nspn,
61+
int isn, double *work, int *iwork);
62+
5863

5964
#endif

0 commit comments

Comments
 (0)