Raise the power of polynomials in polyjump

Hi, I’m writing an SOS model using PolyJump:

@polyvar B[1:k,1:pp+1] 
@polyvar c0
k = transpose(p_train_var)*vec(B*vcat(x_train0[1,:],1))*gamma + c0

when I try to raise the power of polynomial k, by doing this:


I got:

MethodError: no method matching ^(::Array{Polynomial{true,Float64},1}, ::Int64)
Closest candidates are:
  ^(!Matched::Float16, ::Integer) at math.jl:862
  ^(!Matched::Regex, ::Integer) at regex.jl:712
  ^(!Matched::Missing, ::Integer) at missing.jl:151

 [1] macro expansion at ./none:0 [inlined]
 [2] literal_pow(::typeof(^), ::Array{Polynomial{true,Float64},1}, ::Val{2}) at ./none:0
 [3] top-level scope at In[107]:1

What should I do if I want to use a polynomial that takes the format of k^2 in my JuMP model?
Thanks for your help in advance!

I figured it out. It was a very stupid mistake. It should be
instead of

1 Like