Skip to content

making @polyvar generic in dimension #51

@dahtah

Description

@dahtah

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions