Changeset 7f7c25e in git for Singular/LIB/primdec.lib


Ignore:
Timestamp:
Jul 26, 2006, 1:50:30 PM (18 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
f3c6e5cf695bf90001021f22fdfc176f564b03fb
Parents:
739993c19abcae1d08bb208d1f452f3858ae25ce
Message:
*hannes/slaplagne: syntax


git-svn-id: file:///usr/local/Singular/svn/trunk@9353 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/primdec.lib

    r739993 r7f7c25e  
    11///////////////////////////////////////////////////////////////////////////////
    2 version="$Id: primdec.lib,v 1.123 2006-07-25 18:00:01 Singular Exp $";
     2version="$Id: primdec.lib,v 1.124 2006-07-26 11:50:30 Singular Exp $";
    33category="Commutative Algebra";
    44info="
     
    1313    Gianni, Trager and Zacharias (implementation by Gerhard Pfister),
    1414    respectively based on the ideas of Shimoyama and Yokoyama (implementation
    15     by Wolfram Decker and Hans Schoenemann).
    16  @* The procedures are implemented to be used in characteristic 0.
    17  @* They also work in positive characteristic >> 0.
    18  @* In small characteristic and for algebraic extensions, primdecGTZ
    19     may not terminate.
     15    by Wolfram Decker and Hans Schoenemann).@*
     16    The procedures are implemented to be used in characteristic 0.@*
     17    They also work in positive characteristic >> 0.@*
     18   In small characteristic and for algebraic extensions, primdecGTZ
     19    may not terminate.@*
    2020    Algorithms for the computation of the radical based on the ideas of
    21     Krick, Logar and Kemper (implementation by Gerhard Pfister).
     21    Krick, Logar, Laplagne and Kemper (implementation by Gerhard Pfister and Santiago Laplagne).
     22    They work in any characteristic.
    2223
    2324PROCEDURES:
     
    2526 primdecGTZ(I);    complete primary decomposition via Gianni,Trager,Zacharias
    2627 primdecSY(I...);  complete primary decomposition via Shimoyama-Yokoyama
    27  minAssGTZ(I);     the minimal associated primes via Gianni,Trager,Zacharias
     28 minAssGTZ(I);     the minimal associated primes via Gianni,Trager,Zacharias (with modifications by Laplagne)
    2829 minAssChar(I...); the minimal associated primes using characteristic sets
    2930 testPrimary(L,k); tests the result of the primary decomposition
    30  radical(I);       computes the radical of I via  Krick/Logar and Kemper
    31  radicalEHV(I);    computes the radical of I via  Eisenbud,Huneke,Vasconcelos
     31 radical(I);       computes the radical of I via Krick/Logar (with modifications by Laplagne) and Kemper
     32 radicalEHV(I);    computes the radical of I via Eisenbud,Huneke,Vasconcelos
    3233 equiRadical(I);   the radical of the equidimensional part of the ideal I
    3334 prepareAss(I);    list of radicals of the equidimensional components of I
     
    837838proc zero_decomp (ideal j,ideal ser,int @wr,list #)
    838839"USAGE:   zero_decomp(j,ser,@wr); j,ser ideals, @wr=0 or 1
    839          (@wr=0 for primary decomposition, @wr=1 for computaion of associated
     840         (@wr=0 for primary decomposition, @wr=1 for computation of associated
    840841         primes)
    841842RETURN:  list = list of primary ideals and their radicals (at even positions
     
    20672068       valid = 0;
    20682069       if((typeof(#[j]) == "int") or (typeof(#[j]) == "number")) {
    2069          if (#[j] == 0) {facstdOption = "noFacstd"; valid = 1;};    // If #[j] == 0, facstd is not used.
    2070          if (#[j] == 1) {facstdOption = "facstd";   valid = 1;};    // If #[j] == 1, facstd is used.
    2071        };
     2070         if (#[j] == 0) {facstdOption = "noFacstd"; valid = 1;}    // If #[j] == 0, facstd is not used.
     2071         if (#[j] == 1) {facstdOption = "facstd";   valid = 1;}    // If #[j] == 1, facstd is used.
     2072       }
    20722073       if(typeof(#[j]) == "string"){
    20732074         if(#[j] == "GTZ" || #[j] == "SL") {
    20742075           algorithm = #[j];
    20752076           valid = 1;
    2076          };
     2077         }
    20772078         if(#[j] == "noFacstd" || #[j] == "facstd") {
    20782079           facstdOption = #[j];
    20792080           valid = 1;
    2080          };
    2081        };
     2081         }
     2082       }
    20822083       if(valid == 0) {
    20832084         dbprint(1, "Warning! The following input parameter was not recognized:", #[j]);
    2084        };
    2085      };
    2086    };
     2085       }
     2086     }
     2087   }
    20872088
    20882089   list q = simplifyIdeal(i);
     
    21372138            // Lines changed
    21382139            if (algorithm == "GTZ") {
    2139               qr = decomp(pr[k], 2);
    2140           } else {
    2141               qr = minAssSL(pr[k]);
    2142           };
     2140               qr = decomp(pr[k], 2);
     2141            } else {
     2142               qr = minAssSL(pr[k]);
     2143            }
    21432144            for(j = 1; j <= size(qr) / 2; j++)
    21442145            {
     
    21592160      } else {
    21602161         re[1] = minAssSL(i);
    2161     };
     2162      }
    21622163      re = union(re);
    21632164      option(set, op);
    21642165      return(phi(re));
    2165    };
     2166   }
    21662167
    21672168   q = facstd(i);
     
    21992200      } else {
    22002201         re[j] = minAssSL(q[j]);
    2201     };
     2202      }
    22022203      // Debug
    22032204      dbprint(printlevel - voice, "Number of components obtained for this component:", size(re[j]) / 2);
    22042205      dbprint(printlevel - voice, "re[j]:", re[j]);
    2205    };
     2206   }
    22062207   re = union(re);
    22072208
     
    51975198
    51985199proc primdecSY(ideal i, list #)
    5199 "USAGE:   primdecSY(i); i ideal, c int
     5200"USAGE:   primdecSY(I, c); I ideal, c int (optional)
    52005201RETURN:  a list pr of primary ideals and their associated primes:
    52015202@format
     
    52065207@format
    52075208   if c=0,  the given ordering of the variables is used,
    5208    if c=1,  minAssChar tries to use an optimal ordering,
     5209   if c=1,  minAssChar tries to use an optimal ordering (default),
    52095210   if c=2,  minAssGTZ is used,
    52105211   if c=3,  minAssGTZ and facstd are used.
     
    52455246///////////////////////////////////////////////////////////////////////////////
    52465247proc minAssGTZ(ideal i,list #)
    5247 "USAGE:    minAssGTZ(i); i ideal
    5248       Optional parameters in list #: (can be entered in any order)
    5249       0, "facstd"   ->   uses facstd to first decompose the ideal (default)
    5250       1, "noFacstd" ->  does not use facstd
    5251       "SL" ->     the new algorithm is used (default)
    5252       "GTZ" ->     the old algorithm is used
    5253 RETURN:  a list, the minimal associated prime ideals of i.
     5248"USAGE:    minAssGTZ(I[, l]); I ideal, l list (optional)
     5249   @* Optional parameters in list l (can be entered in any order):
     5250   @* 0, \"facstd\" -> uses facstd to first decompose the ideal (default)
     5251   @* 1, \"noFacstd\" -> does not use facstd
     5252   @* \"GTZ\" -> the original algorithm by Gianni, Trager and Zacharias is used
     5253   @* \"SL\" -> GTZ algorithm with modificiations by Laplagne is used (default)
     5254
     5255RETURN:  a list, the minimal associated prime ideals of I.
    52545256NOTE:    Designed for characteristic 0, works also in char k > 0 based
    52555257         on an algorithm of Yokoyama
     
    52705272       valid = 0;
    52715273       if((typeof(#[j]) == "int") or (typeof(#[j]) == "number")) {
    5272          if (#[j] == 1) {facstdOption = "noFacstd"; valid = 1;};    // If #[j] == 1, facstd is not used.
    5273          if (#[j] == 0) {facstdOption = "facstd";   valid = 1;};    // If #[j] == 0, facstd is used.
    5274        };
     5274         if (#[j] == 1) {facstdOption = "noFacstd"; valid = 1;}    // If #[j] == 1, facstd is not used.
     5275         if (#[j] == 0) {facstdOption = "facstd";   valid = 1;}    // If #[j] == 0, facstd is used.
     5276       }
    52755277       if(typeof(#[j]) == "string"){
    52765278         if((#[j] == "GTZ") || (#[j] == "SL")) {
    52775279           algorithm = #[j];
    52785280           valid = 1;
    5279          };
     5281         }
    52805282         if((#[j] == "noFacstd") || (#[j] == "facstd")) {
    52815283           facstdOption = #[j];
    52825284           valid = 1;
    5283          };
    5284        };
     5285         }
     5286       }
    52855287       if(valid == 0) {
    52865288         dbprint(1, "Warning! The following input parameter was not recognized:", #[j]);
    5287        };
    5288      };
    5289    };
     5289       }
     5290     }
     5291   }
    52905292
    52915293   if(ord_test(basering)!=1)
     
    52985300   {
    52995301      return(algeDeco(i,2));
    5300    };
     5302   }
    53015303
    53025304   list result;
     
    53165318///////////////////////////////////////////////////////////////////////////////
    53175319proc minAssChar(ideal i, list #)
    5318 "USAGE:   minAssChar(i[,c]); i ideal, c int.
     5320"USAGE:   minAssChar(I[,c]); i ideal, c int (optional).
    53195321RETURN:  list, the minimal associated prime ideals of i.
    53205322NOTE:    If c=0, the given ordering of the variables is used. @*
     
    53485350///////////////////////////////////////////////////////////////////////////////
    53495351proc equiRadical(ideal i)
    5350 "USAGE:   equiRadical(i); i ideal
    5351 RETURN:  ideal, intersection of associated primes of i of maximal dimension.
    5352 NOTE:    A combination of the algorithms of Krick/Logar and Kemper is used.
     5352"USAGE:   equiRadical(I); I ideal
     5353RETURN:  ideal, intersection of associated primes of I of maximal dimension.
     5354NOTE:    A combination of the algorithms of Krick/Logar (with modifications by Laplagne) and Kemper is used.
    53535355         Works also in positive characteristic (Kempers algorithm).
    53545356EXAMPLE: example equiRadical; shows an example
     
    53615363      );
    53625364   }
    5363    return(radical(i,1));
     5365   return(radical(i, 1));
    53645366}
    53655367example
     
    53755377///////////////////////////////////////////////////////////////////////////////
    53765378proc radical(ideal i, list #)
    5377 "USAGE: radical(i); i ideal.
    5378    Optional parameters in list #: (can be entered in any order)
    5379    1, \"equiRad\" -> equiRadical is computed
    5380    0, \"fullRad\" -> full radical is computed  (default)
    5381    \"SL\" ->         Laplagne algorithm is used (default)
    5382    \"KL\" ->         Krick/Logar algorithm is used
    5383    \"facstd\" ->    uses facstd to first decompose the ideal (default for non homogeneous ideals)
    5384    \"noFacstd\" ->  does not use facstd (default for homogeneous ideals)
    5385 RETURN:  ideal, the radical of i (or the equiradical if required in the input parameters)
    5386 NOTE:    A combination of the algorithms of Krick/Logar or Laplagne and Kemper is used.
     5379"USAGE: radical(I[, l]); I ideal, l list (optional)
     5380 @*  Optional parameters in list l (can be entered in any order):
     5381 @*  0, \"fullRad\" -> full radical is computed (default)
     5382 @*  1, \"equiRad\" -> equiRadical is computed
     5383 @*  \"KL\" -> Krick/Logar algorithm is used
     5384 @*  \"SL\" -> modifications by Laplagne are used (default)
     5385 @*  \"facstd\" -> uses facstd to first decompose the ideal (default for non homogeneous ideals)
     5386 @*  \"noFacstd\" -> does not use facstd (default for homogeneous ideals)
     5387RETURN:  ideal, the radical of I (or the equiradical if required in the input parameters)
     5388NOTE:    A combination of the algorithms of Krick/Logar (with modifications by Laplagne) and Kemper is used.
    53875389         Works also in positive characteristic (Kempers algorithm).
    53885390EXAMPLE: example radical; shows an example
     
    54045406   // Set input parameters
    54055407   algorithm = "SL";                                 // Default: SL algorithm
    5406    il = 0;                                           // Default: Full radical (not only equidim part)
     5408   il = 0;                                           // Default: Full radical (not only equiRadical)
    54075409   if (homog(i) == 1) {                              // Default: facStd is used, except if the ideal is homogeneous.
    54085410      useFac = 0;
    54095411   } else {
    5410              useFac = 1;
    5411    };
     5412      useFac = 1;
     5413   }
    54125414   if(size(#) > 0){
    5413            int valid;
    5414            for(j = 1; j <= size(#); j++){
    5415                    valid = 0;
    5416                    if((typeof(#[j]) == "int") or (typeof(#[j]) == "number")) {
    5417                            il = #[j];                        // If il == 1, equiRadical is computed
    5418                            valid = 1;
    5419                    };
    5420                    if(typeof(#[j]) == "string"){
    5421                            if(#[j] == "KL") {
    5422                                    algorithm = "KL";
    5423                                    valid = 1};
    5424                            if(#[j] == "SL") {
    5425                                    algorithm = "SL";
    5426                                    valid = 1};
    5427                            if(#[j] == "noFacstd") {
    5428                                    useFac = 0;
    5429                                    valid = 1};
    5430                            if(#[j] == "facstd") {
    5431                                    useFac = 1;
    5432                                       valid = 1};
    5433                            if(#[j] == "equiRad") {
    5434                                    il = 1;
    5435                                    valid = 1};
    5436                            if(#[j] == "fullRad") {
    5437                                    il = 0;
    5438                                    valid = 1};
    5439                    };
    5440                    if(valid == 0) {
    5441                            dbprint(1, "Warning! The following input parameter was not recognized:", #[j]);
    5442                    };
    5443            };
    5444    };
     5415      int valid;
     5416      for(j = 1; j <= size(#); j++){
     5417         valid = 0;
     5418         if((typeof(#[j]) == "int") or (typeof(#[j]) == "number")) {
     5419            il = #[j];                        // If il == 1, equiRadical is computed
     5420            valid = 1;
     5421         }
     5422         if(typeof(#[j]) == "string"){
     5423            if(#[j] == "KL") {
     5424               algorithm = "KL";
     5425               valid = 1}
     5426            if(#[j] == "SL") {
     5427               algorithm = "SL";
     5428               valid = 1}
     5429            if(#[j] == "noFacstd") {
     5430               useFac = 0;
     5431               valid = 1}
     5432            if(#[j] == "facstd") {
     5433               useFac = 1;
     5434               valid = 1}
     5435            if(#[j] == "equiRad") {
     5436               il = 1;
     5437               valid = 1}
     5438            if(#[j] == "fullRad") {
     5439               il = 0;
     5440               valid = 1}
     5441         }
     5442         if(valid == 0) {
     5443            dbprint(1, "Warning! The following input parameter was not recognized:", #[j]);
     5444         }
     5445      }
     5446   }
    54455447
    54465448   if(size(i) == 0){return(ideal(0));}
     
    54485450   intvec op = option(get);
    54495451   list qr = simplifyIdeal(i);
    5450    // SL - Line removed. The ideal isave was never used.
    5451    //ideal isave=i;
    54525452   map phi = @P, qr[2];
    54535453
     
    54595459   if(di == 0)
    54605460   {
    5461      i = zeroRad(i, qr[1]);
    5462      return(interred(phi(i)));
     5461      i = zeroRad(i, qr[1]);
     5462      return(interred(phi(i)));
    54635463   }
    54645464
     
    54675467   if(useFac == 1)
    54685468   {
    5469      pr = facstd(i);
     5469      pr = facstd(i);
    54705470   } else {
    5471          pr = i
    5472    };
     5471      pr = i
     5472   }
    54735473   option(set, op);
    54745474   int s = size(pr);
    54755475   if(useFac == 1) {
    54765476      dbprint(printlevel - voice, "Number of components returned by facstd: ", s);
    5477    };
     5477   }
    54785478   for(j = 1; j <= s; j++)
    54795479   {
     
    54855485         dbprint(printlevel-voice, "The dimension is: ", dim(pr[s+1-j]));
    54865486
    5487              if(algorithm == "KL") {
    5488                   rad = intersect(rad, radicalKL(pr[s + 1 - j], rad, il));
    5489               }
    5490               if(algorithm == "SL") {
    5491                       rad = intersect(rad, radicalSL(pr[s + 1 - j], il));
    5492               };
     5487         if(algorithm == "KL") {
     5488            rad = intersect(rad, radicalKL(pr[s + 1 - j], rad, il));
     5489         }
     5490         if(algorithm == "SL") {
     5491            rad = intersect(rad, radicalSL(pr[s + 1 - j], il));
     5492         }
    54935493      } else
    54945494      {
    5495               // SL Debug
    5496           dbprint(printlevel-voice, "The radical of this component is not needed.");
    5497           dbprint(printlevel-voice, "size(reduce(rad, pr[s + 1 - j], 1))", size(reduce(rad, pr[s + 1 - j], 1)));
    5498           dbprint(printlevel-voice, "dim(pr[s + 1 - j])", dim(pr[s + 1 - j]));
    5499           dbprint(printlevel-voice, "il", il);
    5500       };
     5495         // SL Debug
     5496         dbprint(printlevel-voice, "The radical of this component is not needed.");
     5497         dbprint(printlevel-voice, "size(reduce(rad, pr[s + 1 - j], 1))", size(reduce(rad, pr[s + 1 - j], 1)));
     5498         dbprint(printlevel-voice, "dim(pr[s + 1 - j])", dim(pr[s + 1 - j]));
     5499         dbprint(printlevel-voice, "il", il);
     5500      }
    55015501   }
    55025502   return(interred(phi(rad)));
     
    55225522//
    55235523static proc radicalKL(ideal I, ideal ser, list #) {
    5524 // ideal I                       The ideal for which the radical is computed
    5525 // ideal ser                     Used to reduce components already obtained
    5526 // list #                        If #[1] = 1, equiradical is computed.
     5524// ideal I                  The ideal for which the radical is computed
     5525// ideal ser                Used to reduce components already obtained
     5526// list #                   If #[1] = 1, equiradical is computed.
    55275527
    55285528        // I needs to be a Groebner basis.
    55295529        if (attrib(I, "isSB") != 1) {
    5530                 I = groebner(I);
    5531         };
     5530           I = groebner(I);
     5531        }
    55325532
    55335533        ideal rad;                                // The radical
     
    55385538        rad = result[1];
    55395539        if (done == 0) {
    5540                 rad = intersect(rad, radicalKL(result[2], ideal(1), #));
    5541         };
     5540           rad = intersect(rad, radicalKL(result[2], ideal(1), #));
     5541        }
    55425542        return(rad);
    55435543};
     
    55675567    if (attrib(I, "isSB") != 1) {
    55685568            I = groebner(I);
    5569     };
     5569    }
    55705570    iDim = dim(I);
    55715571
     
    55735573    if (size(#) > 0) {
    55745574       il = #[1];
    5575     };
     5575    }
    55765576
    55775577    while(stop == 0) {
     
    55865586                if (il == 1){
    55875587                    if (attrib(primes[k], "isSB") != 1) {
    5588                             primes[k] = groebner(primes[k]);
    5589                     };
     5588                       primes[k] = groebner(primes[k]);
     5589                    }
    55905590                    if (iDim == dim(primes[k])) {
    5591                             equiRad = intersect(equiRad, primes[k]);
    5592                     };
    5593                 };
    5594             };
     5591                       equiRad = intersect(equiRad, primes[k]);
     5592                    }
     5593                }
     5594            }
    55955595        } else {
    5596             stop = 1;
    5597         };
    5598     };
     5596           stop = 1;
     5597        }
     5598    }
    55995599    if (il == 0) {
    56005600            return(rad);
    56015601    } else {
    56025602            return(equiRad);
    5603     };
     5603    }
    56045604};
    56055605
     
    58775877   } else {
    58785878      done = 0;
    5879    };
     5879   }
    58805880   // SL 2006.04.21 2
    58815881
     
    58985898// Output: ideal. Intersection of some primes of I different from the ones in P.
    58995899{
    5900         int k = 1;                                // Counter
    5901         int good  = 0;                        // Checks if an element of P is in rad(I)
    5902 
    5903         dbprint (printlevel-voice, "// We search for an element in P - sqrt(I).");
    5904         while ((k <= size(P)) and (good == 0)) {
    5905                 dbprint (printlevel-voice, "// We try with:", P[k]);
    5906                 good = 1 - rad_con(P[k], I);
    5907                 k++;
    5908         };
    5909         k--;
    5910         if (good == 0) {
    5911                 dbprint (printlevel-voice, "// No element was found, P = sqrt(I).");
    5912                 list emptyList = list();
    5913                 return (emptyList);
    5914         };
    5915         dbprint(printlevel - voice, "// That one was good!");
    5916         dbprint(printlevel - voice, "// We saturate I with respect to this element.");
    5917         if (P[k] != 1) {
    5918                 ideal J = sat(I, P[k])[1];
    5919         } else {
    5920                 dbprint(printlevel - voice, "// The polynomial is 1, the saturation in not actually computed.");
    5921                 ideal J = I;
    5922         };
    5923 
    5924         // We now call proc radicalNew;
    5925         dbprint(printlevel - voice, "// We do the reduction to the zerodimensional case, via radical.");
    5926         dbprint(printlevel - voice, "// The ideal is ", J);
    5927         dbprint(printlevel - voice, "// The dimension is ", dim(groebner(J)));
    5928 
    5929     int allMaximal = 0;                   // Compute the zerodim reduction for only one indep set.
    5930     ideal re = 1;                           // No reduction is need, there are not redundant components.
    5931     list emptyList = list();   // Look for primes of any dimension, not only of max dimension.
     5900    int k = 1;                                // Counter
     5901    int good  = 0;                        // Checks if an element of P is in rad(I)
     5902
     5903    dbprint (printlevel-voice, "// We search for an element in P - sqrt(I).");
     5904    while ((k <= size(P)) and (good == 0)) {
     5905       dbprint (printlevel-voice, "// We try with:", P[k]);
     5906       good = 1 - rad_con(P[k], I);
     5907       k++;
     5908    }
     5909    k--;
     5910    if (good == 0) {
     5911       dbprint (printlevel-voice, "// No element was found, P = sqrt(I).");
     5912       list emptyList = list();
     5913       return (emptyList);
     5914    }
     5915    dbprint(printlevel - voice, "// That one was good!");
     5916    dbprint(printlevel - voice, "// We saturate I with respect to this element.");
     5917    if (P[k] != 1) {
     5918       ideal J = sat(I, P[k])[1];
     5919    } else {
     5920       dbprint(printlevel - voice, "// The polynomial is 1, the saturation in not actually computed.");
     5921       ideal J = I;
     5922    }
     5923
     5924    // We now call proc radicalNew;
     5925    dbprint(printlevel - voice, "// We do the reduction to the zerodimensional case, via radical.");
     5926    dbprint(printlevel - voice, "// The ideal is ", J);
     5927    dbprint(printlevel - voice, "// The dimension is ", dim(groebner(J)));
     5928
     5929    int allMaximal = 0;      // Compute the zerodim reduction for only one indep set.
     5930    ideal re = 1;            // No reduction is need, there are not redundant components.
     5931    list emptyList = list(); // Look for primes of any dimension, not only of max dimension.
    59325932    list result = radicalReduction(J, re, allMaximal, emptyList);
    59335933
    5934         return(result[1]);
     5934    return(result[1]);
    59355935};
    59365936
     
    59475947
    59485948proc newMaxIndependSetDp(ideal j, list #)
    5949 "USAGE:   newMaxIndependentSetDp(i); i ideal (returns all maximal independent sets of the corresponding leading terms ideal)
    5950           newMaxIndependentSetDp(i, 0); i ideal (returns only one maximal independent set)
     5949"USAGE:   newMaxIndependentSetDp(I); I ideal (returns all maximal independent sets of the corresponding leading terms ideal)
     5950          newMaxIndependentSetDp(I, 0); I ideal (returns only one maximal independent set)
    59515951RETURN:  list = #1. new varstring with the maximal independent set at the end,
    59525952                #2. ordstring with the corresponding dp block ordering,
     
    59645964   int allMaximal;
    59655965   if (size(#) > 0) {
    5966            allMaximal = #[1];
     5966      allMaximal = #[1];
    59675967   } else {
    5968            allMaximal = 1;
    5969    };
     5968      allMaximal = 1;
     5969   }
    59705970
    59715971   int nMax;
     
    59735973      nMax = size(v);
    59745974   } else {
    5975           nMax = 1;
    5976    };
     5975      nMax = 1;
     5976   }
    59775977
    59785978   for(n = 1; n <= nMax; n++)
     
    60816081///////////////////////////////////////////////////////////////////////////////
    60826082proc prepareAss(ideal i)
    6083 "USAGE:   prepareAss(i); i ideal
    6084 RETURN:  list, the radicals of the maximal dimensional components of i.
     6083"USAGE:   prepareAss(I); I ideal
     6084RETURN:  list, the radicals of the maximal dimensional components of I.
    60856085NOTE:    Uses algorithm of Eisenbud/Huneke/Vasconcelos.
    60866086EXAMPLE: example prepareAss; shows an example
     
    61296129///////////////////////////////////////////////////////////////////////////////
    61306130proc equidimMaxEHV(ideal i)
    6131 "USAGE:  equidimMaxEHV(i); i ideal
    6132 RETURN:  ideal, the equidimensional component (of maximal dimension) of i.
     6131"USAGE:  equidimMaxEHV(I); I ideal
     6132RETURN:  ideal, the equidimensional component (of maximal dimension) of I.
    61336133NOTE:    Uses algorithm of Eisenbud, Huneke and Vasconcelos.
    61346134EXAMPLE: example equidimMaxEHV; shows an example
     
    63406340  if(size(#)>0)
    63416341  {
    6342    int count = 1;
    6343    if(typeof(#[count]) == "string") {
    6344      if ((#[count] == "oneIndep") or (#[count] == "allIndep")){
    6345        indepOption = #[count];
    6346         count++;
    6347      };
    6348    };
    6349    if(typeof(#[count]) == "string") {
    6350      if ((#[count] == "intersect") or (#[count] == "noIntersect")){
    6351        intersectOption = #[count];
    6352         count++;
    6353      };
    6354    };
    6355      if((typeof(#[count]) == "int") or (typeof(#[count]) == "number"))
    6356      {
    6357        if ((#[count]==1)||(#[count]==2)||(#[count]==3))
    6358        {
    6359           @wr=#[count];
    6360           if(@wr==3){abspri = 1; @wr = 0;}
    6361           count++;
    6362        };
    6363      };
    6364      if(size(#)>count)
    6365      {
    6366           seri=1;
    6367           peek=#[count + 1];
    6368           ser=#[count + 2];
    6369      };
    6370   };
    6371   if(abspri)
    6372   {
    6373      list absprimary,abskeep,absprimarytmp,abskeeptmp;
    6374   }
    6375   homo=homog(i);
    6376   if(homo==1)
    6377   {
    6378     if(attrib(i,"isSB")!=1)
    6379     {
    6380       //ltras=mstd(i);
    6381       tras=groebner(i);
    6382       ltras=tras,tras;
    6383       attrib(ltras[1],"isSB",1);
    6384     }
    6385     else
    6386     {
    6387       ltras=i,i;
    6388       attrib(ltras[1],"isSB",1);
    6389     }
    6390     tras = ltras[1];
    6391     attrib(tras,"isSB",1);
    6392     if(dim(tras)==0)
    6393     {
     6342     int count = 1;
     6343     if(typeof(#[count]) == "string") {
     6344        if ((#[count] == "oneIndep") or (#[count] == "allIndep")){
     6345           indepOption = #[count];
     6346           count++;
     6347        }
     6348      }
     6349      if(typeof(#[count]) == "string") {
     6350         if ((#[count] == "intersect") or (#[count] == "noIntersect")){
     6351            intersectOption = #[count];
     6352            count++;
     6353         }
     6354      }
     6355      if((typeof(#[count]) == "int") or (typeof(#[count]) == "number"))
     6356      {
     6357         if ((#[count]==1)||(#[count]==2)||(#[count]==3))
     6358         {
     6359            @wr=#[count];
     6360            if(@wr==3){abspri = 1; @wr = 0;}
     6361            count++;
     6362         }
     6363      }
     6364      if(size(#)>count)
     6365      {
     6366         seri=1;
     6367         peek=#[count + 1];
     6368         ser=#[count + 2];
     6369      }
     6370   }
     6371   if(abspri)
     6372   {
     6373      list absprimary,abskeep,absprimarytmp,abskeeptmp;
     6374   }
     6375   homo=homog(i);
     6376   if(homo==1)
     6377   {
     6378     if(attrib(i,"isSB")!=1)
     6379     {
     6380       //ltras=mstd(i);
     6381       tras=groebner(i);
     6382       ltras=tras,tras;
     6383       attrib(ltras[1],"isSB",1);
     6384     }
     6385     else
     6386     {
     6387       ltras=i,i;
     6388       attrib(ltras[1],"isSB",1);
     6389     }
     6390     tras = ltras[1];
     6391     attrib(tras,"isSB",1);
     6392     if(dim(tras)==0)
     6393     {
    63946394        primary[1]=ltras[2];
    63956395        primary[2]=maxideal(1);
     
    63996399           l[1]=maxideal(1);
    64006400           l[2]=maxideal(1);
    6401        if (intersectOption == "intersect") {
    6402          return(list(l, maxideal(1)));
    6403        } else {
    6404          return(l);
    6405        };
     6401           if (intersectOption == "intersect") {
     6402              return(list(l, maxideal(1)));
     6403           } else {
     6404              return(l);
     6405           }
    64066406        }
    64076407        if (intersectOption == "intersect") {
    6408          return(list(primary, primary[1]));
    6409        } else {
    6410          return(primary);
    6411        };
    6412 
     6408           return(list(primary, primary[1]));
     6409        } else {
     6410           return(primary);
     6411        }
    64136412     }
    64146413     for(@n=1;@n<=nvars(basering);@n++)
     
    64266425  if(size(i)==0)
    64276426  {
    6428      primary=i,i;
     6427    primary=i,i;
    64296428    if (intersectOption == "intersect") {
    64306429       return(list(primary, i));
    64316430    } else {
    64326431       return(primary);
    6433    };
     6432    }
    64346433  }
    64356434
     
    64496448     if(!lp)
    64506449     {
    6451        ideal @j=std(fetch(@P,i),@hilb,@w);
     6450        ideal @j=std(fetch(@P,i),@hilb,@w);
    64526451     }
    64536452     else
     
    64966495       primary[1]=i;
    64976496       primary[2]=i;
    6498      if (intersectOption == "intersect") {
    6499        return(list(primary, i));
    6500      } else {
    6501        return(primary);
    6502      };
     6497       if (intersectOption == "intersect") {
     6498         return(list(primary, i));
     6499       } else {
     6500         return(primary);
     6501       }
    65036502    }
    65046503    if(size(fried)>0)
     
    65406539       } else {
    65416540         list pr = result;
    6542        };
     6541       }
    65436542
    65446543       setring gnir;
     
    65486547         @j=pr[@k]+fried;
    65496548         pr[@k]=@j;
    6550        };
     6549       }
    65516550       if (intersectOption == "intersect") {
    6552       ideal intersection = imap(@deirf, intersection);
    6553       @j = intersection + fried;
    6554       intersection = @j;
    6555      };
    6556      setring @P;
    6557      if (intersectOption == "intersect") {
    6558        return(list(imap(gnir,pr), imap(gnir,intersection)));
    6559      } else {
    6560        return(imap(gnir,pr));
    6561      };
     6551         ideal intersection = imap(@deirf, intersection);
     6552         @j = intersection + fried;
     6553         intersection = @j;
     6554       }
     6555       setring @P;
     6556       if (intersectOption == "intersect") {
     6557         return(list(imap(gnir,pr), imap(gnir,intersection)));
     6558       } else {
     6559         return(imap(gnir,pr));
     6560       }
    65626561    }
    65636562  }
     
    65706569    setring @P;
    65716570    primary=ideal(1),ideal(1);
    6572    if (intersectOption == "intersect") {
    6573      return(list(primary, ideal(1)));
    6574    } else {
    6575      return(primary);
    6576    };
     6571    if (intersectOption == "intersect") {
     6572      return(list(primary, ideal(1)));
     6573    } else {
     6574      return(primary);
     6575    }
    65776576  }
    65786577
     
    65836582  if(nvars(basering)==1)
    65846583  {
    6585 
    65866584     list fac=factor(@j[1]);
    65876585     list gprimary;
     
    66026600        if (intersectOption == "intersect") {
    66036601          generator = generator * fac[1][@k];
    6604         };
    6605      };
    6606    if (intersectOption == "intersect") {
    6607        gIntersection = generator;
    6608    };
    6609 
     6602        }
     6603     }
     6604     if (intersectOption == "intersect") {
     6605        gIntersection = generator;
     6606     }
    66106607     setring @P;
    66116608     primary=fetch(gnir,gprimary);
    6612    if (intersectOption == "intersect") {
     6609     if (intersectOption == "intersect") {
    66136610       ideal intersection = fetch(gnir,gIntersection);
    6614      };
     6611     }
    66156612
    66166613//HIER
     
    66296626       for(ab=1;ab<=size(primary);ab++) {
    66306627          intersection = intersect(intersection, primary[ab][2]);
    6631         };
    6632      };
     6628        }
     6629     }
    66336630     if (intersectOption == "intersect") {
    6634      return(list(primary, intersection));
     6631       return(list(primary, intersection));
    66356632     } else {
    6636      return(primary);
    6637      };
     6633       return(primary);
     6634     }
    66386635  }
    66396636
     
    66676664       primary=resu;
    66686665    }
    6669    if (intersectOption == "intersect") {
    6670      return(list(primary, fetch(gnir,@j)));
    6671    } else {
    6672      return(primary);
    6673    };
    6674 
     6666    if (intersectOption == "intersect") {
     6667      return(list(primary, fetch(gnir,@j)));
     6668    } else {
     6669      return(primary);
     6670    }
    66756671  }
    66766672
     
    66906686  if(@wr!=1)
    66916687  {
    6692    allindep = newMaxIndependSetLp(@j, indepOption);
     6688     allindep = newMaxIndependSetLp(@j, indepOption);
    66936689     for(@m=1;@m<=size(allindep);@m++)
    66946690     {
     
    67586754      absprimary = absprimary + result[2];
    67596755      abskeep = abskeep + result[3];
    6760       };
     6756    }
    67616757    @h = result[5];
    67626758    ser = result[4];
    6763      if(size(@h)>0)
    6764      {
    6765            //---------------------------------------------------------------
    6766            //we change to @Phelp to have the ordering dp for saturation
    6767            //---------------------------------------------------------------
     6759    if(size(@h)>0)
     6760    {
     6761        //---------------------------------------------------------------
     6762        //we change to @Phelp to have the ordering dp for saturation
     6763        //---------------------------------------------------------------
    67686764
    67696765        setring @Phelp;
     
    68176813        ser = imap(@Phelp, ser);
    68186814        @j = imap(@Phelp, jwork);
    6819      };
     6815     }
    68206816  }
    68216817
     
    68816877     if(size(reduce(ser,peek,1))!=0)
    68826878     {
    6883     for(@m=1;@m<=size(restindep);@m++)
     6879        for(@m=1;@m<=size(restindep);@m++)
    68846880        {
    68856881         // if(restindep[@m][3]>=keepdi)
     
    70187014                 hpl=hpl,leadcoef(uprimary[@n][@n1]);
    70197015              }
    7020                saturn[@n]=hpl;
     7016              saturn[@n]=hpl;
    70217017           }
    70227018           //------------------------------------------------------------------
     
    71667162   } else {
    71677163     return(primary);
    7168    };
     7164   }
    71697165}
    71707166example
     
    71797175}
    71807176
    7181 //
    7182 proc newReduction(ideal @j, ideal ser, intvec @hilb, intvec @w, int jdim, int abspri, int @wr, list data)
     7177// This was part of proc decomp.
     7178// In proc newDecompStep, used for the computation of the minimal associated primes,
     7179// this part was separated as a soubrutine to make the code more clear.
     7180// Also, since the reduction is performed twice in proc newDecompStep, it should use both times this routine.
     7181// This is not yet implemented, since the reduction is not exactly the same and some changes should be made.
     7182static proc newReduction(ideal @j, ideal ser, intvec @hilb, intvec @w, int jdim, int abspri, int @wr, list data)
    71837183{
    71847184   string @va;
     
    73247324
    73257325       int zeroMinAss = @wr;
    7326        if (@wr == 2) {zeroMinAss = 1;};
    7327         list uprimary= newZero_decomp(@j, ser, zeroMinAss);
     7326       if (@wr == 2) {zeroMinAss = 1;}
     7327       list uprimary= newZero_decomp(@j, ser, zeroMinAss);
    73287328
    73297329//HIER
     
    74477447
    74487448proc minAss(ideal i,list #)
    7449 "USAGE:   minAss(i); i ideal
    7450           minAss(i,#); i ideal, # list: same as minAssGTZ
    7451 RETURN:  a list, the minimal associated prime ideals of i.
     7449"USAGE:   minAss(I[, l]); i ideal, l list (optional) of parameters, same as minAssGTZ
     7450RETURN:  a list, the minimal associated prime ideals of I.
    74527451NOTE:    Designed for characteristic 0, works also in char k > 0 based
    74537452         on an algorithm of Yokoyama
     
    75157514    } else {
    75167515      stop = 1
    7517     };
    7518   };
     7516    }
     7517  }
    75197518  // Returns only the primary components, not the radical.
    75207519  return(primaryDec);
     
    75367535    good = 1 - rad_con(P[k], I);
    75377536    k++;
    7538   };
     7537  }
    75397538  k--;
    75407539  if (good == 0) {
     
    75427541    dbprint (printlevel - voice, "// No element was found, P = sqrt(I).");
    75437542    return (list(primaryDec, ideal(0)));
    7544   };
     7543  }
    75457544  // Debug
    75467545  dbprint (printlevel - voice, "// We found h = ", P[k]);
     
    75897588   } else {
    75907589     indepOption = "allIndep";
    7591    };
     7590   }
    75927591
    75937592   int nMax;
     
    75967595   } else {
    75977596      nMax = 1;
    7598    };
     7597   }
    75997598
    76007599   for(n = 1; n <= nMax; n++)
     
    76587657proc newZero_decomp (ideal j, ideal ser, int @wr, list #)
    76597658"USAGE:   newZero_decomp(j,ser,@wr); j,ser ideals, @wr=0 or 1
    7660          (@wr=0 for primary decomposition, @wr=1 for computaion of associated
     7659         (@wr=0 for primary decomposition, @wr=1 for computation of associated
    76617660         primes)
    76627661         if #[1] = "nest", then #[2] indicates the nest level (number of recursive calls)
     
    77017700      if (#[1] == "nest") {
    77027701        nestLevel = #[2];
    7703       };
     7702      }
    77047703      # = list();
    7705     };
    7706   };
     7704    }
     7705  }
    77077706
    77087707  if(vdim(j)==deg(j[1]))
     
    78607859  }
    78617860
    7862   if(nestLevel > 1){primary=extF(primary);};
     7861  if(nestLevel > 1){primary=extF(primary);}
    78637862
    78647863//test whether all ideals in the decomposition are primary and
Note: See TracChangeset for help on using the changeset viewer.