# Issue with (at last) upgrading to Singular 4-x-x in Sage.

22 views

### Jean-Pierre Flori

Oct 9, 2015, 5:24:23 AM10/9/15
to libsingular-devel
Dear all,

We've been making efforts on and off to upgrade Singular to the 4 series within Sage and we are currently stuck.
I've just started debugging the issue, but I guess the problem is really in the way we call libsingular functions to create rings.
So if any one of you sees where the problem lies from the top of your head, please tell us (and save me hours of libsingular learning and debugging, I'll still be very happy to better know how to use libsingular at the C level :)).

Here is the problematic code, it is P/Cython but the calls to libsingular are transparent.
To give you some context, the issue arises when building a number field (I assume such a task should be easy if one uses correctly singular).
So what has been done prior to the following piece of code is to create a univariate polynomial ring over Q in libsingular and wrap it in sage into "k".
The polynomial we want to use to create the extension has been created in singular and wrapped into "minpoly" (maybe the issue is in this creation?).
Then comes the creation of the number field:

_ext_names = <char**>omAlloc0(sizeof(char*))
extname = k.gen()
_name = k._names[0]
_ext_names[0] = omStrDup(_name)
_cfr = rDefault( 0, 1, _ext_names );

_cfr.qideal = idInit(1,1)
_cfr.qideal.m[0] = minpoly._poly #p_Copy(minpoly._poly, k._ring);
rComplete(_cfr, 1)
extParam.r =  _cfr;

print "here will be a problem. Incorrect minpoly assembly?"
# _type = nRegister(n_algExt, <cfInitCharProc> naInitChar);

_cf = nInitChar( n_algExt,  <void *>&extParam) #
print "here was a problem. Incorrect minpoly assembly?"

And here is what singular prints when nInitChar is called:

***omError_WrongSize: wrong size specification of addr
occured at:
#0 at ??:0                 in ??
occured for addr:0x3fff997801b0 size:32 specified size:24

// ***dPolyReportError: memory error
occured at
occured for poly: z7+z+...  addr:0x3fff997801b0 size:32

JPF

### han...@mathematik.uni-kl.de

Oct 9, 2015, 7:40:21 AM10/9/15
On Fri, Oct 09, 2015 at 02:24:23AM -0700, Jean-Pierre Flori wrote:
>
> _ext_names = <char**>omAlloc0(sizeof(char*))
> extname = k.gen()
> _name = k._names[0]
> _ext_names[0] = omStrDup(_name)
> _cfr = rDefault( 0, 1, _ext_names );
>
> _cfr.qideal = idInit(1,1)
> _cfr.qideal.m[0] = minpoly._poly #p_Copy(minpoly._poly, k._ring);
This seems to be the main problem: _cfr.qideal.m[0] must be a poly in
_cfr but not in k, so "=" or p_Copy is not the right procedure here, but
prCopyR should be used:
rComplete(_cfr, 1)
_cfr.qideal.m[0] = prCopyR(minpoly._poly,k._ring,_cfr);

> rComplete(_cfr, 1)
rComplete must be called before prCopyR
> extParam.r = _cfr;
>
> print "here will be a problem. Incorrect minpoly assembly?"
> # _type = nRegister(n_algExt, <cfInitCharProc> naInitChar);
>
> _cf = nInitChar( n_algExt, <void *>&extParam) #
> print "here was a problem. Incorrect minpoly assembly?"
>
>
> And here is what singular prints when nInitChar is called:
>
> ***omError_WrongSize: wrong size specification of addr
> occured at:
> #0 at ??:0 in ??
> occured for addr:0x3fff997801b0 size:32 specified size:24
Yes: poly objects from different rings may have different sizes
>
> // ***dPolyReportError: memory error
> occured at
> occured for poly: z7+z+... addr:0x3fff997801b0 size:32

Hope that helps,

Hannes