ApCoCoA

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: strange results from intersect(ideal,ideal)
PostPosted: Fri Jan 08, 2010 6:46 pm 
Offline

Joined: Mon Dec 03, 2007 8:05 pm
Posts: 5
Hi,
I am using CoCoaLib version 0.9933 on Ubuntu 9.04 x86_64 and I have stumbled upon some strange behaviour when invoking intersect on ideals. Consider the following code:

int main()
{
CoCoA::GlobalManager cocoaFoundations;
CoCoA::FractionField Q=CoCoA::RingQ();
CoCoA::SparsePolyRing Qx = CoCoA::NewPolyRing(Q,1);
vector<RingElem> p,q,r;
p.push_back(indets(Qx)[0]);
q.push_back(1+indets(Qx)[0]);
CoCoA::ideal I(Qx,p);
CoCoA::ideal J(Qx,q);
cout<<I<<endl;
cout<<J<<endl;
cout<<intersect(I,J)<<endl;
cout<<TidyGens(I)<<endl;
cout<<TidyGens(J)<<endl;
cout<<TidyGens(intersect(I,J))<<endl;
ComputeIntersection(r,p,q);
cout<<TidyGens(ideal(Qx,r))<<endl;
return 0;
}

The output I get is the following:

ideal(x[0])
ideal(x[0] +1)
ideal(x[0]^2 +x[0])
[x[0]]
[x[0] +1]
[x[0]^2]
[x[0]^2 +x[0]]


So apparently the intersection is computed correctly, but when I invoke TidyGens I obtain an element which is not in the ideal. However, if I call ComputeIntersection and use the resulting PolyList to create an ideal, I obtain the expected result.

Am I doing something wrong?
Thanks in advance
Diego


Report this post
Top
 Profile  
 
 Post subject: Re: strange results from intersect(ideal,ideal)
PostPosted: Wed Jan 20, 2010 6:36 pm 
Offline
User avatar

Joined: Thu Sep 30, 2004 11:08 am
Posts: 477
Location: Genoa (usually)
Hi Diego

Thanks for the error report. We will investigate over the next few days.

John.
PS sorry for being slow to reply -- we're still getting back up to full speed after the break.


Report this post
Top
 Profile  
 
 Post subject: Re: strange results from intersect(ideal,ideal)
PostPosted: Wed Jan 20, 2010 7:53 pm 
Offline
User avatar

Joined: Thu Sep 30, 2004 10:59 am
Posts: 599
Location: Genova
Fixed!
The flag IHaveMonomialGensValue was not updated.

The fixed version 0.9935 is now alailable at http://cocoa.dima.unige.it/cocoalib/changelog-0.99.html

Thanks for the feedback!

Anna

PS there were some improvements in the syntax as well, now your test code can be written like this:
Code:
  CoCoA::FractionField Q=CoCoA::RingQ();
  CoCoA::SparsePolyRing Qx = CoCoA::NewPolyRing(Q,symbols("x"));
  RingElem x = indet(Qx,0);
  CoCoA::ideal I(x);
  CoCoA::ideal J(x+1);
  cout << "I = " << I << endl;
  cout << "J = " << J << endl;
  cout << "int = " << intersect(I,J) << endl;
  cout << "GB(I) = " << TidyGens(I) << endl;
  cout << "GB(J) = " << TidyGens(J) << endl;
  cout << "GB(int) = " << TidyGens(intersect(I,J)) << endl;


Report this post
Top
 Profile  
 
 Post subject: Re: strange results from intersect(ideal,ideal)
PostPosted: Thu Jan 21, 2010 12:46 pm 
Offline

Joined: Mon Dec 03, 2007 8:05 pm
Posts: 5
Thanks for your reply, but the fix does not appear to work correctly on my system for two reasons.
1) I get errors on compilation (which I didn't get with 0.9933):

Running the CoCoALib tests (43 tests altogether)
------------------------------------------------
test-empty..... OK
test-MachineInteger1..... OK
test-QQ1..... OK
test-RingZ1..... OK
test-RingZmodN1..... OK
test-RingFp1..... OK
test-RingQ1..... OK
test-convert1..... OK
test-symbol1..... OK
test-NumTheory1..... OK
test-RingTwinFloat1..... OK
***** test-RingTwinFloat2 FAILED ***** (non-zero exit status)
***** test-RingTwinFloat3 FAILED ***** (non-zero exit status)
test-RingTwinFloat4..... OK
test-RingTwinFloat5..... OK
test-RingTwinFloat6..... OK
test-SparsePolyRing1..... OK
test-GradedFreeModule1..... OK
test-module1..... OK
test-matrix1..... OK
test-matrix2..... OK
test-PPMonoid1..... OK
test-OpenMath1..... OK
test-GMPAllocator..... OK
test-IsInteger1..... OK
test-RingHom1..... OK
test-RingHom2..... OK
test-RingHom3..... OK
test-bug1..... OK
***** test-bug2 FAILED ***** (wrong output)
test-bug3..... OK
test-bug4..... OK
***** test-ideal1 FAILED ***** (non-zero exit status)
test-MonomialIdeal1..... OK
./RunTests.sh: line 82: 10489 Segmentation fault ./$prog > $prog.cout 2> $prog.cerr
***** test-GOperations1 FAILED ***** (non-zero exit status)
test-GReductor1..... OK
test-factor1..... OK
test-RingWeyl1..... OK
test-hilbert1..... OK
***** test-F5 FAILED ***** (wrong output)
test-DenseUPolyRing1..... OK
test-TmpIsTree..... OK
test-frobby1..... OK
**********************
***** Bad news *****
**********************
***** The following tests failed, please tell us about it.
***** test-RingTwinFloat2 test-RingTwinFloat3 test-bug2 test-ideal1 test-GOperations1 test-F5


2) my test program now gives the following output:

ideal(x[0])
ideal(x[0] +1)
ideal(x[0])
[x[0]]
[x[0]]
[x[0]]
[x[0]^2]

which is also wrong...
Diego


Report this post
Top
 Profile  
 
 Post subject: Re: strange results from intersect(ideal,ideal)
PostPosted: Thu Jan 21, 2010 4:02 pm 
Offline
User avatar

Joined: Thu Sep 30, 2004 10:59 am
Posts: 599
Location: Genova
acc....

In my trying to be *very precise* I found a very subtle bug!
Working on it.

Thanks
Anna


Report this post
Top
 Profile  
 
 Post subject: Re: strange results from intersect(ideal,ideal)
PostPosted: Thu Jan 21, 2010 5:58 pm 
Offline
User avatar

Joined: Thu Sep 30, 2004 10:59 am
Posts: 599
Location: Genova
The fixed version 0.9935 is now alailable at
http://cocoa.dima.unige.it/cocoalib/changelog-0.99.html
very subtle uncommon little bug in bool3.....

You will/might get errors with some test-RingTwinFloatN, don't worry, we are working on them and our tests are a lot nastier than normal use ;-)

Ciao
Anna


Report this post
Top
 Profile  
 
 Post subject: Re: strange results from intersect(ideal,ideal)
PostPosted: Thu Jan 21, 2010 7:35 pm 
Offline

Joined: Mon Dec 03, 2007 8:05 pm
Posts: 5
Thanks, now it works fine.
Diego


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

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot 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

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
[ Time : 0.125s | 9 Queries | GZIP : Off ]