code works, but speedup was small.
maybe it is an array ordering issue? c vs f