A Discrete Cosine Transform for Real Data

COSINE_TRANSFORM is a C++ library which demonstrates some simple properties of the discrete cosine transform (DCT) for real data.

The code is not optimized in any way, and is intended instead for investigation and education.


The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.


COSINE_TRANSFORM is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version and a Python version.

Related Data and Programs:

FFT_SERIAL, a C++ program which demonstrates the computation of a Fast Fourier Transform, and is intended as a starting point for implementing a parallel version.

HAAR, a C++ library which computes the Haar transform of data.

SFTPACK, a C++ library which implements the "slow" Fourier transform, intended as a teaching tool and comparison with the fast Fourier transform.

SINE_TRANSFORM, a C++ library which implements the discrete sine transform.

WALSH, a C++ library which implements versions of the Walsh and Haar transforms.

WAVELET, a C++ library which does some simple calculations with wavelet transforms;


  1. William Briggs, Van Emden Henson,
    The DFT: An Owner's Manual for the Discrete Fourier Transform,
    SIAM, 1995,
    ISBN13: 978-0-898713-42-8,
    LC: QA403.5.B75.
  2. Eleanor Chu, Alan George,
    Inside the FFT Black Box,
    CRC Press,
    ISBN: 0849302706,
    LC: QA403.5C5.

Source Code:

Examples and Tests:

List of Routines:

You can go up one level to the C++ source codes.

Last modified on 27 August 2015.