A ray tracing algorithm using the discrete prolate spheroidal subspace