BRL-CAD
ifftc.c
Go to the documentation of this file.
1 /* I F F T C . C
2  * BRL-CAD
3  *
4  * Copyright (c) 2004-2014 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 /** @file libfft/ifftc.c
21  *
22  * Split Radix Decimation in Freq Inverse FFT C code generator.
23  *
24  */
25 
26 #include "common.h"
27 
28 #include <stdlib.h>
29 #include <stdio.h>
30 #include <math.h>
31 
32 #include "./fft.h"
33 
34 extern int irfft_adds, irfft_mults;
35 
36 int
37 main(int argc, char **argv)
38 {
39  int n, m;
40 
41  if ( argc != 2 ) {
42  fprintf( stderr, "Usage: ifftc length > fftlength.c\n" );
43  return 1;
44  }
45 
46  n = atoi(argv[1]);
47  if (n < 0 || n >= INT32_MAX) {
48  fprintf( stderr, "ifftc: bad length - %s\n", argv[1]);
49  return 1;
50  }
51 
52  m = log((double)n)/log(2.0) + 0.5; /* careful truncation */
53  ditsplit( n, m );
54  fprintf( stderr, "adds = %d, mults = %d\n", irfft_adds, irfft_mults );
55  return 0;
56 }
57 
58 /*
59  * Local Variables:
60  * mode: C
61  * tab-width: 8
62  * indent-tabs-mode: t
63  * c-file-style: "stroustrup"
64  * End:
65  * ex: shiftwidth=4 tabstop=8
66  */
int irfft_adds
Definition: ditsplitc.c:39
Header file for the BRL-CAD common definitions.
void ditsplit(int n, int m)
Definition: ditsplitc.c:43
int irfft_mults
Definition: ditsplitc.c:39
int main(int argc, char **argv)
Definition: ifftc.c:37