Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use monomials with InverseLexOrder #138

Closed
FriesischScott opened this issue Jul 20, 2023 · 3 comments · Fixed by #159
Closed

Can't use monomials with InverseLexOrder #138

FriesischScott opened this issue Jul 20, 2023 · 3 comments · Fixed by #159

Comments

@FriesischScott
Copy link

FriesischScott commented Jul 20, 2023

I'm trying to obtain monomials in graded inverse lexicographic order. However, this doesn't seem to work with the monomials function. Running

x = @polyvar x[1:2] monomial_order = Graded{InverseLexOrder}
monomials(x[1], 0:2)

fails with

ERROR: AssertionError: issorted(Z, lt = _isless)
Stacktrace:
 [1] getZfordegs(n::Int64, degs::UnitRange{Int64}, #unused#::Type{DynamicPolynomials.Commutative}, #unused#::Type{Graded{InverseLexOrder}}, filter::Function)
   @ DynamicPolynomials C:\Users\behrensd\.julia\packages\DynamicPolynomials\W9SrI\src\monomial_vector.jl:194
 [2] MonomialVector(vars::Vector{Variable{DynamicPolynomials.Commutative{DynamicPolynomials.CreationOrder}, Graded{InverseLexOrder}}}, degs::UnitRange{Int64}, filter::DynamicPolynomials.var"#21#23")
   @ DynamicPolynomials C:\Users\behrensd\.julia\packages\DynamicPolynomials\W9SrI\src\monomial_vector.jl:204
 [3] MonomialVector
   @ C:\Users\behrensd\.julia\packages\DynamicPolynomials\W9SrI\src\monomial_vector.jl:203 [inlined]
 [4] monomials
   @ C:\Users\behrensd\.julia\packages\DynamicPolynomials\W9SrI\src\monomial_vector.jl:245 [inlined]
 [5] monomials(vars::Tuple{Variable{DynamicPolynomials.Commutative{DynamicPolynomials.CreationOrder}, Graded{InverseLexOrder}}, Variable{DynamicPolynomials.Commutative{DynamicPolynomials.CreationOrder}, Graded{InverseLexOrder}}, Variable{DynamicPolynomials.Commutative{DynamicPolynomials.CreationOrder}, Graded{InverseLexOrder}}}, args::UnitRange{Int64})
   @ DynamicPolynomials C:\Users\behrensd\.julia\packages\DynamicPolynomials\W9SrI\src\monomial_vector.jl:248
 [6] top-level scope
   @ REPL[105]:1

Is this a bug or intended behaviour?

There is a separate issue where x = @polyvar x[1:2] returns a Tuple of length 1. The example in the readme of running p = sum(x .* x) does not work. Only as p = sum(x[1] .* x[1]).

@blegat
Copy link
Member

blegat commented Jul 20, 2023

About the README issue, you should do @polyvar x[1:2] without the assignment to x.

@FriesischScott
Copy link
Author

Of course 🤦‍♂️ . Sorry about that.

@blegat
Copy link
Member

blegat commented Jul 21, 2023

Thanks for reporting the bug of monomials. It's a new feature so it's possible that there are still some sharp edges

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants