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

Clean up HeckeMiscMatrix.jl #1851

Merged
merged 20 commits into from
Sep 24, 2024
Merged

Clean up HeckeMiscMatrix.jl #1851

merged 20 commits into from
Sep 24, 2024

Conversation

joschmitt
Copy link
Collaborator

No description provided.

src/flint/fmpq_mat.jl Outdated Show resolved Hide resolved
@@ -89,3 +89,6 @@ end
@deprecate is_power(x::IntegerUnion) is_perfect_power_with_data(x)
@deprecate is_power(x::QQFieldElem) is_perfect_power_with_data(x)
@deprecate is_power(x::Rational) is_perfect_power_with_data(x)

# To be deprecated in 0.47
Array(a::ZZMatrix; S::Type{T} = ZZRingElem) where {T} = Matrix{T}(a)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Please check whether this is fine.

@joschmitt joschmitt closed this Sep 18, 2024
@lgoettgens lgoettgens reopened this Sep 18, 2024
Copy link

codecov bot commented Sep 18, 2024

Codecov Report

Attention: Patch coverage is 88.46154% with 12 lines in your changes missing coverage. Please review.

Project coverage is 87.38%. Comparing base (cb4f682) to head (352e191).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/antic/nf_elem.jl 0.00% 11 Missing ⚠️
src/Deprecations.jl 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1851      +/-   ##
==========================================
+ Coverage   87.02%   87.38%   +0.35%     
==========================================
  Files          98       97       -1     
  Lines       35925    35887      -38     
==========================================
+ Hits        31265    31360      +95     
+ Misses       4660     4527     -133     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@fingolfin fingolfin left a comment

Choose a reason for hiding this comment

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

Thanks

src/flint/fmpq_mat.jl Outdated Show resolved Hide resolved
src/flint/fmpq_mat.jl Outdated Show resolved Hide resolved
d = one(ZZ)
for i in 1:nrows(M)
for j in 1:ncols(M)
d = lcm!(d, d, denominator(M[i, j]))
Copy link
Member

Choose a reason for hiding this comment

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

We should import denominator!(z::ZZRingElem, y::QQFieldElem) from Hecke. And then extend it to accept QQFieldElemOrPtr, and do something like

Suggested change
d = lcm!(d, d, denominator(M[i, j]))
d2 = denominator!(d2, mat_entry_ptr(M, i, j))
d = lcm!(d, d, d2)

where d2 is a second temporary. That's of course still not going to get speed records but at least it'll be a bit less wasteful.

Of course that's not a request for this PR, just musing about this code will browsing past it.

@@ -476,6 +476,14 @@ end

==(x::ZZRingElem, y::ZZMatrix) = parent(y)(x) == y

# Return a positive integer if A[i, j] > b, negative if A[i, j] < b, 0 otherwise
function compare_index(A::ZZMatrix, i::Int, j::Int, b::ZZRingElem)
Copy link
Member

Choose a reason for hiding this comment

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

This name is bad (we are not comparing indices). Perhaps we should move it back to Hecke, then it can be renamed there, and in fact reimplemented using mat_entry_ptr plus cmp.

Comment on lines +2093 to +2099
function prod_diagonal(A::ZZMatrix)
a = one(ZZ)
GC.@preserve a A begin
for i = 1:min(nrows(A),ncols(A))
b = mat_entry_ptr(A, i, i)
mul!(a, a, b)
end
Copy link
Member

Choose a reason for hiding this comment

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

Can't we use this as a more efficient generic implementation with minor tweaks?

src/matrix.jl Outdated Show resolved Hide resolved
@fingolfin fingolfin enabled auto-merge (squash) September 24, 2024 19:53
@fingolfin fingolfin merged commit 52ef106 into Nemocas:master Sep 24, 2024
25 checks passed
@joschmitt joschmitt deleted the js/miscmat branch September 25, 2024 05:57
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.

4 participants