Project

General

Profile

Bug #446

intersection fails with zero ideal

Added by John Abbott about 10 years ago. Updated about 10 years ago.

Status:
Closed
Priority:
Urgent
Category:
Incomplete function
Target version:
Start date:
20 Feb 2014
Due date:
% Done:

100%

Estimated time:
3.00 h
Spent time:

Description

The following input wrongly produces an error

Use P ::= QQ[x,y,z];
I := ideal(x,y);
J := ideal(zero(P));
Intersection(I,J); --> gives error!


Related issues

Related to CoCoALib - Design #455: Which sets of generators in an ideal?New2014-03-03

Related to CoCoA-5 - Bug #1080: intersect: problem with zero generatorsClosed2017-06-16

History

#1 Updated by John Abbott about 10 years ago

Same problem with radical(J).

#2 Updated by John Abbott about 10 years ago

Bad news: the problem occurs somewhere inside Max's code :-(

The problem is that EmbedPolyList tries to create a GPoly starting from a zero polynomial, but the ctor wants to compute the LPP of the starting poly.

I tried hacking EmbedPolyList (lines 1489-1501 in TmpGReductor.C) so that the main loop skips zero polys; this caused another problem in myPrepareGBasis because the list myPairs is empty, but an assert says it should be non-empty.

What to do?

#3 Updated by John Abbott about 10 years ago

radical seems happy so long as there is at least one non-zero generator.
However, radical(ideal(one(R))) gives a very strange error message!

intersect appears to exhibit the problem if either ideal has a zero generator;
I tried ideal(x,0) and ideal(y,0) where 0 represents zero(R)

Anna says she knows a fix for intersect.

Strictly, the issue belongs to CoCoALib.

#4 Updated by John Abbott about 10 years ago

Should there be a separate issue about putting some proper "extreme case" tests for all ideal operations in the standard test suite(s)? Probably best in the CoCoALib tests!

The tests should cover char 0 and char p. Perhaps some non-trivial coeffs rings too?

#5 Updated by Anna Maria Bigatti about 10 years ago

  • Category set to Incomplete function
  • Target version set to CoCoA-5.0.9
  • % Done changed from 0 to 10

I had fixed this kind of problemi in SparsePolyRing.C for colon

      RingElem Z(zero(myAmbientRing()));
      myGensValue.erase(remove(myGensValue.begin(), myGensValue.end(),Z),
                        myGensValue.end());

... in fact.... I'm not sure why gens do not change...
/**/  Use R ::= QQ[x,y];  I := ideal(x*y, zero(R), x^2);  I : ideal(x);
ideal(y, x)
/**/ I;
ideal(x*y, 0, x^2)

#6 Updated by John Abbott about 10 years ago

The mem fn myColon is called by colon (see source ideal.C:280) which makes a copy of I and then "plays" with the gens of that copy -- this does not change the original arg (which is const).

What I tried to suggest yesterday, is that an ideal could contain two lists of generators: one is the list the user supplied, the other is a "cleaned list" e.g. without zero values, maybe without duplicates, maybe made monic, perhaps put into a good order, etc. I can see one problem: which list should be used when printing the ideal? Presumably the original user-supplied list should be returned by the mem fn myGens (or whatever it is called). Mmmm, it could be confusing to have two lists... Unless the "cleaned list" is used only when calling ideal operations...???

#7 Updated by Anna Maria Bigatti about 10 years ago

John Abbott wrote:

The mem fn myColon is called by colon (see source ideal.C:280) which makes a copy of I and then "plays" with the gens of that copy -- this does not change the original arg (which is const).

I expect we could do the same for intersect

What I tried to suggest yesterday, is that an ideal could contain two lists of generators: one is the list the user supplied, the other is a "cleaned list" e.g. without zero values, maybe without duplicates, maybe made monic, perhaps put into a good order, etc. I can see one problem: which list should be used when printing the ideal? Presumably the original user-supplied list should be returned by the mem fn myGens (or whatever it is called). Mmmm, it could be confusing to have two lists... Unless the "cleaned list" is used only when calling ideal operations...???

I think the cleaned list could be hidden to the user, a bit like the gbasis.
For monomial ideals it would be handy to have the list of PPs in a similar fashion.
A template member field? (boggle)

#8 Updated by John Abbott about 10 years ago

We must remember to add CoCoALib tests for all these "trivial cases" -- they should be in CoCoALib rather than CoCoA-5, I believe.

#9 Updated by Anna Maria Bigatti about 10 years ago

  • Status changed from New to Feedback
  • Assignee set to Anna Maria Bigatti
  • % Done changed from 10 to 90

done and added to test-ideal1.

Added the zero ideal case to

  const ideal intersect(const ideal& I, const ideal& J)

using myIntersect is still dangerous (as all the my functions)

#10 Updated by John Abbott about 10 years ago

Do the myIntersect functions have assertions that their args are valid?

#11 Updated by Anna Maria Bigatti about 10 years ago

ehm.... most of them yes ;-) except SparsePolyRing ideals (I think).

Looking at all of them I'm getting convinced we should make a "myAssignZero" which knows, for any implementation, all the fields to be cleared.

#12 Updated by Anna Maria Bigatti about 10 years ago

added test in cocoalib. closing.

#13 Updated by John Abbott about 10 years ago

  • Status changed from Feedback to Closed
  • % Done changed from 90 to 100

#14 Updated by Anna Maria Bigatti about 10 years ago

  • Estimated time set to 3.00 h

#15 Updated by John Abbott almost 7 years ago

  • Related to Bug #1080: intersect: problem with zero generators added

Also available in: Atom PDF