Changeset b1fb09 in git
- Timestamp:
- Jan 23, 2007, 2:03:59 PM (16 years ago)
- Branches:
- (u'spielwiese', 'd1ba061a762c62d3a25159d8da8b6e17332291fa')
- Children:
- a2c203153a35ac48102771cb18fc358aab446969
- Parents:
- a38082faca14f3369605c3c541368da3a8a95d58
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/finvar.lib
ra38082 rb1fb09 1 1 /////////////////////////////////////////////////////////////////////////////// 2 version="$Id: finvar.lib,v 1.5 3 2007-01-22 16:34:33Singular Exp $"2 version="$Id: finvar.lib,v 1.54 2007-01-23 13:03:59 Singular Exp $" 3 3 category="Invariant theory"; 4 4 info=" … … 40 40 irred_secondary_char0() irreducible secondary invariants in char 0 41 41 secondary_charp() secondary invariants in char p 42 secondary_charp_degbound() finds all (irred.) secondary invariants in char p43 up to a given degree bound, without using Molien44 series or Reynolds operator45 42 secondary_no_molien() secondary invariants, without Molien series 46 43 but with Reynolds operator … … 1621 1618 print(invariant_basis(2,A)); 1622 1619 } 1623 ///////////////////////////////////////////////////////////////////////////////1624 1625 static proc invariant_basis_modS (int g,ideal sS, list #)1626 "USAGE: invariant_basis(g,sP,G1,G2,...);1627 g: an <int> indicating of which degree (>0) the homogeneous basis1628 shoud be,1629 sS: normal forms of subsequently found sec. inv. in degree g,1630 G1,G2,...: <matrices> generating a finite matrix group1631 RETURNS: invariants of degree g1632 THEORY: A general polynomial of degree g is generated and the generators of1633 the matrix group applied. The difference ought to be 0 and this way a1634 system of linear equations is created. It is solved by computing1635 syzygies.1636 "1637 { if (g<=0)1638 { "ERROR: the first parameter should be > 0";1639 return();1640 }1641 def br=basering;1642 ideal mon=sort(kbase(sS,g))[1]; // needed for constructing a general1643 int m=ncols(mon); // homogeneous polynomial of degree g1644 mon=sort(mon,intvec(m..1))[1];1645 int a=size(#);1646 int i;1647 int n=nvars(br);1648 //---------------------- checking that the input is ok -----------------------1649 for (i=1;i<=a;i++)1650 { if (typeof(#[i])=="matrix")1651 { if (nrows(#[i])==n && ncols(#[i])==n)1652 { matrix G(i)=#[i];1653 }1654 else1655 { "ERROR: the number of variables of the base ring needs to be the same";1656 " as the dimension of the square matrices";1657 return();1658 }1659 }1660 else1661 { "ERROR: the last parameters should be a list of matrices";1662 return();1663 }1664 }1665 //----------------------------------------------------------------------------1666 execute("ring T=("+charstr(br)+"),("+varstr(br)+",p(1..m)),lp;");1667 // p(1..m) are the general coefficients of the general polynomial of degree g1668 execute("ideal vars="+varstr(br)+";");1669 map f;1670 ideal mon=imap(br,mon);1671 poly P=0;1672 for (i=m;i>=1;i--)1673 { P=P+p(i)*mon[i]; // P is the general polynomial1674 }1675 ideal I; // will help substituting variables in P1676 // by linear combinations of variables -1677 poly Pnew,temp; // Pnew is P with substitutions -1678 matrix S[m*a][m]; // will contain system of linear1679 // equations1680 int j,k;1681 //------------------- building the system of linear equations ----------------1682 for (i=1;i<=a;i++)1683 { I=ideal(matrix(vars)*transpose(imap(br,G(i))));1684 I=I,p(1..m);1685 f=T,I;1686 Pnew=f(P);1687 for (j=1;j<=m;j++)1688 { temp=P/mon[j]-Pnew/mon[j];1689 for (k=1;k<=m;k++)1690 { S[m*(i-1)+j,k]=temp/p(k);1691 }1692 }1693 }1694 //----------------------------------------------------------------------------1695 setring br;1696 map f=T,ideal(0);1697 matrix S=f(S);1698 matrix s=matrix(syz(S)); // s contains a basis of the space of1699 // solutions -1700 ideal I=ideal(matrix(mon)*s); // I contains a basis of homogeneous1701 if (I[1]<>0) // invariants of degree d1702 { for (i=1;i<=ncols(I);i++)1703 { I[i]=I[i]/leadcoef(I[i]); // setting leading coefficients to 11704 }1705 }1706 return(I);1707 }1708 1709 1620 /////////////////////////////////////////////////////////////////////////////// 1710 1621 … … 5641 5552 //---------------- checking input and setting verbose mode ------------------- 5642 5553 if (char(br)==0) 5643 { "ERROR: secondary_charp should only be used with rings of characteristic p>0."; 5644 return(); 5554 { ERROR("ERROR: secondary_charp should only be used with rings of characteristic p>0."); 5645 5555 } 5646 5556 int i; … … 5669 5579 } 5670 5580 else 5671 { "ERROR: If the last optional parameter is a string, it should be \"old\".";5672 return(matrix(ideal()),matrix(ideal()));5581 { ERROR("ERROR: If the last optional parameter is a string, it should be \"old\"."); 5582 //return(matrix(ideal()),matrix(ideal())); 5673 5583 } 5674 5584 } … … 5679 5589 // we should get 5680 5590 if (ncols(P)<>n) 5681 { "ERROR: The first parameter ought to be the matrix of the primary"; 5682 " invariants." 5683 return(); 5591 { ERROR("ERROR: The first parameter ought to be the matrix of the primary"+newline+ 5592 " invariants."); 5684 5593 } 5685 5594 if (ncols(REY)<>n) 5686 { "ERROR: The second parameter ought to be the Reynolds operator." 5687 return(); 5595 { ERROR("ERROR: The second parameter ought to be the Reynolds operator."); 5688 5596 } 5689 5597 if (typeof(`ring_name`)<>"ring") 5690 { "ERROR: The <string> should give the name of the ring where the Molien." 5691 " series is stored."; 5692 return(); 5598 { ERROR("ERROR: The <string> should give the name of the ring where the Molien."+newline+ 5599 " series is stored."); 5693 5600 } 5694 5601 if (v && voice==2) … … 6082 5989 } 6083 5990 else 6084 { "ERROR: the third parameter should be an <intvec>"; 6085 return(); 5991 { ERROR("ERROR: the third parameter should be an <intvec>"); 6086 5992 } 6087 5993 } … … 6095 6001 } 6096 6002 else 6097 { "ERROR: the third parameter should be an <intvec>"; 6098 return(); 6003 { ERROR("ERROR: the third parameter should be an <intvec>"); 6099 6004 } 6100 6005 } 6101 6006 else 6102 { "ERROR: wrong list of parameters"; 6103 return(); 6007 { ERROR("ERROR: wrong list of parameters"); 6104 6008 } 6105 6009 } … … 6107 6011 else 6108 6012 { if (size(#)>2) 6109 { "ERROR: there are too many parameters"; 6110 return(); 6013 { ERROR("ERROR: there are too many parameters"); 6111 6014 } 6112 6015 int v=0; … … 6117 6020 // we should get 6118 6021 if (ncols(P)<>n) 6119 { "ERROR: The first parameter ought to be the matrix of the primary"; 6120 " invariants." 6121 return(); 6022 { ERROR("ERROR: The first parameter ought to be the matrix of the primary"+newline+ 6023 " invariants."); 6122 6024 } 6123 6025 if (ncols(REY)<>n) 6124 { "ERROR: The second parameter ought to be the Reynolds operator." 6125 return(); 6026 { ERROR("ERROR: The second parameter ought to be the Reynolds operator."); 6126 6027 } 6127 6028 if (v && voice==2) … … 6235 6136 } 6236 6137 else 6237 { "ERROR: the third parameter should be an <intvec>"; 6238 return(); 6138 { ERROR("ERROR: the third parameter should be an <intvec>"); 6239 6139 } 6240 6140 } … … 6248 6148 } 6249 6149 else 6250 { "ERROR: the third parameter should be an <intvec>"; 6251 return(); 6150 { ERROR("ERROR: the third parameter should be an <intvec>"); 6252 6151 } 6253 6152 } 6254 6153 else 6255 { "ERROR: wrong list of parameters"; 6256 return(); 6154 { ERROR("ERROR: wrong list of parameters"); 6257 6155 } 6258 6156 } … … 6260 6158 else 6261 6159 { if (size(#)>2) 6262 { "ERROR: there are too many parameters"; 6263 return(); 6160 { ERROR("ERROR: there are too many parameters"); 6264 6161 } 6265 6162 int v=0; … … 6270 6167 // we should get 6271 6168 if (ncols(P)<>n) 6272 { "ERROR: The first parameter ought to be the matrix of the primary"; 6273 " invariants." 6274 return(); 6169 { ERROR("ERROR: The first parameter ought to be the matrix of the primary"+newline+ 6170 " invariants."); 6275 6171 } 6276 6172 if (ncols(REY)<>n) 6277 { "ERROR: The second parameter ought to be the Reynolds operator." 6278 return(); 6173 { ERROR("ERROR: The second parameter ought to be the Reynolds operator."); 6279 6174 } 6280 6175 if (v && voice==2) … … 6426 6321 { int gen_num=size(#)-1; 6427 6322 if (gen_num==0) 6428 { "ERROR: There are no generators of the finite matrix group given."; 6429 return(); 6323 { ERROR("ERROR: There are no generators of the finite matrix group given."); 6430 6324 } 6431 6325 int v=#[size(#)]; 6432 6326 for (i=1;i<=gen_num;i++) 6433 6327 { if (typeof(#[i])<>"matrix") 6434 { "ERROR: These parameters should be generators of the finite matrix group."; 6435 return(); 6328 { ERROR("ERROR: These parameters should be generators of the finite matrix group."); 6436 6329 } 6437 6330 if ((n<>nrows(#[i])) or (n<>ncols(#[i]))) 6438 { "ERROR: matrices need to be square and of the same dimensions"; 6439 return(); 6331 { ERROR("ERROR: matrices need to be square and of the same dimensions"); 6440 6332 } 6441 6333 } … … 6446 6338 for (i=1;i<=gen_num;i++) 6447 6339 { if (typeof(#[i])<>"matrix") 6448 { "ERROR: These parameters should be generators of the finite matrix group."; 6449 return(); 6340 { ERROR("ERROR: These parameters should be generators of the finite matrix group."); 6450 6341 } 6451 6342 if ((n<>nrows(#[i])) or (n<>ncols(#[i]))) 6452 { "ERROR: matrices need to be square and of the same dimensions"; 6453 return(); 6343 { ERROR("ERROR: matrices need to be square and of the same dimensions"); 6454 6344 } 6455 6345 } … … 6457 6347 } 6458 6348 else 6459 { "ERROR: There are no generators of the finite matrix group given."; 6460 return(); 6349 { ERROR("ERROR: There are no generators of the finite matrix group given."); 6461 6350 } 6462 6351 if (ncols(P)<>n) 6463 { "ERROR: The first parameter ought to be the matrix of the primary"; 6464 " invariants." 6465 return(); 6352 { ERROR("ERROR: The first parameter ought to be the matrix of the primary"+newline+ 6353 " invariants."); 6466 6354 } 6467 6355 if (v && voice==2) … … 6617 6505 " 6618 6506 { if (size(#)==0) 6619 { "ERROR: There are no generators given."; 6620 return(); 6507 { ERROR("ERROR: There are no generators given."); 6621 6508 } 6622 6509 int ch=char(basering); // the algorithms depend very much on the … … 6631 6518 if (typeof(#[size(#)])=="intvec") 6632 6519 { if (size(#[size(#)])<>3) 6633 { "ERROR: The <intvec> should have three entries."; 6634 return(); 6520 { ERROR("ERROR: The <intvec> should have three entries."); 6635 6521 } 6636 6522 gen_num=size(#)-1; 6637 6523 mol_flag=#[size(#)][1]; 6638 6524 if (#[size(#)][2]<0 && (ch==0 or (ch<>0 && mol_flag<>0))) 6639 { "ERROR: the second component of <intvec> should be >=0"; 6640 return(); 6525 { ERROR("ERROR: the second component of <intvec> should be >=0"); 6641 6526 } 6642 6527 int interval=#[size(#)][2]; … … 6750 6635 if (mol_flag==-1) 6751 6636 { if (ch==0) 6752 { "ERROR: Characteristic 0 can only be simulated in characteristic p>>0. 6753 "; 6754 return(); 6637 { ERROR("ERROR: Characteristic 0 can only be simulated in characteristic p>>0."); 6755 6638 } 6756 6639 list L=group_reynolds(#[1..gen_num],v); … … 6769 6652 else // the user specified that the 6770 6653 { if (ch==0) // characteristic divides the group order 6771 { "ERROR: The characteristic cannot divide the group order when it is 0. 6772 "; 6773 return(); 6654 { ERROR("ERROR: The characteristic cannot divide the group order when it is 0."); 6774 6655 } 6775 6656 if (v) … … 6826 6707 " 6827 6708 { if (size(#)<2) 6828 { "ERROR: There are too few parameters."; 6829 return(); 6709 { ERROR("ERROR: There are too few parameters."); 6830 6710 } 6831 6711 int ch=char(basering); // the algorithms depend very much on the … … 6840 6720 if (typeof(#[size(#)])=="intvec" && typeof(#[size(#)-1])=="int") 6841 6721 { if (size(#[size(#)])<>3) 6842 { "ERROR: <intvec> should have three entries."; 6843 return(); 6722 { ERROR("ERROR: <intvec> should have three entries."); 6844 6723 } 6845 6724 gen_num=size(#)-2; 6846 6725 mol_flag=#[size(#)][1]; 6847 6726 if (#[size(#)][2]<0 && (ch==0 or (ch<>0 && mol_flag<>0))) 6848 { "ERROR: the second component of <intvec> should be >=0"; 6849 return(); 6727 { ERROR("ERROR: the second component of <intvec> should be >=0"); 6850 6728 } 6851 6729 int interval=#[size(#)][2]; … … 6853 6731 int max=#[size(#)-1]; 6854 6732 if (gen_num==0) 6855 { "ERROR: There are no generators of a finite matrix group given."; 6856 return(); 6733 { ERROR("ERROR: There are no generators of a finite matrix group given."); 6857 6734 } 6858 6735 } … … 6866 6743 } 6867 6744 else 6868 { "ERROR: If the two last parameters are not <int> and <intvec>, the last"; 6869 " parameter should be an <int>."; 6870 return(); 6745 { ERROR("ERROR: If the two last parameters are not <int> and <intvec>, the last"+newline+ 6746 " parameter should be an <int>."); 6871 6747 } 6872 6748 } … … 6874 6750 { if (typeof(#[i])=="matrix") 6875 6751 { if (nrows(#[i])<>n or ncols(#[i])<>n) 6876 { "ERROR: The number of variables of the base ring needs to be the same"; 6877 " as the dimension of the square matrices"; 6878 return(); 6752 { ERROR("ERROR: The number of variables of the base ring needs to be the same"+newline+ 6753 " as the dimension of the square matrices"); 6879 6754 } 6880 6755 } 6881 6756 else 6882 { "ERROR: The first parameters should be a list of matrices"; 6883 return(); 6757 { ERROR("ERROR: The first parameters should be a list of matrices"); 6884 6758 } 6885 6759 } … … 6985 6859 if (mol_flag==-1) 6986 6860 { if (ch==0) 6987 { "ERROR: Characteristic 0 can only be simulated in characteristic p>>0. 6988 "; 6989 return(); 6861 { ERROR("ERROR: Characteristic 0 can only be simulated in characteristic p>>0."); 6990 6862 } 6991 6863 list L=group_reynolds(#[1..gen_num],v); … … 7004 6876 else // the user specified that the 7005 6877 { if (ch==0) // characteristic divides the group order 7006 { "ERROR: The characteristic cannot divide the group order when it is 0. 7007 "; 7008 return(); 6878 { ERROR("ERROR: The characteristic cannot divide the group order when it is 0."); 7009 6879 } 7010 6880 if (v) … … 7039 6909 " 7040 6910 { if (newring=="") 7041 { "ERROR: the second parameter may not be an empty <string>"; 7042 return(); 6911 { ERROR("ERROR: the second parameter may not be an empty <string>"); 7043 6912 } 7044 6913 if (nrows(F)==1) … … 7068 6937 } 7069 6938 else 7070 { "ERROR: the <matrix> may only have one row"; 7071 return(); 6939 { ERROR("ERROR: the <matrix> may only have one row"); 7072 6940 } 7073 6941 } … … 7143 7011 } 7144 7012 else 7145 { "ERROR: the third parameter may either be empty or a <string>."; 7146 return(); 7013 { ERROR("ERROR: the third parameter may either be empty or a <string>."); 7147 7014 } 7148 7015 } … … 7227 7094 } 7228 7095 else 7229 { "ERROR: the <matrix> may only have one row"; 7230 return(); 7096 { ERROR("ERROR: the <matrix> may only have one row"); 7231 7097 } 7232 7098 } … … 7267 7133 " 7268 7134 { if (newring=="") 7269 { "ERROR: the third parameter may not be empty a <string>"; 7270 return(); 7135 { ERROR("ERROR: the third parameter may not be empty a <string>"); 7271 7136 } 7272 7137 degBound=0; … … 7316 7181 } 7317 7182 else 7318 { "ERROR: the <matrix> may only have one row"; 7319 return(); 7183 { ERROR("ERROR: the <matrix> may only have one row"); 7320 7184 } 7321 7185 } … … 7362 7226 } 7363 7227 else 7364 { "ERROR: the <matrix> may only have one row"; 7365 return(); 7228 { ERROR("ERROR: the <matrix> may only have one row"); 7366 7229 } 7367 7230 } … … 7375 7238 /////////////////////////////////////////////////////////////////////////////// 7376 7239 7377 7378 proc secondary_charp_degbound (matrix P, int dmax, list #)7379 "USAGE: secondary_charp_degbound(P,G1,...,Gk[,v]);7380 @* P: a 1xn <matrix> with homogeneous primary invariants, where7381 n is the number of variables of the basering;7382 @* G1,...,Gk matrices generating a matrix group for which P are homogeneous7383 primary invariants.7384 @* v: an optional <int>;7385 ASSUME: The characteristic of basering is not zero7386 RETURN: secondary invariants of the invariant ring (type <matrix>) and7387 irreducible secondary invariants (type <matrix>) of degree at most dmax.7388 DISPLAY: information if v does not equal 07389 THEORY: A basis of invariants of degrees d<dmax+1 is computed using invariant_basis.7390 Among the basis elements and their power products we pick a maximal subset7391 that is linearly independent modulo the primary invariants (see paper \"Some7392 Algorithms in Invariant Theory of Finite Groups\" by Kemper and7393 Steel (1997)) using Groebner basis techniques.7394 @* If dmax is at least the Noether number of the invariant ring, then primary7395 invariants and the irreducible secondaries found by secondary_charp_degbound7396 are algebra generators of the invariant ring. This may work7397 faster than an application of secondary_not_cohen_macaulay.7398 SEE ALSO: secondary_charp, secondary_char0, secondary_not_cohen_macaulay7399 EXAMPLE: example secondary_charp_molien; shows an example7400 "7401 {7402 //---------- Internal parameters, whose choice might improve the performance -----7403 int pieces = 15; // For generating reducible secondaries, blocks of #pieces# secondaries7404 // are formed.7405 // If this parameter is small, the memory consumption will decrease.7406 7407 def br=basering;7408 7409 //---------------- checking input and setting verbose mode -------------------7410 int n=nvars(br); // n is the number of variables, as well7411 // as the size of the matrices, as well7412 // as the number of primary invariants,7413 // we should get7414 if (char(br)==0)7415 { "ERROR: secondary_charp_degbound should only be used with rings of characteristic p>0.";7416 return();7417 }7418 int i;7419 if (size(#)==0)7420 { "ERROR: There are no generators given.";7421 return();7422 }7423 if (typeof(#[size(#)])=="int")7424 { int v=#[size(#)];7425 }7426 else7427 { int v=0;7428 }7429 list GEN;7430 for (i=1;i<size(#);i++)7431 { if ((typeof(#[i])=="matrix") and7432 (ncols(#[i])==n) and (nrows(#[i])==n))7433 { GEN[i] = #[i];7434 }7435 else7436 { "ERROR: The generators should be square matrices of appropriate size.";7437 return();7438 }7439 }7440 if (typeof(#[size(#)])<>"int")7441 { if ((typeof(#[size(#)])=="matrix") and7442 (ncols(#[size(#)])==n) and (nrows(#[size(#)])==n))7443 { GEN[i] = #[size(#)];7444 }7445 else7446 { "ERROR: The last optional parameter should be an integer.";7447 return();7448 }7449 }7450 7451 if (ncols(P)<>n)7452 { "ERROR: The first parameter ought to be the matrix of the primary";7453 " invariants."7454 return();7455 }7456 if (v && voice==2)7457 { "";7458 }7459 if (v)7460 { " In degree 0 we have: 1";7461 "";7462 }7463 //------------------------ initializing variables ----------------------------7464 setring br;7465 ideal ProdCand; // contains products of secondary invariants,7466 // i.e., candidates for reducible sec. inv.7467 ideal Mul1,Mul2;7468 7469 int j, counter, irrcounter, d;7470 int m = dmax+1;7471 int dgb = degBound;7472 degBound = 0;7473 // degBound = dmax;7474 option(redSB);7475 ideal sP = groebner(ideal(P));7476 // This is the only explicit Groebner basis computation!7477 ideal Reductor,SaveRed; // sP union Reductor is a Groebner basis up to degree i-17478 int SizeSave;7479 7480 list SSort; // sec. inv. first sorted by degree and then sorted by the7481 // minimal degree of a non-constant invariant factor.7482 list ISSort; // irr. sec. inv. sorted by degree7483 7484 poly helpP;7485 ideal helpI;7486 ideal Indicator; // will tell us which candidates for sec. inv. we can choose7487 ideal ReducedCandidates;7488 int helpint;7489 int k,k2,k3,minD;7490 int ii;7491 int saveAttr;7492 ideal mon,B,IS; // IS will contain all irr. sec. inv.7493 7494 for (i=1;i<m;i++)7495 { SSort[i] = list();7496 for (k=1;k<=i;k++)7497 { SSort[i][k]=ideal();7498 attrib(SSort[i][k],"size",0);7499 }7500 }7501 //------------------- generating secondary invariants ------------------------7502 for (i=2;i<=m;i++) // going through the invariants of degree i-1 -7503 { // starting with reducibles7504 if (v)7505 { " Looking for Power Products...";7506 }7507 counter = 0; // counts the number of secondaries7508 Reductor = ideal(0);7509 helpint = 0;7510 SaveRed = Reductor;7511 SizeSave = 0;7512 attrib(Reductor,"isSB",1);7513 attrib(SaveRed,"isSB",1);7514 7515 // We start searching for reducible secondary invariants in degree i-1, i.e., those7516 // that are power products of irreducible secondary invariants.7517 // It suffices to restrict the search at products of one _irreducible_ sec. inv. (Mul1)7518 // with some sec. inv. (Mul2).7519 // Moreover, we avoid to consider power products twice since we take a product7520 // into account only if the minimal degree of a non-constant invariant factor in "Mul2" is not7521 // smaller than the degree of "Mul1".7522 for (k=1;k<i-1;k++)7523 { if (typeof(ISSort[k])<>"none")7524 { Mul1 = ISSort[k];7525 }7526 else7527 { Mul1 = ideal(0);7528 }7529 if (Mul1[1]<>0)7530 { for (minD=k;minD<i-k;minD++)7531 { for (k2=1;k2 <= ((attrib(SSort[i-k-1][minD],"size")-1) div pieces)+1; k2++)7532 { Mul2=ideal(0);7533 if (attrib(SSort[i-k-1][minD],"size")>=k2*pieces)7534 { for (k3=1;k3<=pieces;k3++)7535 { Mul2[k3] = SSort[i-k-1][minD][((k2-1)*pieces)+k3];7536 }7537 }7538 else7539 { for (k3=1;k3<=(attrib(SSort[i-k-1][minD],"size") mod pieces);k3++)7540 { Mul2[k3] = SSort[i-k-1][minD][((k2-1)*pieces)+k3];7541 }7542 }7543 // if (i<10)7544 ProdCand = simplify(Mul1*Mul2,4);7545 // else { ProdCand = Mul1*Mul2;}7546 ReducedCandidates = reduce(ProdCand,sP);7547 // sP union SaveRed union Reductor is a homogeneous Groebner basis7548 // up to degree i-1.7549 // We first reduce by sP (which is fixed, so we can do it once for all),7550 // then by SaveRed resp. by Reductor (which is modified during7551 // the computations).7552 Indicator = reduce(ReducedCandidates,SaveRed);7553 // If Indicator[ii]==0 then ReducedCandidates it the reduction7554 // of an invariant that is in the algebra generated by primary7555 // invariants and previously computed secondary invariants.7556 // Otherwise ProdCand[ii] can be taken as secondary invariant.7557 if (size(Indicator)<>0)7558 { for (ii=1;ii<=ncols(ProdCand);ii++) // going through all the power products7559 { helpP = Indicator[ii];7560 if (helpP <> 0)7561 { counter++;7562 saveAttr = attrib(SSort[i-1][k],"size")+1;7563 SSort[i-1][k][saveAttr] = ProdCand[ii];7564 // By construction, this is a _reducible_ s.i.7565 attrib(SSort[i-1][k],"size",saveAttr);7566 if (v)7567 { "We found",counter, " secondaries in degree",i-1;7568 }7569 Reductor = ideal(helpP);7570 // Lemma: If G is a homogeneous Groebner basis up to degree i-1 and p is a7571 // homogeneous polynomial of degree i-1 then G union NF(p,G) is7572 // a homogeneous Groebner basis up to degree i-1.7573 attrib(Reductor, "isSB",1);7574 // if Reductor becomes too large, we reduce the whole of Indicator by7575 // it, save it in SaveRed, and work with a smaller Reductor. This turns7576 // out to save a little time.7577 Indicator=reduce(Indicator,Reductor);7578 SizeSave++;7579 SaveRed[SizeSave] = helpP;7580 attrib(SaveRed, "isSB",1);7581 }7582 }7583 }7584 // attrib(SaveRed, "isSB",1);7585 }7586 }7587 }7588 }7589 7590 // If there are more sec. inv., then these are irreducible!7591 if (v)7592 { "Searching irreducible secondary invariants in degree ", i-1;7593 }7594 B=invariant_basis_modS(i-1,SaveRed,GEN); // B contains enough invariant polynomials of degree d7595 irrcounter=0;7596 j=0; // j goes through all of B -7597 // Compare the comments on the computation of reducible sec. inv.!7598 ReducedCandidates = reduce(B,sP);7599 Indicator = reduce(ReducedCandidates,SaveRed);7600 while (size(Indicator)>0)7601 { j++;7602 helpP = Indicator[j];7603 if (helpP <>0) // B[j] should be added7604 { counter++; irrcounter++;7605 IS=IS,B[j];7606 saveAttr = attrib(SSort[i-1][i-1],"size")+1;7607 SSort[i-1][i-1][saveAttr] = B[j];7608 attrib(SSort[i-1][i-1],"size",saveAttr);7609 if (typeof(ISSort[i-1]) <> "none")7610 { ISSort[i-1][irrcounter] = B[j];7611 }7612 else7613 { ISSort[i-1] = ideal(B[j]);7614 }7615 if (v)7616 { " We found the irreducible sec. inv. "+string(B[j]);7617 }7618 Reductor = ideal(helpP);7619 attrib(Reductor, "isSB",1);7620 Indicator=reduce(Indicator,Reductor);7621 SizeSave++;7622 SaveRed[SizeSave] = helpP;7623 attrib(SaveRed, "isSB",1);7624 }7625 B[j]=0;7626 ReducedCandidates[j]=0;7627 Indicator[j]=0;7628 }7629 if (v)7630 { "";7631 }7632 } // for i7633 if (v)7634 { " We're done!";7635 "";7636 }7637 degBound = dgb;7638 7639 // Prepare return:7640 int TotalNumber;7641 for (k=1;k<m;k++)7642 { for (k2=1;k2<=k;k2++)7643 { if (typeof(attrib(SSort[k][k2],"size"))=="int")7644 { TotalNumber = TotalNumber + attrib(SSort[k][k2],"size");7645 }7646 }7647 }7648 matrix S[1][TotalNumber+1];7649 S[1,1]=1;7650 j=1;7651 for (k=1;k<m;k++)7652 { for (k2=1;k2<=k;k2++)7653 { if (typeof(attrib(SSort[k][k2],"size"))=="int")7654 {for (i=1;i<=attrib(SSort[k][k2],"size");i++)7655 { j++;7656 S[1,j] = SSort[k][k2][i];7657 }7658 SSort[k][k2]=ideal();7659 }7660 }7661 }7662 return(matrix(S),matrix(compress(IS)));7663 }7664 example7665 { "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7 (changed into char 3)"; echo=2;7666 ring R=3,(x,y,z),dp;7667 matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;7668 matrix P=primary_charp_without(A);7669 matrix S,IS=secondary_charp_degbound(P,4,A,1);7670 print(S);7671 print(IS);7672 }7673
Note: See TracChangeset
for help on using the changeset viewer.