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

Optimize local fields a bit #1567

Merged
merged 10 commits into from
Aug 6, 2024
Merged

Optimize local fields a bit #1567

merged 10 commits into from
Aug 6, 2024

Conversation

joschmitt
Copy link
Collaborator

This should make some things a bit faster in the local fields.
I had timings where _p_adic_regulator was twice as fast as before, but the timings differ largely accross julia sessions.
This closes #1537 as far as I am concerned.

Not all changes here are "trivial", so someone should have a look (once the CI is green).

Comment on lines -231 to +229
isone(a::LocalFieldElem{S, EisensteinLocalField}) where S = iszero(a-1)
isone(a::LocalFieldElem) = isone(data(a))
function isone(a::LocalFieldElem{S, EisensteinLocalField}) where S
a1 = a - one(parent(a), precision = precision(a))
return iszero(a1)
end
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was incorrect/non-optimal before:

julia> F, _ = cyclotomic_field(3);

julia> OF = maximal_order(F);

julia> K, toK = completion(F, 2*OF);

julia> precision(K)
64

julia> a = K(2)^100
2^100 + O(2^165)

julia> a += one(K, precision = precision(a))
2^0 + 2^100 + O(2^165)

julia> isone(a)
true

Copy link

codecov bot commented Jul 26, 2024

Codecov Report

Attention: Patch coverage is 95.34884% with 4 lines in your changes missing coverage. Please review.

Project coverage is 75.59%. Comparing base (b951296) to head (f5cf2b2).

Files Patch % Lines
src/LocalField/Elem.jl 94.36% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1567      +/-   ##
==========================================
- Coverage   75.66%   75.59%   -0.08%     
==========================================
  Files         357      357              
  Lines      113542   113549       +7     
==========================================
- Hits        85915    85840      -75     
- Misses      27627    27709      +82     
Files Coverage Δ
src/LocalField/Completions.jl 96.56% <100.00%> (ø)
src/LocalField/LocalField.jl 76.57% <100.00%> (+0.58%) ⬆️
src/LocalField/Types.jl 100.00% <100.00%> (ø)
src/LocalField/Elem.jl 82.52% <94.36%> (-0.40%) ⬇️

... and 29 files with indirect coverage changes

@joschmitt joschmitt marked this pull request as ready for review July 26, 2024 13:58
@thofma thofma merged commit a503506 into thofma:master Aug 6, 2024
17 checks passed
@joschmitt joschmitt deleted the js/optimize branch August 6, 2024 16:59
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.

Multiplication in local fields spends most of the time in multiplying ramification index with the valuation
2 participants