Changeset 40beac in git
- Timestamp:
- Mar 12, 2019, 5:38:42 PM (5 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 967eaadf3ad39904af80e08896e41d7046b09df4
- Parents:
- 78231d7139b2194b384eff921c267d7838ebfba8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/VecField.lib
r78231d7 r40beac 522 522 // k loop: compute one step in the sequence of coordinate systems: 523 523 int i,k; 524 map newbasemap; ideal WHS; matrix eigenvals,D,thesolution; intvec weights; 525 list l,sols; poly h,g; 524 526 for(k=2;k<=1+V.precision;k++) 525 527 { … … 527 529 //print("DEBUG: W=");print(W); 528 530 // we need the eigenvalues of W to use as homogeneous weights later on 529 matrixeigenvals = diagEntries(W.lin);530 intvecweights = vecToIntvec(eigenvals);531 eigenvals = diagEntries(W.lin); 532 weights = vecToIntvec(eigenvals); 531 533 // newbase will hold the new coordinates. We compute an entire step k, 532 534 // then convert W to newbase. … … 534 536 535 537 // i loop: compute one new coordinate in the current step of the sequence: 536 map newbasemap;537 538 for(i=1;i<=W.dimension;i++) 538 539 { 539 540 //print("DEBUG: i");print(i); 540 541 // compute the complement of the weakly homogeneous space (see below) 541 idealWHS = weaklyHomogeneousSpaceComplement(k,int(leadcoef(eigenvals[i,1])),weights);542 WHS = weaklyHomogeneousSpaceComplement(k,int(leadcoef(eigenvals[i,1])),weights); 542 543 // use this to compute the matrix representation of W restricted to WHS in 543 544 // the monomial basis 544 matrixD = vecFieldToMatrix(W,WHS);545 D = vecFieldToMatrix(W,WHS); 545 546 // subtract current eigenvalue (see algorithm) 546 547 D = D-eigenvals[i,1]*unitmat(ncols(D)); … … 559 560 { 560 561 // compute the polynomial g from the algorithm 561 poly g(i)= W.vec[i,1];562 g (i) = homogeneousPart(g(i),k);563 g (i) = -g(i); // g(i)is now -{g_m(x_m)}_m+1,_x_m564 //print("DEBUG: g (i)");print(g(i));565 566 // see whether g (i)is already weakly quasihomogeneous. If so, set h=0:567 if(deg(g (i),weights) == eigenvals[i,1])562 g = W.vec[i,1]; 563 g = homogeneousPart(g,k); 564 g = -g; // g is now -{g_m(x_m)}_m+1,_x_m 565 //print("DEBUG: g");print(g); 566 567 // see whether g is already weakly quasihomogeneous. If so, set h=0: 568 if(deg(g,weights) == eigenvals[i,1]) 568 569 { 569 //print("DEBUG: g (i)is already weakly quasihomogeneous in SaitoBase");570 //print("DEBUG: g is already weakly quasihomogeneous in SaitoBase"); 570 571 newbase[i,1] = var(i); 571 572 i++; // continue does not increment for us! … … 573 574 } 574 575 575 // g (i) is not weakly quasihomogeneous. Satio: there exists h(i) s.t. D*h(i) = g(i)576 // compute h(i) via LU decomposition, representing g (i)as a576 // g is not weakly quasihomogeneous. Satio: there exists h(i) s.t. D*h(i) = g 577 // compute h(i) via LU decomposition, representing g as a 577 578 // vector in the basis of WHS. 578 l ist l= ludecomp(D);579 list sols =lusolve(l[1],l[2],l[3],homogeneousPolyToVec(g(i),WHS));579 l = ludecomp(D); 580 sols =lusolve(l[1],l[2],l[3],homogeneousPolyToVec(g,WHS)); 580 581 581 582 // by Saito, there should be a solution. If no solutions are found for a valid … … 588 589 } 589 590 590 matrixthesolution = sols[2]; // this is h from p.137, represented as a vector.591 polyh = vecToHomogeneousPoly(thesolution,WHS);591 thesolution = sols[2]; // this is h from p.137, represented as a vector. 592 h = vecToHomogeneousPoly(thesolution,WHS); 592 593 //print("DEBUG: h=");print(h); 593 594 … … 603 604 W = changeCoordinates(W,newbasemap); 604 605 //print("DEBUG: new W = ");print(W); 606 kill newbase; 605 607 } // end of k-loop: we have computed enough steps in the coordinate sequence to be 606 608 // exact up to V.precision. … … 660 662 // k-loop: compute one step in the sequence of coordinate systems: 661 663 int numSteps = W[1].precision; 664 poly h,p; matrix thesolution,curVec,curEigVals,gj,t; 665 list sols,eigenvals,myLeadCoefs,weights; ideal M; 666 int counter,numRows,nontrivialFlag,irow,a; map newbasemap; 662 667 for(k=2;k<=1+numSteps;k++) 663 668 { … … 665 670 // eigenvals will contain a list of arrays, where the n-th array contains 666 671 // all eigenvals of the n-th vecfield 667 list eigenvals;668 672 for(i=1;i<=size(W);i++) 669 673 { 670 matrixt = diagEntries(W[i].lin);674 t = diagEntries(W[i].lin); 671 675 eigenvals = insert(eigenvals,t,size(eigenvals)); 672 676 } … … 677 681 678 682 // i-loop: compute one new coordinate in the current step of the sequence 679 map newbasemap;680 683 for(i=1;i<=W[1].dimension;i++) 681 684 { 682 685 //print("DEBUG: i");print(i); 683 list weights;684 list myLeadCoefs;685 686 for(j=1;j<=size(W);j++) 686 687 { 687 688 weights = insert(weights,vecToIntvec(eigenvals[j]),size(weights)); 688 matrixcurEigVals = eigenvals[j];689 curEigVals = eigenvals[j]; 689 690 myLeadCoefs = insert(myLeadCoefs,int(leadcoef(curEigVals[i,1])),size(myLeadCoefs)); 690 691 } … … 692 693 list D; // one matrix D per vecfield 693 694 694 intnontrivialFlag = 0;695 nontrivialFlag = 0; 695 696 696 697 for(j=1;j<=size(W);j++) 697 698 { 698 699 //print("DEBUG: j");print(j); 699 idealM = maxideal(k);700 M = maxideal(k); 700 701 // notable difference to SaitoBase(): 701 702 // we do not compute the weakly homogeneous space. … … 705 706 // and use the resulting coefficients as diagonal entries. 706 707 matrix Dcur[ncols(M)][ncols(M)]; 707 for( inta=1;a<=ncols(M);a++)708 for(a=1;a<=ncols(M);a++) 708 709 { 709 p oly p= applyVecField(W[j],M[a],1);//apply W.lin to all monomials of deg k710 p = applyVecField(W[j],M[a],1);//apply W.lin to all monomials of deg k 710 711 //print("DEBUG: M[a],p");print(M[a]);print(p); 711 712 Dcur[a,a] = leadcoef(p); 712 713 } 713 714 D = insert(D,Dcur,size(D)); 714 matrixcurEigVals = eigenvals[j];715 curEigVals = eigenvals[j]; 715 716 //print("DEBUG: curEigVals");print(curEigVals); 716 717 D[j] = D[j]-curEigVals[i,1]*unitmat(ncols(D[j])); … … 720 721 nontrivialFlag = 1; 721 722 } 723 kill Dcur; 722 724 } 723 725 if(nontrivialFlag == 0) … … 730 732 { 731 733 // paste all Ds together into one single matrix 732 intnumRows = 0;734 numRows = 0; 733 735 for(j=1;j<=size(W);j++) 734 736 { … … 743 745 for(j=1;j<=size(W);j++) 744 746 { 745 matrixcurVec = W[j].vec;747 curVec = W[j].vec; 746 748 poly g(j) = curVec[i,1]; 747 749 g(j) = homogeneousPart(g(j),k); … … 752 754 // paste the vector representations of all g(j) together into one big vector: 753 755 matrix g[numRows][1]; 754 intcounter = 1;756 counter = 1; 755 757 for(j=1;j<=size(W);j++) 756 758 { 757 matrix gj = homogeneousPolyToVec(g(j),maxideal(k)); 758 for(int irow=1;irow<=nrows(D[j]);irow++) 759 gj = homogeneousPolyToVec(g(j),maxideal(k)); 760 kill g(j); 761 for(irow=1;irow<=nrows(D[j]);irow++) 759 762 { 760 763 g[counter,1] = gj[irow,1]; … … 764 767 //print("DEBUG: g");print(g); 765 768 //exists h(i): D*h(i) = g(i) 766 l ist l= ludecomp(Dcomp);767 listsols =lusolve(l[1],l[2],l[3],g);769 l = ludecomp(Dcomp); 770 sols =lusolve(l[1],l[2],l[3],g); 768 771 if(sols[1]==0) 769 772 { … … 771 774 ERROR("error in diagonalizeVecField: no solutions found"); 772 775 } 773 matrixthesolution = sols[2];774 polyh = vecToHomogeneousPoly(thesolution,maxideal(k));776 thesolution = sols[2]; 777 h = vecToHomogeneousPoly(thesolution,maxideal(k)); 775 778 //print("DEBUG: h=");print(h); 776 779 777 780 newbase[i,1] = var(i)+h; 778 781 } 782 kill Dcomp,D; 779 783 } // end of i-loop 780 784 … … 813 817 { 814 818 matrix D[ncols(W)][ncols(W)]; // this will hold the matrix representation 815 819 matrix linpart; 820 VecField Vtemp; 821 poly p,mon,lcoef; 822 int h; 816 823 for(int j=1;j<=ncols(W);j++) 817 824 { 818 825 // compute the image of the j-th basis vector: 819 826 // only the image of the linear part of V is interesting 820 matrixlinpart = V.lin * pvector();821 V ecField Vtemp = [linpart[1..nrows(linpart),1]];827 linpart = V.lin * pvector(); 828 Vtemp = [linpart[1..nrows(linpart),1]]; 822 829 Vtemp.precision = V.precision; 823 p oly p= applyVecField(Vtemp,W[j]);830 p = applyVecField(Vtemp,W[j]); 824 831 825 832 // find out how to write this in the basis again by brute force: 826 poly mon,lcoef;827 833 while(p != 0) 828 834 { … … 830 836 lcoef = leadcoef(p); 831 837 p = p-mon*lcoef; 832 for( inth=1;h<=ncols(W);h++)838 for(h=1;h<=ncols(W);h++) 833 839 { 834 840 if(mon == W[h])
Note: See TracChangeset
for help on using the changeset viewer.