You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

800 lines
26KB

  1. /*
  2. Interface for the f2c translation of fftpack as found on http://www.netlib.org/fftpack/
  3. FFTPACK license:
  4. http://www.cisl.ucar.edu/css/software/fftpack5/ftpk.html
  5. Copyright (c) 2004 the University Corporation for Atmospheric
  6. Research ("UCAR"). All rights reserved. Developed by NCAR's
  7. Computational and Information Systems Laboratory, UCAR,
  8. www.cisl.ucar.edu.
  9. Redistribution and use of the Software in source and binary forms,
  10. with or without modification, is permitted provided that the
  11. following conditions are met:
  12. - Neither the names of NCAR's Computational and Information Systems
  13. Laboratory, the University Corporation for Atmospheric Research,
  14. nor the names of its sponsors or contributors may be used to
  15. endorse or promote products derived from this Software without
  16. specific prior written permission.
  17. - Redistributions of source code must retain the above copyright
  18. notices, this list of conditions, and the disclaimer below.
  19. - Redistributions in binary form must reproduce the above copyright
  20. notice, this list of conditions, and the disclaimer below in the
  21. documentation and/or other materials provided with the
  22. distribution.
  23. THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  24. EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE WARRANTIES OF
  25. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  26. NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT
  27. HOLDERS BE LIABLE FOR ANY CLAIM, INDIRECT, INCIDENTAL, SPECIAL,
  28. EXEMPLARY, OR CONSEQUENTIAL DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  29. ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  30. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
  31. SOFTWARE.
  32. ChangeLog:
  33. 2011/10/02: this is my first release of this file.
  34. */
  35. #ifndef FFTPACK_H
  36. #define FFTPACK_H
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. // just define FFTPACK_DOUBLE_PRECISION if you want to build it as a double precision fft
  41. #ifndef FFTPACK_DOUBLE_PRECISION
  42. typedef float fftpack_real;
  43. typedef int fftpack_int;
  44. #else
  45. typedef double fftpack_real;
  46. typedef int fftpack_int;
  47. #endif
  48. void cffti(fftpack_int n, fftpack_real *wsave);
  49. void cfftf(fftpack_int n, fftpack_real *c, fftpack_real *wsave);
  50. void cfftb(fftpack_int n, fftpack_real *c, fftpack_real *wsave);
  51. void rffti(fftpack_int n, fftpack_real *wsave);
  52. void rfftf(fftpack_int n, fftpack_real *r, fftpack_real *wsave);
  53. void rfftb(fftpack_int n, fftpack_real *r, fftpack_real *wsave);
  54. void cosqi(fftpack_int n, fftpack_real *wsave);
  55. void cosqf(fftpack_int n, fftpack_real *x, fftpack_real *wsave);
  56. void cosqb(fftpack_int n, fftpack_real *x, fftpack_real *wsave);
  57. void costi(fftpack_int n, fftpack_real *wsave);
  58. void cost(fftpack_int n, fftpack_real *x, fftpack_real *wsave);
  59. void sinqi(fftpack_int n, fftpack_real *wsave);
  60. void sinqb(fftpack_int n, fftpack_real *x, fftpack_real *wsave);
  61. void sinqf(fftpack_int n, fftpack_real *x, fftpack_real *wsave);
  62. void sinti(fftpack_int n, fftpack_real *wsave);
  63. void sint(fftpack_int n, fftpack_real *x, fftpack_real *wsave);
  64. #ifdef __cplusplus
  65. }
  66. #endif
  67. #endif /* FFTPACK_H */
  68. /*
  69. FFTPACK
  70. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  71. version 4 april 1985
  72. a package of fortran subprograms for the fast fourier
  73. transform of periodic and other symmetric sequences
  74. by
  75. paul n swarztrauber
  76. national center for atmospheric research boulder,colorado 80307
  77. which is sponsored by the national science foundation
  78. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  79. this package consists of programs which perform fast fourier
  80. transforms for both complex and real periodic sequences and
  81. certain other symmetric sequences that are listed below.
  82. 1. rffti initialize rfftf and rfftb
  83. 2. rfftf forward transform of a real periodic sequence
  84. 3. rfftb backward transform of a real coefficient array
  85. 4. ezffti initialize ezfftf and ezfftb
  86. 5. ezfftf a simplified real periodic forward transform
  87. 6. ezfftb a simplified real periodic backward transform
  88. 7. sinti initialize sint
  89. 8. sint sine transform of a real odd sequence
  90. 9. costi initialize cost
  91. 10. cost cosine transform of a real even sequence
  92. 11. sinqi initialize sinqf and sinqb
  93. 12. sinqf forward sine transform with odd wave numbers
  94. 13. sinqb unnormalized inverse of sinqf
  95. 14. cosqi initialize cosqf and cosqb
  96. 15. cosqf forward cosine transform with odd wave numbers
  97. 16. cosqb unnormalized inverse of cosqf
  98. 17. cffti initialize cfftf and cfftb
  99. 18. cfftf forward transform of a complex periodic sequence
  100. 19. cfftb unnormalized inverse of cfftf
  101. ******************************************************************
  102. subroutine rffti(n,wsave)
  103. ****************************************************************
  104. subroutine rffti initializes the array wsave which is used in
  105. both rfftf and rfftb. the prime factorization of n together with
  106. a tabulation of the trigonometric functions are computed and
  107. stored in wsave.
  108. input parameter
  109. n the length of the sequence to be transformed.
  110. output parameter
  111. wsave a work array which must be dimensioned at least 2*n+15.
  112. the same work array can be used for both rfftf and rfftb
  113. as long as n remains unchanged. different wsave arrays
  114. are required for different values of n. the contents of
  115. wsave must not be changed between calls of rfftf or rfftb.
  116. ******************************************************************
  117. subroutine rfftf(n,r,wsave)
  118. ******************************************************************
  119. subroutine rfftf computes the fourier coefficients of a real
  120. perodic sequence (fourier analysis). the transform is defined
  121. below at output parameter r.
  122. input parameters
  123. n the length of the array r to be transformed. the method
  124. is most efficient when n is a product of small primes.
  125. n may change so long as different work arrays are provided
  126. r a real array of length n which contains the sequence
  127. to be transformed
  128. wsave a work array which must be dimensioned at least 2*n+15.
  129. in the program that calls rfftf. the wsave array must be
  130. initialized by calling subroutine rffti(n,wsave) and a
  131. different wsave array must be used for each different
  132. value of n. this initialization does not have to be
  133. repeated so long as n remains unchanged thus subsequent
  134. transforms can be obtained faster than the first.
  135. the same wsave array can be used by rfftf and rfftb.
  136. output parameters
  137. r r(1) = the sum from i=1 to i=n of r(i)
  138. if n is even set l =n/2 , if n is odd set l = (n+1)/2
  139. then for k = 2,...,l
  140. r(2*k-2) = the sum from i = 1 to i = n of
  141. r(i)*cos((k-1)*(i-1)*2*pi/n)
  142. r(2*k-1) = the sum from i = 1 to i = n of
  143. -r(i)*sin((k-1)*(i-1)*2*pi/n)
  144. if n is even
  145. r(n) = the sum from i = 1 to i = n of
  146. (-1)**(i-1)*r(i)
  147. ***** note
  148. this transform is unnormalized since a call of rfftf
  149. followed by a call of rfftb will multiply the input
  150. sequence by n.
  151. wsave contains results which must not be destroyed between
  152. calls of rfftf or rfftb.
  153. ******************************************************************
  154. subroutine rfftb(n,r,wsave)
  155. ******************************************************************
  156. subroutine rfftb computes the real perodic sequence from its
  157. fourier coefficients (fourier synthesis). the transform is defined
  158. below at output parameter r.
  159. input parameters
  160. n the length of the array r to be transformed. the method
  161. is most efficient when n is a product of small primes.
  162. n may change so long as different work arrays are provided
  163. r a real array of length n which contains the sequence
  164. to be transformed
  165. wsave a work array which must be dimensioned at least 2*n+15.
  166. in the program that calls rfftb. the wsave array must be
  167. initialized by calling subroutine rffti(n,wsave) and a
  168. different wsave array must be used for each different
  169. value of n. this initialization does not have to be
  170. repeated so long as n remains unchanged thus subsequent
  171. transforms can be obtained faster than the first.
  172. the same wsave array can be used by rfftf and rfftb.
  173. output parameters
  174. r for n even and for i = 1,...,n
  175. r(i) = r(1)+(-1)**(i-1)*r(n)
  176. plus the sum from k=2 to k=n/2 of
  177. 2.*r(2*k-2)*cos((k-1)*(i-1)*2*pi/n)
  178. -2.*r(2*k-1)*sin((k-1)*(i-1)*2*pi/n)
  179. for n odd and for i = 1,...,n
  180. r(i) = r(1) plus the sum from k=2 to k=(n+1)/2 of
  181. 2.*r(2*k-2)*cos((k-1)*(i-1)*2*pi/n)
  182. -2.*r(2*k-1)*sin((k-1)*(i-1)*2*pi/n)
  183. ***** note
  184. this transform is unnormalized since a call of rfftf
  185. followed by a call of rfftb will multiply the input
  186. sequence by n.
  187. wsave contains results which must not be destroyed between
  188. calls of rfftb or rfftf.
  189. ******************************************************************
  190. subroutine sinti(n,wsave)
  191. ******************************************************************
  192. subroutine sinti initializes the array wsave which is used in
  193. subroutine sint. the prime factorization of n together with
  194. a tabulation of the trigonometric functions are computed and
  195. stored in wsave.
  196. input parameter
  197. n the length of the sequence to be transformed. the method
  198. is most efficient when n+1 is a product of small primes.
  199. output parameter
  200. wsave a work array with at least int(2.5*n+15) locations.
  201. different wsave arrays are required for different values
  202. of n. the contents of wsave must not be changed between
  203. calls of sint.
  204. ******************************************************************
  205. subroutine sint(n,x,wsave)
  206. ******************************************************************
  207. subroutine sint computes the discrete fourier sine transform
  208. of an odd sequence x(i). the transform is defined below at
  209. output parameter x.
  210. sint is the unnormalized inverse of itself since a call of sint
  211. followed by another call of sint will multiply the input sequence
  212. x by 2*(n+1).
  213. the array wsave which is used by subroutine sint must be
  214. initialized by calling subroutine sinti(n,wsave).
  215. input parameters
  216. n the length of the sequence to be transformed. the method
  217. is most efficient when n+1 is the product of small primes.
  218. x an array which contains the sequence to be transformed
  219. wsave a work array with dimension at least int(2.5*n+15)
  220. in the program that calls sint. the wsave array must be
  221. initialized by calling subroutine sinti(n,wsave) and a
  222. different wsave array must be used for each different
  223. value of n. this initialization does not have to be
  224. repeated so long as n remains unchanged thus subsequent
  225. transforms can be obtained faster than the first.
  226. output parameters
  227. x for i=1,...,n
  228. x(i)= the sum from k=1 to k=n
  229. 2*x(k)*sin(k*i*pi/(n+1))
  230. a call of sint followed by another call of
  231. sint will multiply the sequence x by 2*(n+1).
  232. hence sint is the unnormalized inverse
  233. of itself.
  234. wsave contains initialization calculations which must not be
  235. destroyed between calls of sint.
  236. ******************************************************************
  237. subroutine costi(n,wsave)
  238. ******************************************************************
  239. subroutine costi initializes the array wsave which is used in
  240. subroutine cost. the prime factorization of n together with
  241. a tabulation of the trigonometric functions are computed and
  242. stored in wsave.
  243. input parameter
  244. n the length of the sequence to be transformed. the method
  245. is most efficient when n-1 is a product of small primes.
  246. output parameter
  247. wsave a work array which must be dimensioned at least 3*n+15.
  248. different wsave arrays are required for different values
  249. of n. the contents of wsave must not be changed between
  250. calls of cost.
  251. ******************************************************************
  252. subroutine cost(n,x,wsave)
  253. ******************************************************************
  254. subroutine cost computes the discrete fourier cosine transform
  255. of an even sequence x(i). the transform is defined below at output
  256. parameter x.
  257. cost is the unnormalized inverse of itself since a call of cost
  258. followed by another call of cost will multiply the input sequence
  259. x by 2*(n-1). the transform is defined below at output parameter x
  260. the array wsave which is used by subroutine cost must be
  261. initialized by calling subroutine costi(n,wsave).
  262. input parameters
  263. n the length of the sequence x. n must be greater than 1.
  264. the method is most efficient when n-1 is a product of
  265. small primes.
  266. x an array which contains the sequence to be transformed
  267. wsave a work array which must be dimensioned at least 3*n+15
  268. in the program that calls cost. the wsave array must be
  269. initialized by calling subroutine costi(n,wsave) and a
  270. different wsave array must be used for each different
  271. value of n. this initialization does not have to be
  272. repeated so long as n remains unchanged thus subsequent
  273. transforms can be obtained faster than the first.
  274. output parameters
  275. x for i=1,...,n
  276. x(i) = x(1)+(-1)**(i-1)*x(n)
  277. + the sum from k=2 to k=n-1
  278. 2*x(k)*cos((k-1)*(i-1)*pi/(n-1))
  279. a call of cost followed by another call of
  280. cost will multiply the sequence x by 2*(n-1)
  281. hence cost is the unnormalized inverse
  282. of itself.
  283. wsave contains initialization calculations which must not be
  284. destroyed between calls of cost.
  285. ******************************************************************
  286. subroutine sinqi(n,wsave)
  287. ******************************************************************
  288. subroutine sinqi initializes the array wsave which is used in
  289. both sinqf and sinqb. the prime factorization of n together with
  290. a tabulation of the trigonometric functions are computed and
  291. stored in wsave.
  292. input parameter
  293. n the length of the sequence to be transformed. the method
  294. is most efficient when n is a product of small primes.
  295. output parameter
  296. wsave a work array which must be dimensioned at least 3*n+15.
  297. the same work array can be used for both sinqf and sinqb
  298. as long as n remains unchanged. different wsave arrays
  299. are required for different values of n. the contents of
  300. wsave must not be changed between calls of sinqf or sinqb.
  301. ******************************************************************
  302. subroutine sinqf(n,x,wsave)
  303. ******************************************************************
  304. subroutine sinqf computes the fast fourier transform of quarter
  305. wave data. that is , sinqf computes the coefficients in a sine
  306. series representation with only odd wave numbers. the transform
  307. is defined below at output parameter x.
  308. sinqb is the unnormalized inverse of sinqf since a call of sinqf
  309. followed by a call of sinqb will multiply the input sequence x
  310. by 4*n.
  311. the array wsave which is used by subroutine sinqf must be
  312. initialized by calling subroutine sinqi(n,wsave).
  313. input parameters
  314. n the length of the array x to be transformed. the method
  315. is most efficient when n is a product of small primes.
  316. x an array which contains the sequence to be transformed
  317. wsave a work array which must be dimensioned at least 3*n+15.
  318. in the program that calls sinqf. the wsave array must be
  319. initialized by calling subroutine sinqi(n,wsave) and a
  320. different wsave array must be used for each different
  321. value of n. this initialization does not have to be
  322. repeated so long as n remains unchanged thus subsequent
  323. transforms can be obtained faster than the first.
  324. output parameters
  325. x for i=1,...,n
  326. x(i) = (-1)**(i-1)*x(n)
  327. + the sum from k=1 to k=n-1 of
  328. 2*x(k)*sin((2*i-1)*k*pi/(2*n))
  329. a call of sinqf followed by a call of
  330. sinqb will multiply the sequence x by 4*n.
  331. therefore sinqb is the unnormalized inverse
  332. of sinqf.
  333. wsave contains initialization calculations which must not
  334. be destroyed between calls of sinqf or sinqb.
  335. ******************************************************************
  336. subroutine sinqb(n,x,wsave)
  337. ******************************************************************
  338. subroutine sinqb computes the fast fourier transform of quarter
  339. wave data. that is , sinqb computes a sequence from its
  340. representation in terms of a sine series with odd wave numbers.
  341. the transform is defined below at output parameter x.
  342. sinqf is the unnormalized inverse of sinqb since a call of sinqb
  343. followed by a call of sinqf will multiply the input sequence x
  344. by 4*n.
  345. the array wsave which is used by subroutine sinqb must be
  346. initialized by calling subroutine sinqi(n,wsave).
  347. input parameters
  348. n the length of the array x to be transformed. the method
  349. is most efficient when n is a product of small primes.
  350. x an array which contains the sequence to be transformed
  351. wsave a work array which must be dimensioned at least 3*n+15.
  352. in the program that calls sinqb. the wsave array must be
  353. initialized by calling subroutine sinqi(n,wsave) and a
  354. different wsave array must be used for each different
  355. value of n. this initialization does not have to be
  356. repeated so long as n remains unchanged thus subsequent
  357. transforms can be obtained faster than the first.
  358. output parameters
  359. x for i=1,...,n
  360. x(i)= the sum from k=1 to k=n of
  361. 4*x(k)*sin((2k-1)*i*pi/(2*n))
  362. a call of sinqb followed by a call of
  363. sinqf will multiply the sequence x by 4*n.
  364. therefore sinqf is the unnormalized inverse
  365. of sinqb.
  366. wsave contains initialization calculations which must not
  367. be destroyed between calls of sinqb or sinqf.
  368. ******************************************************************
  369. subroutine cosqi(n,wsave)
  370. ******************************************************************
  371. subroutine cosqi initializes the array wsave which is used in
  372. both cosqf and cosqb. the prime factorization of n together with
  373. a tabulation of the trigonometric functions are computed and
  374. stored in wsave.
  375. input parameter
  376. n the length of the array to be transformed. the method
  377. is most efficient when n is a product of small primes.
  378. output parameter
  379. wsave a work array which must be dimensioned at least 3*n+15.
  380. the same work array can be used for both cosqf and cosqb
  381. as long as n remains unchanged. different wsave arrays
  382. are required for different values of n. the contents of
  383. wsave must not be changed between calls of cosqf or cosqb.
  384. ******************************************************************
  385. subroutine cosqf(n,x,wsave)
  386. ******************************************************************
  387. subroutine cosqf computes the fast fourier transform of quarter
  388. wave data. that is , cosqf computes the coefficients in a cosine
  389. series representation with only odd wave numbers. the transform
  390. is defined below at output parameter x
  391. cosqf is the unnormalized inverse of cosqb since a call of cosqf
  392. followed by a call of cosqb will multiply the input sequence x
  393. by 4*n.
  394. the array wsave which is used by subroutine cosqf must be
  395. initialized by calling subroutine cosqi(n,wsave).
  396. input parameters
  397. n the length of the array x to be transformed. the method
  398. is most efficient when n is a product of small primes.
  399. x an array which contains the sequence to be transformed
  400. wsave a work array which must be dimensioned at least 3*n+15
  401. in the program that calls cosqf. the wsave array must be
  402. initialized by calling subroutine cosqi(n,wsave) and a
  403. different wsave array must be used for each different
  404. value of n. this initialization does not have to be
  405. repeated so long as n remains unchanged thus subsequent
  406. transforms can be obtained faster than the first.
  407. output parameters
  408. x for i=1,...,n
  409. x(i) = x(1) plus the sum from k=2 to k=n of
  410. 2*x(k)*cos((2*i-1)*(k-1)*pi/(2*n))
  411. a call of cosqf followed by a call of
  412. cosqb will multiply the sequence x by 4*n.
  413. therefore cosqb is the unnormalized inverse
  414. of cosqf.
  415. wsave contains initialization calculations which must not
  416. be destroyed between calls of cosqf or cosqb.
  417. ******************************************************************
  418. subroutine cosqb(n,x,wsave)
  419. ******************************************************************
  420. subroutine cosqb computes the fast fourier transform of quarter
  421. wave data. that is , cosqb computes a sequence from its
  422. representation in terms of a cosine series with odd wave numbers.
  423. the transform is defined below at output parameter x.
  424. cosqb is the unnormalized inverse of cosqf since a call of cosqb
  425. followed by a call of cosqf will multiply the input sequence x
  426. by 4*n.
  427. the array wsave which is used by subroutine cosqb must be
  428. initialized by calling subroutine cosqi(n,wsave).
  429. input parameters
  430. n the length of the array x to be transformed. the method
  431. is most efficient when n is a product of small primes.
  432. x an array which contains the sequence to be transformed
  433. wsave a work array that must be dimensioned at least 3*n+15
  434. in the program that calls cosqb. the wsave array must be
  435. initialized by calling subroutine cosqi(n,wsave) and a
  436. different wsave array must be used for each different
  437. value of n. this initialization does not have to be
  438. repeated so long as n remains unchanged thus subsequent
  439. transforms can be obtained faster than the first.
  440. output parameters
  441. x for i=1,...,n
  442. x(i)= the sum from k=1 to k=n of
  443. 4*x(k)*cos((2*k-1)*(i-1)*pi/(2*n))
  444. a call of cosqb followed by a call of
  445. cosqf will multiply the sequence x by 4*n.
  446. therefore cosqf is the unnormalized inverse
  447. of cosqb.
  448. wsave contains initialization calculations which must not
  449. be destroyed between calls of cosqb or cosqf.
  450. ******************************************************************
  451. subroutine cffti(n,wsave)
  452. ******************************************************************
  453. subroutine cffti initializes the array wsave which is used in
  454. both cfftf and cfftb. the prime factorization of n together with
  455. a tabulation of the trigonometric functions are computed and
  456. stored in wsave.
  457. input parameter
  458. n the length of the sequence to be transformed
  459. output parameter
  460. wsave a work array which must be dimensioned at least 4*n+15
  461. the same work array can be used for both cfftf and cfftb
  462. as long as n remains unchanged. different wsave arrays
  463. are required for different values of n. the contents of
  464. wsave must not be changed between calls of cfftf or cfftb.
  465. ******************************************************************
  466. subroutine cfftf(n,c,wsave)
  467. ******************************************************************
  468. subroutine cfftf computes the forward complex discrete fourier
  469. transform (the fourier analysis). equivalently , cfftf computes
  470. the fourier coefficients of a complex periodic sequence.
  471. the transform is defined below at output parameter c.
  472. the transform is not normalized. to obtain a normalized transform
  473. the output must be divided by n. otherwise a call of cfftf
  474. followed by a call of cfftb will multiply the sequence by n.
  475. the array wsave which is used by subroutine cfftf must be
  476. initialized by calling subroutine cffti(n,wsave).
  477. input parameters
  478. n the length of the complex sequence c. the method is
  479. more efficient when n is the product of small primes. n
  480. c a complex array of length n which contains the sequence
  481. wsave a real work array which must be dimensioned at least 4n+15
  482. in the program that calls cfftf. the wsave array must be
  483. initialized by calling subroutine cffti(n,wsave) and a
  484. different wsave array must be used for each different
  485. value of n. this initialization does not have to be
  486. repeated so long as n remains unchanged thus subsequent
  487. transforms can be obtained faster than the first.
  488. the same wsave array can be used by cfftf and cfftb.
  489. output parameters
  490. c for j=1,...,n
  491. c(j)=the sum from k=1,...,n of
  492. c(k)*exp(-i*(j-1)*(k-1)*2*pi/n)
  493. where i=sqrt(-1)
  494. wsave contains initialization calculations which must not be
  495. destroyed between calls of subroutine cfftf or cfftb
  496. ******************************************************************
  497. subroutine cfftb(n,c,wsave)
  498. ******************************************************************
  499. subroutine cfftb computes the backward complex discrete fourier
  500. transform (the fourier synthesis). equivalently , cfftb computes
  501. a complex periodic sequence from its fourier coefficients.
  502. the transform is defined below at output parameter c.
  503. a call of cfftf followed by a call of cfftb will multiply the
  504. sequence by n.
  505. the array wsave which is used by subroutine cfftb must be
  506. initialized by calling subroutine cffti(n,wsave).
  507. input parameters
  508. n the length of the complex sequence c. the method is
  509. more efficient when n is the product of small primes.
  510. c a complex array of length n which contains the sequence
  511. wsave a real work array which must be dimensioned at least 4n+15
  512. in the program that calls cfftb. the wsave array must be
  513. initialized by calling subroutine cffti(n,wsave) and a
  514. different wsave array must be used for each different
  515. value of n. this initialization does not have to be
  516. repeated so long as n remains unchanged thus subsequent
  517. transforms can be obtained faster than the first.
  518. the same wsave array can be used by cfftf and cfftb.
  519. output parameters
  520. c for j=1,...,n
  521. c(j)=the sum from k=1,...,n of
  522. c(k)*exp(i*(j-1)*(k-1)*2*pi/n)
  523. where i=sqrt(-1)
  524. wsave contains initialization calculations which must not be
  525. destroyed between calls of subroutine cfftf or cfftb
  526. */