Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In order to get the routine defined you'd do something like

R.<x,y>=QQ[]
f=x^2-y^2
sage.libs.singular.function.lib("absfact.lib")
absFactorize=sage.libs.singular.function.singular_function("absFactorize")

which then would allow you to do something like

W=absFactorize(f)

Problem is: that gives back a nearly useless "RingWrap" object.

The libsingular function call interface seems to go out of its way to set the ring on every invocation (otherwise the state of the library interface would be difficult to manage). So improving RingWrap so that a "setring(W)" works likely wouldn't do something useful. Would you be able to write some singular code that wraps absFactorize and returns the data you're after in a more usable form? Then you can read in THAT function and use that instead. Looking at the design of libSingular, that seems to me the easiest solution at the moment. But I might be overlooking something.

In order to get the routine defined you'd do something like

R.<x,y>=QQ[]
f=x^2-y^2
sage.libs.singular.function.lib("absfact.lib")
absFactorize=sage.libs.singular.function.singular_function("absFactorize")

which then would allow you to do something like

W=absFactorize(f)

Problem is: that gives back a nearly useless "RingWrap" object.

The libsingular function call interface seems to go out of its way to set the ring on every invocation (otherwise the state of the library interface would be difficult to manage). So improving RingWrap so that a "setring(W)" works likely wouldn't do something useful. Would you be able to write some singular code that wraps absFactorize and returns the data you're after in a more usable form? Then you can read in THAT function and use that instead. Looking at the design of libSingular, that seems to me the easiest solution at the moment. But I might be overlooking something.

EDIT It's tricky, though: the Singular language interpreter seems to have great trouble handling polynomials in rings that are not the current ring. Furthermore, you'll have to construct a ring in sage to serve as a parent for conversions of the relevant polynomials. I suspect it might require some direct interfacing with libsingular on cython/C level. Clearly, Singular can represent the relevant objects, but I think the current design of AbsFactorize (to wrap the answer in a ring) is guided by limitations of the language.