Skip to content

Conversation

fieker
Copy link
Contributor

@fieker fieker commented Oct 1, 2025

to see a difference in inv it needs AA #2177. Solve should improve immedaitely, the rest I don't know

Copy link

codecov bot commented Oct 1, 2025

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.14%. Comparing base (d0033a4) to head (27dba1e).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
src/antic/nf_elem.jl 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2149      +/-   ##
==========================================
- Coverage   88.14%   88.14%   -0.01%     
==========================================
  Files          99       99              
  Lines       37054    37059       +5     
==========================================
+ Hits        32663    32664       +1     
- Misses       4391     4395       +4     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@joschmitt
Copy link
Collaborator

Unfortunately, the magic does not seem to work:

julia> K, a = cyclotomic_field(3, :a);

julia> A = K[1;;];

julia> B = K[1//2;;];

julia> can_solve_with_solution(A, B)
(true, [1])

Weirdly enough

julia> Nemo.AbstractAlgebra._can_solve_with_solution_fflu(A, B)
(true, [1//2], 1)

works.

@joschmitt
Copy link
Collaborator

The matrices are actually made integral in AbstractAlgebra: https://github.com/Nemocas/AbstractAlgebra.jl/blob/96790541de6f246c39f848a7c941f74413d673bb/src/Solve.jl#L1139 . So for this to work, the _common_denominator would need to be

function AbstractAlgebra.Solve._common_denominator(A::MatElem{AbsSimpleNumFieldElem})
  d = ZZ(1)
  @inbounds for j in 1:ncols(A)
    for i in 1:nrows(A)
      d = lcm(d, denominator(A[i, j]))
    end
  end
  return d
end

Then at least my small example works.

@fieker
Copy link
Contributor Author

fieker commented Oct 1, 2025 via email

@fieker
Copy link
Contributor Author

fieker commented Oct 1, 2025 via email

@joschmitt
Copy link
Collaborator

On Wed, Oct 01, 2025 at 06:17:50AM -0700, Johannes Schmitt wrote: joschmitt left a comment (Nemocas/Nemo.jl#2149) The matrices are actually made integral in AbstractAlgebra: https://github.com/Nemocas/AbstractAlgebra.jl/blob/96790541de6f246c39f848a7c941f74413d673bb/src/Solve.jl#L1139 . So for this to work, the _common_denominator would need to be function AbstractAlgebra.Solve._common_denominator(A::MatElem{AbsSimpleNumFieldElem}) d = ZZ(1) @inbounds for j in 1:ncols(A) for i in 1:nrows(A) d = lcm(d, denominator(A[i, j])) end end return d end Then at least my small example works.
Try can_solve_with_solution(4*A, B) the dens are handled badly. somewhere. In fields having a den of 1 always should maybe affect performance, but not correctness...

-- Reply to this email directly or view it on GitHub: #2149 (comment) You are receiving this because you authored the thread. Message ID: @.***>

julia> can_solve_with_solution(4*A, B)
(true, [1//8])

Seems to be fine?

I would say the problem is that https://github.com/Nemocas/AbstractAlgebra.jl/blob/96790541de6f246c39f848a7c941f74413d673bb/src/Solve.jl#L1139 calls a numerator function that is not compatible with the constant denominator 1.

@fieker
Copy link
Contributor Author

fieker commented Oct 1, 2025 via email

@fieker
Copy link
Contributor Author

fieker commented Oct 2, 2025

there are 2 things: common_den(matrix) needs to match den(elem) since we scale by matrix(den) to obtain elem == numerator
The other is that the den must ot be in Z it has to be base_ring(A), try can_solve_with_solution(inv(a)*A, B)
Both are hopefully adressed.
And the AA tests are/ were flawed: a special Field(F2) is constructed that was lacking conversion from Int and -

@fieker fieker merged commit 48d0628 into Nemocas:master Oct 2, 2025
16 of 18 checks passed
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.

2 participants