Faster C implementation of fprop and bprop for spaghetti