@polyvar does not allow two-dimensional variables

I want define a polyvar with size 2*3. Several weeks ago, the following code works

using TypedPolynomials
@polyvar B[1:2,1:3] 

But now I get this error:

Unsupported syntax. Expected x[a:b] for literal integers a and b

It only allows something like this: @polyvar B[1:2]. I wonder if anyone can help me with this? How can I define a matrix-sized polyvar? It is kind of important for me because I need to do matrix multiplication with the polyvar. Thanks in advance!

This is possible with DynamicPolynomials but not yet with TypedPolynomials.
The reason for this is that different variables have different types for TypedPolynomials so the @polyvar macro returns a tuple. In DynamicPolynomials, all variables have the same type so th macro returns an Array.

1 Like