code to do fast functional reggression