/usr/include/casacore/scimath/Mathematics/FFTPack.h is in casacore-dev 2.2.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 | //# FFTPack.h: C++ wrapper functions for Fortran FFTPACK code
//# Copyright (C) 1993,1994,1995,1997,1999,2000,2001
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This library is free software; you can redistribute it and/or modify it
//# under the terms of the GNU Library General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or (at your
//# option) any later version.
//#
//# This library is distributed in the hope that it will be useful, but WITHOUT
//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
//# License for more details.
//#
//# You should have received a copy of the GNU Library General Public License
//# along with this library; if not, write to the Free Software Foundation,
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//# Internet email: aips2-request@nrao.edu.
//# Postal address: AIPS++ Project Office
//# National Radio Astronomy Observatory
//# 520 Edgemont Road
//# Charlottesville, VA 22903-2475 USA
//#
//# $Id$
#ifndef SCIMATH_FFTPACK_H
#define SCIMATH_FFTPACK_H
#include <casacore/casa/aips.h>
//# The SGI compiler with -LANG:std has some trouble including both Complexfwd.h
//# and Complex.h so we bypass the problem by include Complex.h only.
#if defined(AIPS_USE_NEW_SGI)
#include <casacore/casa/BasicSL/Complex.h>
#else
#include <casacore/casa/BasicSL/Complexfwd.h>
#endif
namespace casacore { //# NAMESPACE CASACORE - BEGIN
// <summary>C++ interface to the Fortran FFTPACK library</summary>
// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
// </reviewed>
// <synopsis>
// The static functions in this class are C++ wrappers to the Fortran FFTPACK
// library. This library contains functions that perform fast Fourier
// transforms (FFT's) and related transforms.
// An additional purpose of these definitions is to overload the functions so
// that C++ users can access the functions in either fftpak (single precision)
// or dfftpack (double precision) with identical function names.
// These routines only do one-dimensional transforms with the first element of
// the array being the "origin" of the transform. The <linkto
// class="FFTServer">FFTServer</linkto> class uses some of these functions to
// implement multi-dimensional transforms with the origin of the transform
// either at the centre or the first element of the Array.
// You must initialise the work array <src>wsave</src> before using the forward
// transform (function with a suffix of f) or the backward transform (with a
// suffix of b).
// The transforms done by the functions in this class can be categorised as
// follows:
// <ul>
// <li> Complex to Complex Transforms<br>
// Done by the cttfi, cfftf & cfftb functions
// <li> Real to Complex Transforms<br>
// Done by the rffti, rfftf & rfftb functions. A simpler interface is
// provided by the ezffti, ezfftf & ezfftb functions. The 'ez' functions
// do not destroy the input array and provide the result in a slightly
// less packed format. They are available in single precision only and
// internally use the rfft functions.
// <li> Sine Transforms<br>
// Done by the sinti & sint functions. As the sine transform is its own
// inverse there is no need for any distinction between forward and
// backward transforms.
// <li> Cosine Transforms<br>
// Done by the costi & cost functions. As the cosine transform is its own
// inverse there is no need for any distinction between forward and
// backward transforms.
// <li> Sine quarter wave Transforms<br>
// Done by the sinqi, sinqf & sinqb functions.
// <li> Cosine quarter wave Transforms<br>
// Done by the cosqi, cosqf & cosqb functions.
// </ul>
// <note role=warning>
// These functions assume that it is possible to convert between Casacore numeric
// types and those used by Fortran. That it is possible to convert between
// Float & float, Double & double and Int & int.
// </note>
// <note role=warning>
// These function also assume that a Complex array is stored as pairs of
// floating point numbers, with no intervening gaps, and with the real
// component first ie., <src>[re0,im0,re1,im1, ...]</src> so that the following
// type casts work,
// <srcblock>
// Complex* complexPtr;
// Float* floatPtr = (Float* ) complexPtr;
// </srcblock>
// and allow a Complex number to be accessed as a pair of real numbers. If this
// assumption is bad then float Arrays will have to generated by copying the
// complex ones. When compiled in debug mode mode the functions that require
// this assumption will throw an exception (AipsError) if this assumption is
// bad. Ultimately this assumption about Complex<->Float Array conversion
// should be put somewhere central like Array2Math.cc.
// </note>
// </synopsis>
class FFTPack
{
public:
// cffti initializes the array wsave which is used in both <src>cfftf</src> and
// <src>cfftb</src>. The prime factorization of n together with a tabulation of
// the trigonometric functions are computed and stored in wsave.
//
// Input parameter:
// <dl compact>
// <dt><b>n</b>
// <dd> The length of the sequence to be transformed
// </dl>
// Output parameter:
// <dl compact>
// <dt><b>wsave</b>
// <dd> A work array which must be dimensioned at least 4*n+15
// The same work array can be used for both cfftf and cfftb
// as long as n remains unchanged. Different wsave arrays
// are required for different values of n. The contents of
// wsave must not be changed between calls of cfftf or cfftb.
// </dl>
// <group>
static void cffti(Int n, Float* wsave);
static void cffti(Int n, Double* wsave);
//Here is the doc from FFTPack 5.1
//You can convert the linguo from fortran to C/C++
/* Input Arguments
L Integer number of elements to be transformed in the first
dimension. The transform is most efficient when L is a
product of small primes.
M Integer number of elements to be transformed in the second
dimension. The transform is most efficient when M is a
product of small primes.
LENSAV Integer dimension of WSAVE array. LENSAV must be at least
2*(L+M) + INT(LOG(REAL(L))/LOG(2.)) + INT(LOG(REAL(M))/LOG(2.)) + 8.
Output Arguments
WSAVE Real work array with dimension LENSAV, containing the
prime factors of L and M, and also containing certain
trigonometric values which will be used in routines
CFFT2B or CFFT2F.
WSAVE Real work array with dimension LENSAV. The WSAVE array
must be initialized with a call to subroutine CFFT2I before
the first call to CFFT2B or CFFT2F, and thereafter whenever
the values of L, M or the contents of array WSAVE change.
Using different WSAVE arrays for different transform lengths
or types in the same program may reduce computation costs
because the array contents can be re-used.
IER Integer error return
= 0 successful exit
= 2 input parameter LENSAV not big enough
= 20 input error returned by lower level routine
*/
static void cfft2i(const Int& n, const Int& m, Float *& wsave, const Int& lensav, Int& ier);
// </group>
// cfftf computes the forward complex discrete Fourier
// transform (the Fourier analysis). Equivalently, cfftf computes
// the Fourier coefficients of a complex periodic sequence.
// the transform is defined below at output parameter c.
//
// The transform is not normalized. To obtain a normalized transform
// the output must be divided by n. Otherwise a call of cfftf
// followed by a call of cfftb will multiply the sequence by n.
//
// The array wsave which is used by <src>cfftf</src> must be
// initialized by calling <src>cffti(n,wsave)</src>.
//
// Input parameters:
// <dl compact>
// <dt><b>n</b>
// <dd> The length of the complex sequence c. The method is
// more efficient when n is the product of small primes.
// <dt><b>c</b>
// <dd> A complex array of length n which contains the sequence to be
// transformed.
// <dt><b>wsave</b>
// <dd> A real work array which must be dimensioned at least 4n+15
// by the program that calls cfftf. The wsave array must be
// initialized by calling <src>cffti(n,wsave)</src> and a
// different wsave array must be used for each different
// value of n. This initialization does not have to be
// repeated so long as n remains unchanged thus subsequent
// transforms can be obtained faster than the first.
// The same wsave array can be used by cfftf and cfftb.
// </dl>
// Output parameters:
// <dl compact>
// <dt><b>c</b>
// <dd> for j=1,...,n<br>
// c(j)=the sum from k=1,...,n of<br>
// c(k)*exp(-i*(j-1)*(k-1)*2*pi/n)<br>
// where i=sqrt(-1)<br>
// <dt><b>wsave</b>
// <dd> Contains initialization calculations which must not be
// destroyed between calls of cfftf or cfftb
// </dl>
// <group>
static void cfftf(Int n, Complex* c, Float* wsave);
static void cfftf(Int n, DComplex* c, Double* wsave);
//Description from FFTPack 5.1
/*
Input Arguments
LDIM Integer first dimension of two-dimensional complex array C.
L Integer number of elements to be transformed in the first
dimension of the two-dimensional complex array C. The value
of L must be less than or equal to that of LDIM. The
transform is most efficient when L is a product of small
primes.
M Integer number of elements to be transformed in the second
dimension of the two-dimensional complex array C. The
transform is most efficient when M is a product of small
primes.
C Complex array of two dimensions containing the (L,M) subarray
to be transformed. C's first dimension is LDIM, its second
dimension must be at least M.
WSAVE Real work array with dimension LENSAV. WSAVE's contents
must be initialized with a call to subroutine CFFT2I before
the first call to routine CFFT2F or CFFT2B with transform
lengths L and M. WSAVE's contents may be re-used for
subsequent calls to CFFT2F and CFFT2B having those same
transform lengths.
LENSAV Integer dimension of WSAVE array. LENSAV must be at least
2*(L+M) + INT(LOG(REAL(L))/LOG(2.)) + INT(LOG(REAL(M))/LOG(2.)) + 8.
WORK Real work array.
LENWRK Integer dimension of WORK array. LENWRK must be at least
2*L*M.
*/
static void cfft2f (const Int& ldim, const Int& L, const Int& M, Complex*& C, Float*& WSAVE, const Int& LENSAV,
Float *& WORK, const Int& LENWRK, Int& IER);
// </group>
// cfftb computes the backward complex discrete Fourier
// transform (the Fourier synthesis). Equivalently, cfftb computes
// a complex periodic sequence from its Fourier coefficients.
// The transform is defined below with output parameter c.
//
// A call of cfftf followed by a call of cfftb will multiply the
// sequence by n.
//
// The array wsave which is used by <src>cfftb</src> must be
// initialized by calling <src>cffti(n,wsave)</src>.
//
// Input parameters:
// <dl compact>
// <dt><b>n</b>
// <dd> The length of the complex sequence c. The method is
// more efficient when n is the product of small primes.
// <dt><b>c</b>
// <dd> A complex array of length n which contains the sequence to be
// transformed.
// <dt><b>wsave</b>
// <dd> A real work array which must be dimensioned at least 4n+15
// in the program that calls cfftb. The wsave array must be
// initialized by calling <src>cffti(n,wsave)</src>
// and a different wsave array must be used for each different
// value of n. This initialization does not have to be
// repeated so long as n remains unchanged thus subsequent
// transforms can be obtained faster than the first.
// The same wsave array can be used by cfftf and cfftb.
// </dl>
// Output parameters:
// <dl compact>
// <dt><b>c</b>
// <dd> for j=1,...,n<br>
// c(j)=the sum from k=1,...,n of<br>
// c(k)*exp(i*(j-1)*(k-1)*2*pi/n)<br>
// <dt><b>wsave</b>
// <dd> Contains initialization calculations which must not be
// destroyed between calls of cfftf or cfftb
// </dl>
// <group>
static void cfftb(Int n, Complex* c, Float* wsave);
static void cfftb(Int n, DComplex* c, Double* wsave);
//Documentation from FFTPack 5.1
/*
Input Arguments
LDIM Integer first dimension of two-dimensional complex array C.
L Integer number of elements to be transformed in the first
dimension of the two-dimensional complex array C. The value
of L must be less than or equal to that of LDIM. The
transform is most efficient when L is a product of small
primes.
M Integer number of elements to be transformed in the second
dimension of the two-dimensional complex array C. The
transform is most efficient when M is a product of small
primes.
C Complex array of two dimensions containing the (L,M) subarray
to be transformed. C's first dimension is LDIM, its second
dimension must be at least M.
WSAVE Real work array with dimension LENSAV. WSAVE's contents
must be initialized with a call to subroutine CFFT2I before
the first call to routine CFFT2F or CFFT2B with transform
lengths L and M. WSAVE's contents may be re-used for
subsequent calls to CFFT2F and CFFT2B with the same
transform lengths L and M.
LENSAV Integer dimension of WSAVE array. LENSAV must be at least
2*(L+M) + INT(LOG(REAL(L))/LOG(2.)) + INT(LOG(REAL(M))/LOG(2.)) + 8.
WORK Real work array.
LENWRK Integer dimension of WORK array. LENWRK must be at least
2*L*M.
Output Arguments
C Complex output array. For purposes of exposition,
assume the index ranges of array C are defined by
C(0:L-1,0:M-1).
For I=0,...,L-1 and J=0,...,M-1, the C(I,J)'s are given
in the traditional aliased form by
L-1 M-1
C(I,J) = SUM SUM C(L1,M1)*
L1=0 M1=0
EXP(SQRT(-1)*2*PI*(I*L1/L + J*M1/M))
And in unaliased form, the C(I,J)'s are given by
LF MF
C(I,J) = SUM SUM C(L1,M1,K1)*
L1=LS M1=MS
EXP(SQRT(-1)*2*PI*(I*L1/L + J*M1/M))
where
LS= -L/2 and LF=L/2-1 if L is even;
LS=-(L-1)/2 and LF=(L-1)/2 if L is odd;
MS= -M/2 and MF=M/2-1 if M is even;
MS=-(M-1)/2 and MF=(M-1)/2 if M is odd;
and
C(L1,M1) = C(L1+L,M1) if L1 is zero or negative;
C(L1,M1) = C(L1,M1+M) if M1 is zero or negative;
The two forms give different results when used to
interpolate between elements of the sequence.
IER Integer error return
= 0 successful exit
= 2 input parameter LENSAV not big enough
= 3 input parameter LENWRK not big enough
= 5 input parameter L > LDIM
= 20 input error returned by lower level routine
*/
static void cfft2b (const Int& LDIM, const Int& L, const Int& M, Complex* & C, Float *& WSAVE, const Int& LENSAV,
Float*& WORK, const Int& LENWRK, Int& IER);
// </group>
// rffti initializes the array wsave which is used in both <src>rfftf</src> and
// <src>rfftb</src>. The prime factorization of n together with a tabulation of
// the trigonometric functions are computed and stored in wsave.
//
// Input parameter:
// <dl compact>
// <dt><b>n</b>
// <dd> The length of the sequence to be transformed.
// </dl>
// Output parameter:
// <dl compact>
// <dt><b>wsave</b>
// <dd> A work array which must be dimensioned at least 2*n+15.
// The same work array can be used for both rfftf and rfftb
// as long as n remains unchanged. Different wsave arrays
// are required for different values of n. The contents of
// wsave must not be changed between calls of rfftf or rfftb.
// </dl>
// <group>
static void rffti(Int n, Float* wsave);
static void rffti(Int n, Double* wsave);
// </group>
// rfftf computes the Fourier coefficients of a real perodic sequence (Fourier
// analysis). The transform is defined below at output parameter r.
//
// Input parameters:
// <dl compact>
// <dt><b>n</b>
// <dd> The length of the array r to be transformed. The method
// is most efficient when n is a product of small primes.
// n may change so long as different work arrays are provided
// <dt><b>r</b>
// <dd> A real array of length n which contains the sequence
// to be transformed
// <dt><b>wsave</b>
// <dd> A work array which must be dimensioned at least 2*n+15
// in the program that calls rfftf. The wsave array must be
// initialized by calling <src>rffti(n,wsave)</src> and a
// different wsave array must be used for each different
// value of n. This initialization does not have to be
// repeated so long as n remains unchanged thus subsequent
// transforms can be obtained faster than the first.
// The same wsave array can be used by rfftf and rfftb.
// </dl>
// output parameters
// <dl compact>
// <dt><b>r</b>
// <dd> r(1) = the sum from i=1 to i=n of r(i)<br>
// if n is even set l = n/2 , if n is odd set l = (n+1)/2<br>
// then for k = 2,...,l<br>
// r(2*k-2) = the sum from i = 1 to i = n of<br>
// r(i)*cos((k-1)*(i-1)*2*pi/n)<br>
// r(2*k-1) = the sum from i = 1 to i = n of<br>
// -r(i)*sin((k-1)*(i-1)*2*pi/n)<br>
// if n is even<br>
// r(n) = the sum from i = 1 to i = n of<br>
// (-1)**(i-1)*r(i)<br>
//
// note:
// this transform is unnormalized since a call of rfftf
// followed by a call of rfftb will multiply the input
// sequence by n.
// <dt><b>wsave</b>
// <dd> Contains results which must not be destroyed between
// calls of rfftf or rfftb.
// </dl>
// <group>
static void rfftf(Int n, Float* r, Float* wsave);
static void rfftf(Int n, Double* r, Double* wsave);
// </group>
// rfftb computes the real perodic sequence from its Fourier coefficients
// (Fourier synthesis). The transform is defined below at output parameter r.
//
// Input parameters:
// <dl compact>
// <dt><b>n</b>
// <dd> The length of the array r to be transformed. The method
// is most efficient when n is a product of small primes.
// n may change so long as different work arrays are provided
// <dt><b>r</b>
// <dd> A real array of length n which contains the sequence
// to be transformed
// <dt><b>wsave</b>
// <dd> A work array which must be dimensioned at least 2*n+15
// in the program that calls rfftb. The wsave array must be
// initialized by calling <src>rffti(n,wsave)</src> and a
// different wsave array must be used for each different
// value of n. This initialization does not have to be
// repeated so long as n remains unchanged thus subsequent
// transforms can be obtained faster than the first.
// The same wsave array can be used by rfftf and rfftb.
// </dl>
// Output parameters:
// <dl compact>
// <dt><b>r</b>
// <dd> for n even and for i = 1,...,n<br>
// r(i) = r(1)+(-1)**(i-1)*r(n)<br>
// plus the sum from k=2 to k=n/2 of<br>
// 2.*r(2*k-2)*cos((k-1)*(i-1)*2*pi/n)<br>
// -2.*r(2*k-1)*sin((k-1)*(i-1)*2*pi/n)<br>
// for n odd and for i = 1,...,n<br>
// r(i) = r(1) plus the sum from k=2 to k=(n+1)/2 of<br>
// 2.*r(2*k-2)*cos((k-1)*(i-1)*2*pi/n)<br>
// -2.*r(2*k-1)*sin((k-1)*(i-1)*2*pi/n)<br>
//
// note:
// this transform is unnormalized since a call of rfftf
// followed by a call of rfftb will multiply the input
// sequence by n.
// <dt><b>wsave</b>
// <dd> Contains results which must not be destroyed between
// calls of rfftb or rfftf.
// </dl>
// <group>
static void rfftb(Int n, Float* r, Float* wsave);
static void rfftb(Int n, Double* r, Double* wsave);
// </group>
// ezffti initializes the array wsave which is used in both <src>ezfftf</src>
// and <src>ezfftb</src>. The prime factorization of n together with a
// tabulation of the trigonometric functions are computed and stored in wsave.
//
// Input parameter:
// <dl compact>
// <dt><b>n</b>
// <dd> The length of the sequence to be transformed.
// </dl>
// Output parameter:
// <dl compact>
// <dt><b>wsave</b>
// <dd> A work array which must be dimensioned at least 3*n+15.
// The same work array can be used for both ezfftf and ezfftb
// as long as n remains unchanged. Different wsave arrays
// are required for different values of n.
// </dl>
static void ezffti(Int n, Float* wsave);
// ezfftf computes the Fourier coefficients of a real
// perodic sequence (Fourier analysis). The transform is defined
// below at output parameters azero, a and b. ezfftf is a simplified
// but slower version of rfftf.
//
// Input parameters:
// <dl compact>
// <dt><b>n</b>
// <dd> The length of the array r to be transformed. The method
// is most efficient when n is the product of small primes.
// <dt><b>r</b>
// <dd> A real array of length n which contains the sequence
// to be transformed. r is not destroyed.
// <dt><b>wsave</b>
// <dd> A work array which must be dimensioned at least 3*n+15
// in the program that calls ezfftf. The wsave array must be
// initialized by calling <src>ezffti(n,wsave)</src> and a
// different wsave array must be used for each different
// value of n. This initialization does not have to be
// repeated so long as n remains unchanged thus subsequent
// transforms can be obtained faster than the first.
// The same wsave array can be used by ezfftf and ezfftb.
// </dl>
// Output parameters:
// <dl compact>
// <dt><b>azero</b>
// <dd> The sum from i=1 to i=n of r(i)/n
// <dt><b>a,b</b>
// <dd> Real arrays of length n/2 (n even) or (n-1)/2 (n odd)<br>
// for n even<br>
// b(n/2)=0, and <br>
// a(n/2) is the sum from i=1 to i=n of (-1)**(i-1)*r(i)/n<br>
//
// for n even define kmax=n/2-1<br>
// for n odd define kmax=(n-1)/2<br>
// then for k=1,...,kmax<br>
// a(k) equals the sum from i=1 to i=n of<br>
// 2./n*r(i)*cos(k*(i-1)*2*pi/n)<br>
// b(k) equals the sum from i=1 to i=n of<br>
// 2./n*r(i)*sin(k*(i-1)*2*pi/n)<br>
// </dl>
static void ezfftf(Int n, Float* r, Float* azero, Float* a, Float* b,
Float* wsave);
// ezfftb computes a real perodic sequence from its
// Fourier coefficients (Fourier synthesis). The transform is
// defined below at output parameter r. ezfftb is a simplified
// but slower version of rfftb.
//
// Input parameters:
// <dl compact>
// <dt><b>n</b>
// <dd> The length of the output array r. The method is most
// efficient when n is the product of small primes.
// <dt><b>azero</b>
// <dd> The constant Fourier coefficient
// <dt><b>a,b</b>
// <dd> Arrays which contain the remaining Fourier coefficients
// these arrays are not destroyed.
// The length of these arrays depends on whether n is even or
// odd.
// If n is even n/2 locations are required,
// if n is odd (n-1)/2 locations are required.
// <dt><b>wsave</b>
// <dd> A work array which must be dimensioned at least 3*n+15.
// in the program that calls ezfftb. The wsave array must be
// initialized by calling <src>ezffti(n,wsave)</src> and a
// different wsave array must be used for each different
// value of n. This initialization does not have to be
// repeated so long as n remains unchanged thus subsequent
// transforms can be obtained faster than the first.
// The same wsave array can be used by ezfftf and ezfftb.
// </dl>
// Output parameters:
// <dl compact>
// <dt><b>r</b>
// <dd> if n is even define kmax=n/2<br>
// if n is odd define kmax=(n-1)/2<br>
// then for i=1,...,n<br>
// r(i)=azero plus the sum from k=1 to k=kmax of<br>
// a(k)*cos(k*(i-1)*2*pi/n)+b(k)*sin(k*(i-1)*2*pi/n)<br>
// where<br>
// c(k) = .5*cmplx(a(k),-b(k)) for k=1,...,kmax<br>
// c(-k) = conjg(c(k))<br>
// c(0) = azero<br>
// and i=sqrt(-1)<br>
// </dl>
static void ezfftb(Int n, Float* r, Float* azero, Float* a, Float* b,
Float* wsave);
// sinti initializes the array wsave which is used in
// <src>sint</src>. The prime factorization of n together with a tabulation of
// the trigonometric functions are computed and stored in wsave.
//
// Input parameter:
// <dl compact>
// <dt><b>n</b>
// <dd> The length of the sequence to be transformed. the method
// is most efficient when n+1 is a product of small primes.
// </dl>
// Output parameter:
// <dl compact>
// <dt><b>wsave</b>
// <dd> A work array with at least int(2.5*n+15) locations.
// Different wsave arrays are required for different values
// of n. The contents of wsave must not be changed between
// calls of sint.
// </dl>
// <group>
static void sinti(Int n, Float* wsave);
static void sinti(Int n, Double* wsave);
// </group>
// sint computes the discrete Fourier sine transform
// of an odd sequence x(i). The transform is defined below at
// output parameter x.
// sint is the unnormalized inverse of itself since a call of sint
// followed by another call of sint will multiply the input sequence
// x by 2*(n+1).
// The array wsave which is used by sint must be
// initialized by calling <src>sinti(n,wsave)</src>.
//
// Input parameters:
// <dl compact>
// <dt><b>n</b>
// <dd> The length of the sequence to be transformed. The method
// is most efficient when n+1 is the product of small primes.
// <dt><b>x</b>
// <dd> An array which contains the sequence to be transformed
// <dt><b>wsave</b>
// <dd> A work array with dimension at least int(2.5*n+15)
// in the program that calls sint. The wsave array must be
// initialized by calling <src>sinti(n,wsave)</src> and a
// different wsave array must be used for each different
// value of n. This initialization does not have to be
// repeated so long as n remains unchanged thus subsequent
// transforms can be obtained faster than the first.
// </dl>
// Output parameters:
// <dl compact>
// <dt><b>x</b>
// <dd> for i=1,...,n<br>
// x(i) = the sum from k=1 to k=n<br>
// 2*x(k)*sin(k*i*pi/(n+1))<br>
//
// a call of sint followed by another call of
// sint will multiply the sequence x by 2*(n+1).
// Hence sint is the unnormalized inverse
// of itself.
//
// <dt><b>wsave</b>
// <dd> Contains initialization calculations which must not be
// destroyed between calls of sint.
// </dl>
// <group>
static void sint(Int n, Float* x, Float* wsave);
static void sint(Int n, Double* x, Double* wsave);
// </group>
// costi initializes the array wsave which is used in
// <src>cost</src>. The prime factorization of n together with a tabulation of
// the trigonometric functions are computed and stored in wsave.
//
// Input parameter:
// <dl compact>
// <dt><b>n</b>
// <dd> The length of the sequence to be transformed. The method
// is most efficient when n-1 is a product of small primes.
// </dl>
// Output parameter:
// <dl compact>
// <dt><b>wsave</b>
// <dd> A work array which must be dimensioned at least 3*n+15.
// Different wsave arrays are required for different values
// of n. The contents of wsave must not be changed between
// calls of cost.
// </dl>
// <group>
static void costi(Int n, Float* wsave);
static void costi(Int n, Double* wsave);
// </group>
// cost computes the discrete Fourier cosine transform
// of an even sequence x(i). The transform is defined below at output
// parameter x.
// cost is the unnormalized inverse of itself since a call of cost
// followed by another call of cost will multiply the input sequence
// x by 2*(n-1). The transform is defined below at output parameter x.
// The array wsave which is used by <src>cost</src> must be
// initialized by calling <src>costi(n,wsave)</src>.
//
// Input parameters:
// <dl compact>
// <dt><b>n</b>
// <dd> The length of the sequence x. n must be greater than 1.
// The method is most efficient when n-1 is a product of
// small primes.
// <dt><b>x</b>
// <dd> An array which contains the sequence to be transformed
// <dt><b>wsave</b>
// <dd> A work array which must be dimensioned at least 3*n+15
// in the program that calls cost. The wsave array must be
// initialized by calling <src>costi(n,wsave)</src> and a
// different wsave array must be used for each different
// value of n. This initialization does not have to be
// repeated so long as n remains unchanged thus subsequent
// transforms can be obtained faster than the first.
// </dl>
// Output parameters:
// <dl compact>
// <dt><b>x</b>
// <dd> for i=1,...,n<br>
// x(i) = x(1)+(-1)**(i-1)*x(n)<br>
// + the sum from k=2 to k=n-1<br>
// 2*x(k)*cos((k-1)*(i-1)*pi/(n-1))<br>
//
// a call of cost followed by another call of
// cost will multiply the sequence x by 2*(n-1)
// hence cost is the unnormalized inverse
// of itself.
// <dt><b>wsave</b>
// <dd> Contains initialization calculations which must not be
// destroyed between calls of cost.
// </dl>
// <group>
static void cost(Int n, Float* x, Float* wsave);
static void cost(Int n, Double* x, Double* wsave);
// </group>
// sinqi initializes the array wsave which is used in both <src>sinqf</src> and
// <src>sinqb</src>. The prime factorization of n together with a tabulation of
// the trigonometric functions are computed and stored in wsave.
//
// Input parameter:
// <dl compact>
// <dt><b>n</b>
// <dd> The length of the sequence to be transformed. The method
// is most efficient when n is a product of small primes.
// </dl>
// Output parameter:
// <dl compact>
// <dt><b>wsave</b>
// <dd> A work array which must be dimensioned at least 3*n+15.
// The same work array can be used for both sinqf and sinqb
// as long as n remains unchanged. Different wsave arrays
// are required for different values of n. The contents of
// wsave must not be changed between calls of sinqf or sinqb.
// </dl>
// <group>
static void sinqi(Int n, Float* wsave);
static void sinqi(Int n, Double* wsave);
// </group>
// sinqf computes the fast Fourier transform of quarter wave data. That is,
// sinqf computes the coefficients in a sine series representation with only
// odd wave numbers. The transform is defined below at output parameter x.
//
// sinqb is the unnormalized inverse of sinqf since a call of sinqf followed by
// a call of sinqb will multiply the input sequence x by 4*n.
//
// The array wsave which is used by sinqf must be initialized by calling
// <src>sinqi(n,wsave)</src>.
//
// Input parameters:
// <dl compact>
// <dt><b>n</b>
// <dd> The length of the array x to be transformed. The method
// is most efficient when n is a product of small primes.
// <dt><b>x</b>
// <dd> An array which contains the sequence to be transformed
// <dt><b>wsave</b>
// A work array which must be dimensioned at least 3*n+15.
// in the program that calls sinqf. The wsave array must be
// initialized by calling <src>sinqi(n,wsave)</src> and a
// different wsave array must be used for each different
// value of n. This initialization does not have to be
// repeated so long as n remains unchanged thus subsequent
// transforms can be obtained faster than the first.
// </dl>
// Output parameters:
// <dl compact>
// <dt><b>x</b>
// <dd> for i=1,...,n<br>
// x(i) = (-1)**(i-1)*x(n)<br>
// + the sum from k=1 to k=n-1 of<br>
// 2*x(k)*sin((2*i-1)*k*pi/(2*n))<br>
//
// a call of sinqf followed by a call of
// sinqb will multiply the sequence x by 4*n.
// therefore sinqb is the unnormalized inverse
// of sinqf.
// <dt><b>wsave </b>
// <dd> Contains initialization calculations which must not
// be destroyed between calls of sinqf or sinqb.
// </dl>
// <group>
static void sinqf(Int n, Float* x, Float* wsave);
static void sinqf(Int n, Double* x, Double* wsave);
// </group>
// sinqb computes the fast Fourier transform of quarter
// wave data. that is, sinqb computes a sequence from its
// representation in terms of a sine series with odd wave numbers.
// the transform is defined below at output parameter x.
//
// sinqf is the unnormalized inverse of sinqb since a call of sinqb
// followed by a call of sinqf will multiply the input sequence x
// by 4*n.
//
// The array wsave which is used by <src>sinqb</src> must be
// initialized by calling <src>sinqi(n,wsave)</src>.
//
// Input parameters:
// <dl compact>
// <dt><b>n</b>
// <dd> The length of the array x to be transformed. The method
// is most efficient when n is a product of small primes.
// <dt><b>x</b>
// <dd> An array which contains the sequence to be transformed
// <dt><b>wsave</b>
// A work array which must be dimensioned at least 3*n+15.
// in the program that calls sinqb. The wsave array must be
// initialized by calling <src>sinqi(n,wsave)</src> and a
// different wsave array must be used for each different
// value of n. This initialization does not have to be
// repeated so long as n remains unchanged thus subsequent
// transforms can be obtained faster than the first.
// </dl>
// Output parameters:
// <dl compact>
// <dt><b>x</b>
// <dd> for i=1,...,n<br>
// x(i)= the sum from k=1 to k=n of<br>
// 4*x(k)*sin((2k-1)*i*pi/(2*n))<br>
//
// a call of sinqb followed by a call of
// sinqf will multiply the sequence x by 4*n.
// Therefore sinqf is the unnormalized inverse
// of sinqb.
// <dt><b>wsave</b>
// <dd> Contains initialization calculations which must not
// be destroyed between calls of sinqb or sinqf.
// </dl>
// <group>
static void sinqb(Int n, Float* x, Float* wsave);
static void sinqb(Int n, Double* x, Double* wsave);
// </group>
// <group>
static void cosqi(Int n, Float* wsave);
static void cosqi(Int n, Double* wsave);
// </group>
// <group>
static void cosqf(Int n, Float* x, Float* wsave);
static void cosqf(Int n, Double* x, Double* wsave);
// </group>
// <group>
static void cosqb(Int n, Float* x, Float* wsave);
static void cosqb(Int n, Double* x, Double* wsave);
// </group>
};
} //# NAMESPACE CASACORE - END
#endif
|