I have some code involving polynomials that I'd like to make generic in dimension. To be precise, consider the following bit of code:
@polyvar x[1:2]
p = sum(x.^2)
#... do some computation involving p
Now say we want to make this generic, ie. have
@polyvar x[1:d]
p = sum(x.^2)
for dimension d, which we may assume known at compile time.
The current macro doesn't authorise that and I'm struggling to find a way around the problem (but my knowledge of metaprogramming in julia is poor). For instance, the following doesn't work:
function test(Z::Val{N}) where N
@polyvar x[1:N]
sum(x.^2)
end
even though N is known at compile time. Is there a workaround?
I have some code involving polynomials that I'd like to make generic in dimension. To be precise, consider the following bit of code:
Now say we want to make this generic, ie. have
for dimension d, which we may assume known at compile time.
The current macro doesn't authorise that and I'm struggling to find a way around the problem (but my knowledge of metaprogramming in julia is poor). For instance, the following doesn't work:
even though N is known at compile time. Is there a workaround?