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

Make n_unkown usable #466

Open
4 tasks
tthsqe12 opened this issue Jul 16, 2021 · 3 comments
Open
4 tasks

Make n_unkown usable #466

tthsqe12 opened this issue Jul 16, 2021 · 3 comments

Comments

@tthsqe12
Copy link
Contributor

  • Optimize in libsingular_julia_jll conversion between n_algExt and nf_elem/fq_nmod
  • Identify where singular can crash from n_unknown coefficients and have it raise an error instead of crashing.
  • Discuss the possibility of having the missing functionality of n_unknown added to the coeffs struct via function pointers.
  • New singular_jll including the above change(s)
@thofma thofma changed the title wishlist for next release Make n_unkown usable Jul 16, 2021
@thofma
Copy link
Collaborator

thofma commented Jul 16, 2021

Here is an example where using n_unkown creates a nice segmentation fault without stack trace for the innocent user.

julia> F, = Singular.Nemo.FiniteField(2^17 - 1, 2, "a");

julia> Fx, = PolynomialRing(CoefficientRing(F), ["x", "y"]);

julia> M = Matrix(Fx, [-1 0; 0 -1])
[131070, 0
0, 131070]

julia> Singular.LibFinvar.invariant_ring(M, [0, 0, 0])

signal (11): segmentation fault
in expression starting at REPL[33]:1
unknown function (ip: (nil))
Allocations: 21701572 (Pool: 21696118; Big: 5454); GC: 22
[1]    4490 segmentation fault (core dumped)  julia

I got this while working on the invariant rings in Oscar.

@thofma
Copy link
Collaborator

thofma commented Jul 16, 2021

Note that this is crucial if we want to make Singular useful for Oscar. The situation with the segmentation faults is very off-putting for users.

@tthsqe12
Copy link
Contributor Author

tthsqe12 commented Jul 23, 2021

Here is a much simpler example, also calling a null pointer.

julia> r, _ = PolynomialRing(Singular.Nemo.QQ, ["x", "y"])
(Singular Polynomial Ring (Coeffs(17)),(x,y),(dp(2),C), spoly{Singular.n_FieldElem{Nemo.fmpq}}[x, y])

julia> Singular.LibRing.addvarsTo(r, r, Any["a", "b"], 0)
low_level_caller_rng: called
low_level_caller_rng: preparing arguments
low_level_caller_rng: calling singular

signal (11): Segmentation fault
in expression starting at REPL[3]:1
unknown function (ip: (nil))
Allocations: 12711430 (Pool: 12708583; Big: 2847); GC: 13
Segmentation fault (core dumped)

seems to work fine with native coeffs;

julia> r, _ = PolynomialRing(QQ, ["x", "y"])
(Singular Polynomial Ring (QQ),(x,y),(dp(2),C), spoly{n_Q}[x, y])

julia> Singular.LibRing.addvarsTo(r, r, Any["a", "b"], 0)
low_level_caller_rng: called
low_level_caller_rng: preparing arguments
low_level_caller_rng: calling singular
low_level_caller_rng: returned from singular
2-element Vector{Any}:
 Singular Polynomial Ring (QQ),(x,y,a,b),(C,dp(4))
 Dict{Any, Any}()

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

No branches or pull requests

2 participants