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

Allow AbstractVectors as input for initial #4027

Merged
merged 4 commits into from
Aug 20, 2024
Merged

Allow AbstractVectors as input for initial #4027

merged 4 commits into from
Aug 20, 2024

Conversation

YueRen
Copy link
Member

@YueRen YueRen commented Aug 19, 2024

Fixes #4025.

Important because functions such as relative_interior_point return PointVectors, and points on a tropical variety or in a Groebner complex are primary candidates for weight vectors.

Copy link
Member

@benlorenz benlorenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think most of the changes are unneccessary if you would change the relevant signatures (for groebner_basis and initial) to allow w::AbstractVector{...} instead of w::Vector{...}.

What is still needed is the tropical_semiring(nu)(...), otherwise this leads to some promotion error, but that also happens with Vector{QQFieldElem}.

@YueRen
Copy link
Member Author

YueRen commented Aug 19, 2024

I think most of the changes are unneccessary if you would change the relevant signatures (for groebner_basis and initial) to allow w::AbstractVector{...} instead of w::Vector{...}.

What is still needed is the tropical_semiring(nu)(...), otherwise this leads to some promotion error, but that also happens with Vector{QQFieldElem}.

Good point, I've updated the pull request.

@YueRen YueRen force-pushed the yr/initial branch 2 times, most recently from 8b022d0 to 988b607 Compare August 19, 2024 20:19
@benlorenz
Copy link
Member

Somewhat related question that I just noticed while looking at the code here:

if !isnothing(perturbation)
tropTermsEvaluated = [tropical_semiring(nu)(dot(w,alpha)) for (c,alpha) in zip(coeffs,expvs)]
tropPolyEvaluated = sum(tropTermsEvaluated)
termsAttainingValue = findall(isequal(tropPolyEvaluated),tropTermsEvaluated)
coeffs = coeffs[termsAttainingValue]
expvs = expvs[termsAttainingValue]
end

I don't see the contents of perturbation being used at all (except for that isnothing check) ?

Copy link

codecov bot commented Aug 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.56%. Comparing base (5be006e) to head (8a2755c).
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4027      +/-   ##
==========================================
+ Coverage   84.06%   84.56%   +0.50%     
==========================================
  Files         597      597              
  Lines       82121    82191      +70     
==========================================
+ Hits        69036    69507     +471     
+ Misses      13085    12684     -401     
Files Coverage Δ
src/TropicalGeometry/initial.jl 100.00% <100.00%> (+21.73%) ⬆️

... and 41 files with indirect coverage changes

@YueRen
Copy link
Member Author

YueRen commented Aug 19, 2024

Somewhat related question that I just noticed while looking at the code here:

if !isnothing(perturbation)
tropTermsEvaluated = [tropical_semiring(nu)(dot(w,alpha)) for (c,alpha) in zip(coeffs,expvs)]
tropPolyEvaluated = sum(tropTermsEvaluated)
termsAttainingValue = findall(isequal(tropPolyEvaluated),tropTermsEvaluated)
coeffs = coeffs[termsAttainingValue]
expvs = expvs[termsAttainingValue]
end

I don't see the contents of perturbation being used at all (except for that isnothing check) ?

Good catch, I think that part is obsolete and can be safely removed. It was originally intended for the tropical traversal algorithm, but
(a) never used
(b) that part can be handled cleaner simply by calling initial twice, imo.

@benlorenz benlorenz dismissed their stale review August 20, 2024 07:56

suggestions integrated

@benlorenz benlorenz changed the title Allow PointVectors as input for initial Allow AbstractVectors as input for initial Aug 20, 2024
@YueRen
Copy link
Member Author

YueRen commented Aug 20, 2024

I think the pull-request is ready to be merged, unless @benlorenz has any further comments.

@benlorenz benlorenz merged commit 38cc0a9 into master Aug 20, 2024
29 checks passed
@benlorenz benlorenz deleted the yr/initial branch August 20, 2024 16:11
HechtiDerLachs pushed a commit to HechtiDerLachs/Oscar.jl that referenced this pull request Sep 13, 2024
* TropicalGeometry: fixes initial issue

oscar-system#4025

* TropicalGeometry: allow point_vector as input for initial

* TropicalGeometry: removing unused optional perturbation input

* Update src/TropicalGeometry/initial.jl

Co-authored-by: Benjamin Lorenz <[email protected]>

---------

Co-authored-by: Benjamin Lorenz <[email protected]>
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 this pull request may close these issues.

initial() will not take a weight vector in QQ.
2 participants