Linear implementation of DFT calculations (CPU and GPU)