fix computegradient overflow

throws an exception if MAXKERNELRADIUS is not large enough