Thanks for the fun package! I really love how you are using R for so many non-statistical and discrete mathematics applications!
I have been looking at your durfee function since I have created a new algorithm that efficiently computes the side length of a Durfee square with linear time complexity. I had done it for computing the Eddington number, which is the same thing but in the context of cycling. I had additional performance needs unique to its application in cycling which necessitated the innovation.
While I was reading through the current code, I noticed that it does not do bounds checking. So you can overrun a column and continue on into the next column in some cases. For example, if you have a matrix as described below, the function will produce erroneous results.
# This should produce c(3L, 3L, 3L)
durfee(matrix(rep(9, 9), nrow = 3))
## [1] 9 6 3
I have a bugfix ready but am just logging this in an issue to give context when the PR comes in.
Hello @RobinHankin,
Thanks for the fun package! I really love how you are using R for so many non-statistical and discrete mathematics applications!
I have been looking at your
durfee
function since I have created a new algorithm that efficiently computes the side length of a Durfee square with linear time complexity. I had done it for computing the Eddington number, which is the same thing but in the context of cycling. I had additional performance needs unique to its application in cycling which necessitated the innovation.While I was reading through the current code, I noticed that it does not do bounds checking. So you can overrun a column and continue on into the next column in some cases. For example, if you have a matrix as described below, the function will produce erroneous results.
I have a bugfix ready but am just logging this in an issue to give context when the PR comes in.