Generalizing the discrete fourier transform