Closed
Description
I started an attempt of wrapping the new nfloat
module in Arblib.jl. I thought I would create this issue to collect some of the issues and decisions encountered along the way. I'm creating the issue here on the Flint page instead of the Arblib.jl page since the discussions could be relevant for Flint itself.
It is relevant to know that the way Arblib.jl works is that it parses the Flint documentation and automatically generates the low level wrapping of the functions. In particular this means that having enough information in the function signatures to automatically generate the wrappers is important, otherwise a lot of manual work is required.
So far I have two comments:
- The functions
nfloat_ctx_set_real_prec
andnfloat_ctx_set_real_prec
have different names in the documentation and the code. In the code they have a leading underscore. I'm not sure which one is the intended one? - Many Flint types (such as
arb
) have a_t
-suffix version that is used for scalar values and the_ptr
and_srcptr
-suffix version that is used for vectors of that type (e.g.arb_t
,arb_ptr
andarb_srcptr
). In Arblib.jl the_t
version is mapped to the scalar type and the_ptr
and_srcptr
versions are mapped to vectors of that type (arb_t
is mapped toArb
, andarb_ptr
andarb_srcptr
are mapped toArbVector
). I don't think this approach is used in all of Flint, but at least for the types coming from Arb it is mostly followed. Fornfloat
this approach is not followed, it usesnfloat_ptr
andnfloat_srcptr
for everything. This is problematic for the automatic wrapping because we don't have enough information to determine if the argument is a scalar or a vector. My understanding is that the reason for this is thatnfloat
is not actually a single type, but each precision is technically its own type, is that correct? One possible solution to this issue (from the point of view of Arblib.jl) could maybe be to definetypedef void * nfloat_t
(which is exactly the same definition as fornfloat_ptr
) and use that type whenever a scalar value is intended. Would this be technically possible? I'm however not so fond of forcing Flint to structure it's code in a certain way just to make the life for Arblib.jl easier (though of course it could also help any other attempt of automatically generating wrappers). In this case it could however maybe be beneficial in terms of the Flint documentation as well, the type signaturenfloat_ptr
doesn't tell the user if the function expects a scalar value or a vector so usingnfloat_t
for scalar values could be helpful for that reason. The could be some other reason for the choice to usenfloat_ptr
instead ofnfloat_t
that I'm missing though?
If I encounter any more issues in my wrapping attempt I'll update you!
Metadata
Metadata
Assignees
Labels
No labels