|
|
◆ cost1f()
| void cost1f |
( |
int |
n, |
|
|
int |
inc, |
|
|
double |
r[], |
|
|
int |
lr, |
|
|
double |
wsave[], |
|
|
int |
lwsave, |
|
|
double |
work[], |
|
|
int |
lwork, |
|
|
int * |
info |
|
) |
| |
One-dimensional cosine transform
- Purpose
- cost1f computes the one-dimensional Fourier transform of an even sequence within a real array. This is referred to as the forward transform or Fourier analysis, transforming the sequence from physical to spectral space.
r[0] = (1/2)r[0]/(n-1) + Σr[j]/(n-1) + (1/2)r[n-1]/(n-1) (Σ for j = 1 to n-2)
r[k] = r[0]/(n-1) + Σ2r[j]cos(πjk/(n-1))/(n-1) + (-1)^k r[n-1]/(n-1) (Σ for j = 1 to n-2) (k = 1 to n-2)
r[n-1] = (1/2)r[0]/(n-1) + Σr[j](-1)^k/(n-1) + (1/2)(-1)^(n-1) r[n-1]/(n-1) (Σ for j = 1 to n-2)
This transform is normalized since a call to cost1f followed by a call to cost1b (or vice-versa) reproduces the original array subject to algorithmic constraints, roundoff error, etc.
- Parameters
-
| [in] | n | The length of the sequence to be transformed. (n >= 1)
The transform is most efficient when n-1 is a product of small primes. |
| [in] | inc | Integer increment between the locations, in array r[], of two consecutive elements within the sequence. (inc >= 1) |
| [in,out] | r[] | Array r[lr]
[in] The sequence to be transformed.
[out] The Fourier forward transformed sequence of data. |
| [in] | lr | The length of the array r[]. (lr >= inc*(n - 1) + 1) |
| [in] | wsave[] | Array wsave[lwsave]
Work data. Its contents must be initialized with a call to cost1i before the first call to cost1f or cost1b for a given transform length n. |
| [in] | lwsave | The length of the array wsave[]. (lwsave >= n/2 + n + ln(n)/ln(2) + 4) |
| [out] | work[] | Array work[lwork]
Work array. |
| [in] | lwork | The length of the array work[]. (lwork >= n - 1) |
| [out] | info | = 0: Successful exit
= -1: The argument n had an illegal value (n < 1)
= -2: The argument inc had an illegal value (inc < 1)
= -4: The argument lr had an illegal value (lr not big enough)
= -6: The argument lwsave had an illegal value (lwsave not big enough)
= -8: The argument lwork had an illegal value (lwork not big enough) |
- Reference
- FFTPACK 5.1
|