Feature #899
IsMaximal, IsPrimary for IDEAL (in cocoalib)
Related issues
History
#1 Updated by Anna Maria Bigatti almost 8 years ago
- Related to Feature #107: Recognizing finite fields added
#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
- Related to Design #921: Design GBMill added
#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
- Related to deleted (Design #921: Design GBMill)
#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