Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix deflate_leading_zeros zero polynomial handling There were multiple issues with the deflate_leading_zeros code for the case of a zero polynomial (where all vector elements are zero). The condition (`N == 0`) was wrong, a check for nothingness is needed instead as findfirst, findlast return `nothing` when nothing is found. This resulted in a useless error message from `deflate_leading_zeros` when `roots` was called with a zero polynomial. The second return value, whose definition isn't clear, seems like it was wrong for the zero polynomial case, judging by the fact that it depended on the number of zero coefficients, even though that number is irrelevant if all coefficients are zero. I also changed `zeros(S, 0)` to the simpler `S[]`. Regarding the replaced condition (`N == 0`), note that logically it would have been OK to replace it with either `isnothing(N)` or `isnothing(K)`, but I instead used `isnothing(N) | isnothing(K)` to help Julia with its type inference for the succeeding part of the function. * prevent run time dispatch in deflate_leading_zeros Seems Julia needs a bit of hand-holding here. Checked with development versions of Julia and JET.
- Loading branch information