You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Related to #9, #22.
EDIT: See PR #35 for the implementation of item 1.
EDIT: See PR #38 for the implementation of item 2.
I suggest the following changes, which I argue will bring the interface of the FFTPACK cosine transforms in line with modern terminology, and thus make the interface easier to understand and use. I am certainly willing to implement those changes myself, I just post them here first to gather feedback.
The most common discrete cosine transforms (DCT) are types 1, 2, 3 and 4. Up to a scaling factor, the FFTPACK procedures
dcost and modern dctcorrespond to the DCT type-1 (DCT-I);
dcosqb and modern iqct correspond to DCT type-2 (DCT-II);
dcosqf and modern qctcorrespond to DCT type-3 (DCT-III).
Note also that DCT-I is the unnormalized inverse of itself; while DCT-III is the unnormalized inverse of DCT-II, and conversely. Wikipedia has a nice summary of the definitions of the most common types of DCT.
Because FFTPACK calls the DCT types 2 & 3 transforms quarter-wave transforms, it's difficult for a new user of the library (like me) to find out what they correspond to; the quarter terminology is not in use anymore. This is also why @zoziha in #9 couldn't find their corresponding transforms in scipy.
Based on the above, I propose the following changes.
Combine the modern interfaces dct(x,n) and qct(x,n) under one interface dct(x,n,type) where type=1,2,3 (and similarly for the inverse ones). In this way, dct(x,n,type=1) corresponds to the DCT-I of the input data, and similarly for the others. This is the way the cosine transforms are also handled in scipy.fft. This will have no performance overhead, it's simply combining the two existing interfaces so that they're in line with current terminology.
Create an interface to overload the existing in-place DCT subroutines, so that they can be called with names based on their type. For example, create a subroutine dct_t1 for DCT-I that simply overloads the existing dcost, and similarly for DCT types 2, 3. See comments below for code example; thanks to @zoziha for the suggestion.
Write the definition formulas of the DCTs in LaTeX in the documentation.
These changes will allow us to potentially include more sine/cosine transforms in the future consistently, without having to break the interface later on. They will also allow us to improve the documentation to make it clear what each procedure computes.
I am willing to implement the above and change the documentation and tests accordingly.
We should also change the DST interface in the analogous way in a standalone PR for consistency.
Related to #9, #22.
EDIT: See PR #35 for the implementation of item 1.
EDIT: See PR #38 for the implementation of item 2.
I suggest the following changes, which I argue will bring the interface of the FFTPACK cosine transforms in line with modern terminology, and thus make the interface easier to understand and use. I am certainly willing to implement those changes myself, I just post them here first to gather feedback.
The most common discrete cosine transforms (DCT) are types 1, 2, 3 and 4. Up to a scaling factor, the FFTPACK procedures
dcostand moderndctcorrespond to the DCT type-1 (DCT-I);dcosqband moderniqctcorrespond to DCT type-2 (DCT-II);dcosqfand modernqctcorrespond to DCT type-3 (DCT-III).Note also that DCT-I is the unnormalized inverse of itself; while DCT-III is the unnormalized inverse of DCT-II, and conversely. Wikipedia has a nice summary of the definitions of the most common types of DCT.
Because FFTPACK calls the DCT types 2 & 3 transforms quarter-wave transforms, it's difficult for a new user of the library (like me) to find out what they correspond to; the quarter terminology is not in use anymore. This is also why @zoziha in #9 couldn't find their corresponding transforms in
scipy.Based on the above, I propose the following changes.
dct(x,n)andqct(x,n)under one interfacedct(x,n,type)wheretype=1,2,3(and similarly for the inverse ones). In this way,dct(x,n,type=1)corresponds to the DCT-I of the input data, and similarly for the others. This is the way the cosine transforms are also handled inscipy.fft. This will have no performance overhead, it's simply combining the two existing interfaces so that they're in line with current terminology.dct_t1for DCT-I that simply overloads the existingdcost, and similarly for DCT types 2, 3. See comments below for code example; thanks to @zoziha for the suggestion.These changes will allow us to potentially include more sine/cosine transforms in the future consistently, without having to break the interface later on. They will also allow us to improve the documentation to make it clear what each procedure computes.
I am willing to implement the above and change the documentation and tests accordingly.
We should also change the DST interface in the analogous way in a standalone PR for consistency.