Perona Malik Noise Estimator using Canny

In Perona and Malik, they state:

a histogram of the absolute values of the gradient throughout the
image was computed, and K was set equal to the 90% value of its

My interpretation of this is to take the 90%ile of the distribution of magnitude of gradients. This interpretation however differs from the implementation here which seems to do a double cumulative sum.