jump-dev / SumOfSquares.jl

Sum of Squares Programming for Julia
Other
114 stars 24 forks source link

SymbolicWedderburn v0.3 -> v0.4 #341

Closed blegat closed 4 days ago

blegat commented 5 months ago

Closes https://github.com/jump-dev/SumOfSquares.jl/pull/352

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (c4f7e9a) 85.10% compared to head (d33d510) 85.32%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #341 +/- ## ========================================== + Coverage 85.10% 85.32% +0.22% ========================================== Files 41 41 Lines 2222 2222 ========================================== + Hits 1891 1896 +5 + Misses 331 326 -5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

kalmarek commented 4 months ago

@blegat how to turn MonomialBasis{Monomial{DynamicPolynomials.Commutative{DynamicPolynomials.CreationOrder}, Graded{LexOrder}}, MonomialVector{DynamicPolynomials.Commutative{DynamicPolynomials.CreationOrder}, Graded{LexOrder}}} into an actual vector?

kalmarek commented 4 months ago

also something is rather odd here:

    basis = SumOfSquares.Certificate.gram_basis(cert.certificate, poly)
    @info eltype(basis)

shows Any ?

blegat commented 4 months ago

Maybe we could define eltype I think I didn't do it since it's not an AbstractVector. By the way, an StarAlgebras.AbstractBasis is also not an AbstractVector so probably that will remain the case right ?

julia> basis = MonomialBasis(monomials([x, y], 2))
MonomialBasis([y², xy, x²])

julia> generators(basis)
3-element MonomialVector{DynamicPolynomials.Commutative{DynamicPolynomials.CreationOrder}, Graded{LexOrder}}:
 y²
 xy
 x²

julia> generators(basis) isa AbstractVector
true

julia> eltype(generators(basis))
Monomial{DynamicPolynomials.Commutative{DynamicPolynomials.CreationOrder}, Graded{LexOrder}}

You could also let me know the API you need the basis to implement and we could make sure StarAlgebra.AbstractBasis subtypes such as MonomialBasis do implement it.

kalmarek commented 4 months ago

at the moment it's enough for basis to get an honest vector that's it.

We'll overhaul the whole thing in the near future, so there's no need to define the API for the old version, right?

blegat commented 4 months ago

No, no need, this PR can sit here and wait for StarAlgebras

blegat commented 4 days ago

I bumped in https://github.com/jump-dev/SumOfSquares.jl/pull/355 even if it's not working but I'll wait for https://github.com/kalmarek/SymbolicWedderburn.jl/issues/79