first working cudamat code for ffnets