On Monday 10 November 2008, Thomas Kahle wrote:
> Hi again, thanks for your help
>
> > You are definitely not using libSingular but the Singular pexpect
> > interface. libSingular is the C++ interface to a subset of Singular (the
> > kernel).
>
> Then, how do I use libSingular ?
> Is it used if work directly with the types implemented in sage, like
> R = QQ['x,y,z']
> I = (x^2-y*z, z^7-x^2) * R
> I.primary_decomposition()
> ... and so on ?

Yes and no:

> R = QQ['x,y,z']
> I = (x^2-y*z, z^7-x^2) * R

So far you are using libSingular, i.e. Sage's native datatypes use 
libSingular.

> I.primary_decomposition()

This functionality is implemented as Singular script (i.e. in the interface 
language of Singular) and thus we call an external Singular process to 
perform it. This requires string passing back and forth. 

> > I can reproduce the discrepancy only to some extend:
> >
> > Singular
> > real    0m22.033s
> > user    0m21.026s
> > sys     0m0.856s
> >
> > Sage:
> > real    0m23.251s
> > user    0m0.846s
> > sys     0m0.303s
>
> Did you use my example ? 

Yes, I used your example.

> How can there be such a discrepancy on my machine ?

What is your machine/os? Mine:

Intel Core2Duo 2.33Ghz 3GB RAM
64-bit Debian/GNU Linux


> If it's as small as in your case I could easily live with it.
>
> > Some overhead is unavoidable because data has to be exchanged between
> > Singular and Sage. Since the radical command is only available as a
> > Singular script (rather than in the kernel) I don't see an immediate way
> > around it.
>
> an ideal in sage has the method .radical(), does that mean the pexpect
> interface is called in this case ?

As radical is implemented in Singular script rather than C/C++ by the Singular 
team we have to call the Singular interpreter via pexpect.

> Summarizing, what is the smartest way to use Singular from within Sage ?

It really depends on what you're trying to achieve. In your case, the last 
example I gave earlier might be the way to go. You can also write Singular 
scripts and call them from within Sage. 

For me usually working with Sage's native datatypes and calling 
I.groebner_basis (which calls Singular via pexpect) is the way to go, because 
my inputs and outputs are small but the GB computation takes considerable 
time.

Cheers,
Martin
-- 
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_www: http://www.informatik.uni-bremen.de/~malb
_jab: [EMAIL PROTECTED]


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to