fix computegradient array overflow
Merge pull request #2 from trsaunders/master

fix computegradient overflow