@Matej_Kompanek wow, you are an angel! On my PC it runs ~4x faster than my unoptimized version. Now I need to decipher this to write the backwards function. Can anyone suggest a good source to learn AVX?
Do you think a similar gain achievable with optimizing the CUDA version?