-
Notifications
You must be signed in to change notification settings - Fork 33
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
creating rings from the rings that singular creates #336
Conversation
Can one do anything useful with those objects except for letting Singular print them? I am not sure if (as a user) I would rather see an error that something is not implemented yet or get something useless as a return value. |
You can do useful stuff with them, but let me first try to explain the situation as I see it. The singular coefficient arithmetic is implement via table lookup. So, even thought we have all of these coefficient types, what they really are doing is just setting up a lookup table: look at the implementation of + for n_GF and n_Q - they are exactly the same. Therefore, the separate coefficient types T, the parametrization of the poly rings by T, and the parametrization of the polynomial types by T seems a bit suspicious to me. It seems to me that this parametrization is currently gaining us nothing: the code for + on spoly does not depend on T but multiple copies of it will be compiled for each T (right?), and I do not see how the compiler can deduce the return type of the coefficient iterator in poly.jl. |
The pointer is passed through the base ring, which makes it inferable for julia. I think one reason to tag Maybe the implementation could be consolidated/refactored to generate it using some metaprogramming and |
I do not see how this is possible. Maybe you could explain? I am not against parametric poly types for singular.jl, I am just curious about this implementation. Anyways, the possible singular coefficient rings are here https://www.singular.uni-kl.de/Manual/4-0-3/sing_28.htm. As for the actual coefficient rings, the ones missing from singular.jl are Is it desired here to implement superficial wrapper types for each of these? They would be superficial because at the end of the day, the addition is implemented via
|
Oh, right. We are just missing the type annotation Line 21 in eec2d2a
Do you have an alternative to the superficial wrapper approach so that we can use AbstractAlgebra with Singular types? |
617818d
to
fc084f5
Compare
fc084f5
to
6af23c7
Compare
This requires oscar-system/libsingular-julia#9 |
I updated the binaries. Seems to work. |
Thanks. For those interested: the coefficient rings go through the proper cache mechanism, but the created polynomial rings do not because I have to create rings with ordering |
function create_ring_from_singular_ring(r::libSingular.ring_ptr) | ||
ordering = libSingular.ring_ordering_as_symbol(r) | ||
c = libSingular.rCoeffPtr(r) | ||
if libSingular.nCoeff_is_Q(c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest we also wrap getCoeffType
, which is also useful for interactive debugging
What is the status of this? |
# | ||
############################################################################### | ||
|
||
mutable struct N_UnknownSingularCoefficientRing <: Ring |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this duplicate the functionality of struct CoefficientRing
together with struct n_unknown
, defined just above? Or if not, what's the difference? (In the latter case, a comment should explain it?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CoefficientRing{T}
type has a field base_ring::Nemo.Ring
which we don't always have. This new type is really for the coefficient rings that singular creates that we cannot identify/there is no meaningful equivalent in julia. For example, singular has floating point coefficients, and I am not really keen on creating a special floating point coefficient type for singular.jl.
The comment is a few lines up:
# N_UnknownSingularCoefficientRing
# singular coefficient rings with no identifiable julia object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this new unknown coefficient type is not elegant, but I don't see another way if we are not able to identify what the coefficient ring is. It is meant as a default case in this switch:
Line 72 in 8081830
else |
The status is: I am happy with it for now. The caching/uniqueness issue will probably be important later, and I have no idea how to solve it currently. |
why is this not merged if everyone is happy? Any particular reason? |
creating rings from the rings that singular creates
This is not serious yet and cannot be tried because it requires modifications to the jll's. I am just looking for comments and suggestions at this point. The main problem is creating a meaningful coefficient ring from the ring that singular returns. Since there is a wide variety of possibilities here, it seems impossible to cover all cases. Therefore, I propose having an
UnknownSingularCoefficientRing
with elements of typen_unknownsingularcoefficient
as a fallback and implementing the search for special cases as we need them. For example, in #187 the coefficient ring does not have a meaningful Nemo equivalent. Here is what it currently looks like (BTW I find it ironic that the answer is called SOL:):