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

Turn _arb_set and _acb_set into set! methods #1909

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fingolfin
Copy link
Member

Also replace some for ... @eval begin macro stuff

Also for the former _acb_set methods, we now take a tuple of two integers/reals/etc. coordinates instead of two arguments to avoid ambiguities between them precision argument.

This is just a draft because I later realized that these methods, or at least the ones which set a ArbFieldElem/AcbFieldElem and take a precision value p, should also adjust the parent (even if it is just emptying it). Or perhaps I just rename the methods back for those rings, to not worry about this. Dunno.

Putting this here anyway to avoid duplicated efforts (if someone else would like to continue or supersede this work, be my guest)

Also replace some `for ... @eval begin` macro stuff

Also for the former `_acb_set` methods, we now take a tuple of two
integers/reals/etc. coordinates instead of two arguments to avoid
ambiguities between them precision argument.
Copy link

codecov bot commented Oct 18, 2024

Codecov Report

Attention: Patch coverage is 69.50355% with 86 lines in your changes missing coverage. Please review.

Project coverage is 86.85%. Comparing base (633112d) to head (a3ce265).

Files with missing lines Patch % Lines
src/arb/Complex.jl 65.78% 26 Missing ⚠️
src/arb/acb.jl 65.78% 26 Missing ⚠️
src/arb/ArbTypes.jl 50.00% 22 Missing ⚠️
src/arb/Real.jl 89.47% 4 Missing ⚠️
src/arb/arb.jl 89.47% 4 Missing ⚠️
src/arb/ComplexMat.jl 50.00% 1 Missing ⚠️
src/arb/RealMat.jl 66.66% 1 Missing ⚠️
src/arb/acb_mat.jl 50.00% 1 Missing ⚠️
src/arb/arb_mat.jl 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1909      +/-   ##
==========================================
- Coverage   87.22%   86.85%   -0.37%     
==========================================
  Files          97       97              
  Lines       35590    35585       -5     
==========================================
- Hits        31044    30908     -136     
- Misses       4546     4677     +131     

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

Comment on lines +1619 to +1620
_real_ptr(x::ComplexFieldElemOrPtr) = @ccall libflint.acb_real_ptr(x::Ref{ComplexFieldElem})::Ptr{RealFieldElem}
_imag_ptr(x::ComplexFieldElemOrPtr) = @ccall libflint.acb_imag_ptr(x::Ref{ComplexFieldElem})::Ptr{RealFieldElem}
Copy link
Member Author

Choose a reason for hiding this comment

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

@lgoettgens I think this and friends is something to preserve (feel free to do so if you have time, otherwise I'll get to it eventually)

... is the comment I typed an hour ago, then I got visitors and was distracted, and now I discovered you read my mind and did PR #1921 😂

@@ -1616,135 +1616,127 @@ end
#
################################################################################

for (typeofx, passtoc) in ((ComplexFieldElem, Ref{ComplexFieldElem}), (Ptr{ComplexFieldElem}, Ptr{ComplexFieldElem}))
Copy link
Member Author

Choose a reason for hiding this comment

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

Getting rid of this loop by replacing $typeofx with ComplexFieldElemOrPtr and $passtox with Ref{ComplexFieldElem} is also something we could re-apply (and similar in the other files, of course)

Copy link
Collaborator

Choose a reason for hiding this comment

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

agreed. I'll try to do this with as less conflicts as possible

Copy link
Collaborator

Choose a reason for hiding this comment

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

See #1922

i = ccall((:acb_imag_ptr, libflint), Ptr{RealFieldElem}, (($passtoc), ), x)
_arb_set(i, z, p)
end
function set!(x::ComplexFieldElemOrPtr, y::Tuple{Int, Int}, p::Int)
Copy link
Member Author

Choose a reason for hiding this comment

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

One more change here that I think we should consider to retain for _acb_set methods: pairing "real+imag" arguments together into a single 2-tuple argument. That avoids ambiguities with those p::Int precision arguments...

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