Octopus
fftw_low.c
Go to the documentation of this file.
1/*
2 Copyright (C) 2002 M. Marques, A. Castro, A. Rubio, G. Bertsch
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
19*/
21#include <config.h>
23
34void fft_optimize(int *n, int par) {
35 if (*n <= 2)
36 return;
37
38 for (;; (*n)++) {
39 int i, n2;
40
41 if ((par >= 0) && (*n % 2 != par))
42 continue;
43
44 /* For debugging: */
45 /* printf("%i has factors ", *n); */
46
47 n2 = *n;
48 for (i = 2; i <= n2; i++) {
49 if (n2 % i == 0) {
50 /* For debugging: */
51 /* printf("%i ", i); */
52 if(i > 7) break;
53 n2 = n2 / i;
54 i--;
55 }
56 }
57 /* For debugging: */
58 /* printf("\n"); */
59 if (n2 == 1)
60 return;
61 }
62}
63
64void FC_FUNC_(oct_fft_optimize, OCT_FFT_OPTIMIZE)(fint *n, fint *par) {
65 fft_optimize(n, *par);
66}
void fft_optimize(int *n, int par)
Definition: fftw_low.c:25
int fint
Definition: fortran_types.h:14
ptrdiff_t i
Definition: operate_inc.c:12