Hi All,
I’m getting a type instability in a generated function I’ve written to perform Clenshaw’s recursion on multivariate Chebyshev polynomials. Here is a Gist containing a minimum working example: https://gist.github.com/RJDennis/81b7d62f12878a14ef1a07a3d7b4a2e9
The type instability is in p which is an Array, but assigned type Any. Suggestions on how to eliminate this type instability would be most welcome.
Thanks,
Richard
Try Base.tail instead of 2:N
Quite why that works where 2:N doesn’t is a bit of a mystery, but it works so thank you.
tshort
August 25, 2017, 12:50pm
5
I’m also curious why that works.
Also, Dennis, I looked at the code from your generated function (by leaving off the @generated
), and you might want to look at the order of the loops. I don’t think they are the best order for Julia’s column-major ordered arrays.
Because the size of the tuple is unknown when you are indexing with a general unit range.