XLPack 6.1
C/C++ API Reference Manual
Loading...
Searching...
No Matches

◆ _costmf()

void _costmf ( int  lot,
int  jump,
int  n,
int  inc,
double  r[],
int  lr,
double  wsave[],
int  lwsave,
double  work[],
int  lwork,
int *  info 
)

One-dimensional cosine transform (multiple sequences)

Purpose
costmf computes the one-dimensional Fourier transform of multiple even sequences within a real array. This is referred to as the forward transform or Fourier analysis, transforming the sequence from physical to spectral space.
r[l*jump] = (1/2)r[l*jump]/(n-1) + Σr[l*jump+j]/(n-1) + (1/2)r[l*jump+n-1]/(n-1) (Σ for j = 1 to n-2) (l = 0 to lot-1)
r[l*jump+k] = r[l*jump]/(n-1) + Σ2r[l*jump+j]cos(πjk/(n-1))/(n-1) + (-1)^k r[l*jump+n-1]/(n-1) (Σ for j = 1 to n-2) (l = 0 to lot-1, k = 1 to n-2)
r[l*jump+n-1] = (1/2)r[l*jump]/(n-1) + Σr[l*jump+j](-1)^k/(n-1) + (1/2)(-1)^(n-1) r[l*jump+n-1]/(n-1) (Σ for j = 1 to n-2) (l = 0 to lot-1)
This transform is normalized since a call to costmf followed by a call to costmb (or vice-versa) reproduces the original array subject to algorithmic constraints, roundoff error, etc.
Parameters
[in]lotThe number of sequences to be transformed. (lot >= 1)
[in]jumpIncrement between the locations, in array r[], of the first elements of two consecutive sequences to be transformed. (jump >= 1)
[in]nThe length of the sequence to be transformed. (n >= 1)
The transform is most efficient when n-1 is a product of small primes.
[in]incInteger 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 sequences of data.
[in]lrThe length of the array r[]. (lr >= (lot - 1)*jump + inc*(n - 1) + 1)
[in]wsave[]Array wsave[lwsave]
Work data. Its contents must be initialized with a call to costmi before the first call to costmf or costmb for a given transform length n.
[in]lwsaveThe length of the array wsave[]. (lwsave >= 2*n + ln(n)/ln(2) + 4)
[out]work[]Array work[lwork]
Work array.
[in]lworkThe length of the array work[]. (lwork >= lot*(n + 1))
[out]info= 0: Successful exit
= -1: The argument lot had an illegal value (lot < 1)
= -2: The argument jump had an illegal value (jump < 1)
= -3: The argument n had an illegal value (n < 1)
= -4: The argument inc had an illegal value (inc < 1)
= -6: The argument lr had an illegal value (lr not big enough)
= -8: The argument lwsave had an illegal value (lwsave not big enough)
= -10: The argument lwork had an illegal value (lwork not big enough)
Reference
FFTPACK 5.1