Project

General

Profile

Feature #899

IsMaximal, IsPrimary for IDEAL (in cocoalib)

Added by Anna Maria Bigatti almost 8 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
High
Category:
New Function
Start date:
27 Jun 2016
Due date:
% Done:

100%

Estimated time:
6.00 h
Spent time:

Description

2017-11: actual setting of flags is discussed in #924


Related issues

Related to CoCoALib - Feature #107: Recognizing finite fieldsClosed2012-03-19

Related to CoCoA-5 - Feature #844: IsMaximal, IsPrimary for IDEAL (in cocoa language)Closed2016-02-16

Related to CoCoALib - Feature #361: implement IsPrime3, IsMaximal3Closed2013-05-29

Related to CoCoALib - Design #513: Quick/correct flag for bool3 fnsIn Progress2014-04-02

Related to CoCoALib - Design #924: FlagManager for bool/bool3 flagsNew2016-09-19

Related to CoCoA-5 - Bug #870: GBasis of product of ideals is wrong (Vadim Tropashko) --> I.myReset()Closed2016-04-26

Related to CoCoALib - Feature #1178: New function: myPrimaryDecomposition_0dimClosed2018-04-06

Related to CoCoALib - Design #1409: myTestIsPrimary & Co. : fix designClosed2020-02-03

History

#1 Updated by Anna Maria Bigatti almost 8 years ago

#2 Updated by Anna Maria Bigatti almost 8 years ago

  • % Done changed from 0 to 60

Implemented, need proper testing.

#3 Updated by Anna Maria Bigatti almost 8 years ago

  • Related to Feature #844: IsMaximal, IsPrimary for IDEAL (in cocoa language) added

#4 Updated by Anna Maria Bigatti over 7 years ago

  • Related to Feature #361: implement IsPrime3, IsMaximal3 added

#5 Updated by Anna Maria Bigatti over 7 years ago

After working on it, I realized that usually the function actually doing the "test" computation is also the function knowing whether other flags may be set. For example the test function for IsPrime in K[x] can also set the IsMaximal flag.
So now I believe that the test function should set the flag and all the other flags it knows of.
In other words: the flag should be set by the test function.

#6 Updated by John Abbott over 7 years ago

  • Status changed from New to In Progress

After speaking to Anna about this yesterday...
It seems best that the flags be assigned to only via specific functions (and not by direct C++ assignment to the flag); these specific functions would them embody any relationship between the flags. For instance, the specific fn for the "maximal" flag, when setting it to true3 would also set the "prime" flag to true3.

These flag-assigning fns can be called by any fn which is able to deduce the correct value (or by an explicit user call). Presumably an error must be signalled if there is an attempt to change the flag from true3 to false3 or vice versa.

What names should these assigning fns have? Anna suggested something like myAssignMaximalFlag.

#7 Updated by John Abbott over 7 years ago

I'm not sure if this suggestion is a good one or a bad one.

If the flags are simply data members of type bool3 then the compiler offers no protection against using C++ assignment to these fields (rather than calling the specific flag-assigning fns).

We could get help from the compiler by putting all the flags in a separate, internal class; this class then offers public fns for assigning the flags, and for getting their values. Here is an outline of what I mean:

class ideal
{
  class FlagManager
  {
   private: // data members
     bool3 myMaximalFlag;
     bool3 myPrimeFlag;
   public:
     FlagManager() {} // default ctor OK???
     void myAssignMaximalFlag(bool value) { .... };
     void myAssignPrimeFlag(bool value) { .... };
     bool3 myGetMaximalFlag() const { return myMaximalFlag; };
     bool3 myGetPrimeFlag() const { ... };
  }
  FlagManager myFlags;
};

I am not proposing the names I have used here -- I think they are too cumbersome: for instance, a mem fn of ideal which has proved the ideal to be maximal would have to call myFlags.myAssignMaximalFlag(true) which says Flag twice...

Is it better to have a single setter fn which accepts a bool as arg, or have two setter fns (one with implicit arg true, the other with implicit arg false)? JAA currently prefers a single setter fn with a bool arg, as it "feels" a bit more flexible (even though no concrete example springs to mind).

#8 Updated by Anna Maria Bigatti over 7 years ago

I have a question: I have the function IsRadicalSPR(const ideal& I) which, in the way of determining if I is radical, may detect maximality.
This is not a member function: should it be? it is effectively an auxiliary function for IsRadical.

#9 Updated by Anna Maria Bigatti over 7 years ago

  • Related to Feature #873: bool3: add some logical operations? added

#10 Updated by Anna Maria Bigatti over 7 years ago

  • Related to deleted (Feature #873: bool3: add some logical operations?)

#11 Updated by Anna Maria Bigatti over 7 years ago

  • Related to Design #513: Quick/correct flag for bool3 fns added

#12 Updated by Anna Maria Bigatti over 7 years ago

John Abbott wrote:

If the flags are simply data members of type bool3 then the compiler offers no protection against using C++ assignment to these fields (rather than calling the specific flag-assigning fns).

We could get help from the compiler by putting all the flags in a separate, internal class; this class then offers public fns for assigning the flags, and for getting their values. Here is an outline of what I mean:

I really like this idea, both for the safety, and also for the cleanliness: ideals have lots of 3flags...
I'll try doing something along those lines.

#13 Updated by Anna Maria Bigatti over 7 years ago

#14 Updated by Anna Maria Bigatti over 7 years ago

  • Related to Design #924: FlagManager for bool/bool3 flags added

#15 Updated by Anna Maria Bigatti over 7 years ago

#16 Updated by Anna Maria Bigatti over 7 years ago

  • Status changed from In Progress to Closed
  • Priority changed from Normal to High
  • % Done changed from 60 to 100
  • Estimated time set to 6.00 h

The function themselves work fine. The discussion now is about the implementation of the bool3 flags, which is a more general question, so it is moved to #924.

#17 Updated by Anna Maria Bigatti about 7 years ago

  • Related to Bug #870: GBasis of product of ideals is wrong (Vadim Tropashko) --> I.myReset() added

#18 Updated by Anna Maria Bigatti over 6 years ago

  • Description updated (diff)

#19 Updated by Anna Maria Bigatti about 6 years ago

  • Related to Feature #1178: New function: myPrimaryDecomposition_0dim added

#20 Updated by Anna Maria Bigatti about 4 years ago

  • Related to Design #1409: myTestIsPrimary & Co. : fix design added

Also available in: Atom PDF