Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: A question about the C interface
PostPosted: Wed Aug 15, 2018 12:07 pm 
Dear all,

I'm trying to solve a system of polynomial equation via the singular C interface (the polynomials I need are quite complicated to generate, and I already have the code to do it in C). I created an ideal which describes the variety of solutions and called kStdfac and got a list of irreducible components (right?). Now I need to find out the dimensions of the components and get the point (if zero) or a simple description of the component (if non-zero, I conjecture all non-zero components are simple x=y, z=w style components).

So, what's the C equivalent of the "std" and "dim" interface commands?

Thanks a lot!

P.S. Is the C interface documented anywhere?
P.P.S. My request to register has been unanswered for a week :cry:


Report this post
Top
  
Reply with quote  
 Post subject: Re: A question about the C interface
PostPosted: Wed Aug 15, 2018 2:36 pm 

Joined: Wed May 25, 2005 4:16 pm
Posts: 212
kStdFac: no, it does not (always) return the irreducible decomposition of an ideal;
it returns a decomposition of the radical (the components need not be irreducible),
which often is already a irreducible decomposition of the radical.
See http://www.singular.uni-kl.de/Manual/4-1-1/sing_240.htm
To get a complete decomposition, use minAssGTZ from primdec.lib

std: corresponds to kStd, see
https://www.singular.uni-kl.de/dox/html/kstd1_8h.html
(for the interface, see jjSTD,
https://www.singular.uni-kl.de/dox/html ... fd713db194
)

dim: corresponds to scDimInt

doxygen-documentation:
https://www.singular.uni-kl.de/dox/html/


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: A question about the C interface
PostPosted: Fri Aug 17, 2018 3:00 am 
I tried a minimal example for kStd and I didn't get the same answer the interpreter gives. What am I doing wrong? Is it one of the parameters of kStd?

Thanks!

char **nm=(char**)omalloc(3*sizeof(char*));
nm[0]=omStrDup("x");
nm[1]=omStrDup("y");
nm[2]=omStrDup("z");

R=rDefault(0,3,nm);
rChangeCurrRing(R);

// create the polynomial 3x^2y^2-2xy^3+3x^2
p1 = p_ISet(3,R);
pSetExp(p1,1,2);
pSetExp(p1,2,2);
p2 = p_ISet(-2,R);
pSetExp(p2,1,1);
pSetExp(p2,2,3);
p1 = p_Add_q(p1, p2, R);
p2 = p_ISet(3,R);
pSetExp(p2,1,2);
p1 = p_Add_q(p1, p2, R);

// 2x^3y-3x^2y^2+3y^2
p2 = p_ISet(2, R);
pSetExp(p2, 1, 3);
pSetExp(p2, 2, 1);
p3 = p_ISet(-3, R);
pSetExp(p3, 1, 2);
pSetExp(p3, 2, 2);
p2 = p_Add_q(p2, p3, R);
p3 = p_ISet(3, R);
pSetExp(p3, 2, 2);
p2 = p_Add_q(p2, p3, R);

// 2z
p3 = p_ISet(2,R);
pSetExp(p3, 3, 1);

I=idInit(3);
id_InsertPolyWithTests(I, 0, p1, true, true, R);
id_InsertPolyWithTests(I, 1, p2, true, true, R);
id_InsertPolyWithTests(I, 2, p3, true, true, R);

J = kStd(I, NULL, testHomog, NULL, NULL, 0, 0, NULL);
for ( int i = 0; i < idSize(J); i++ )
pWrite(J->m[i]);


Report this post
Top
  
Reply with quote  
 Post subject: Re: A question about the C interface
PostPosted: Fri Aug 17, 2018 3:51 pm 

Joined: Wed May 25, 2005 4:16 pm
Posts: 212
Each sequence of pSetExp/p_SetExp/p_SetExpV/p_SetExpVL
mut be followed by pSetm/p_Setm,
and kStd is better called with default arguments:
Code:
...
// create the polynomial 3x^2y^2-2xy^3+3x^2
p1 = p_ISet(3,R);
pSetExp(p1,1,2);
pSetExp(p1,2,2);
pSetm(p1);
p2 = p_ISet(-2,R);
pSetExp(p2,1,1);
pSetExp(p2,2,3);
pSetm(p2);
p1 = p_Add_q(p1, p2, R);
p2 = p_ISet(3,R);
pSetExp(p2,1,2);
pSetm(p2);
p1 = p_Add_q(p1, p2, R);
...
J = kStd(I, NULL, testHomog, NULL);
....


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

It is currently Tue Dec 18, 2018 6:53 pm
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group