Changeset 40beac in git


Ignore:
Timestamp:
Mar 12, 2019, 5:38:42 PM (5 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '9ea349771971bc025429e7c2f664c4ed01240724')
Children:
967eaadf3ad39904af80e08896e41d7046b09df4
Parents:
78231d7139b2194b384eff921c267d7838ebfba8
Message:
fix: doc - redefine in VecField.lib
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/VecField.lib

    r78231d7 r40beac  
    522522    // k loop: compute one step in the sequence of coordinate systems:
    523523    int i,k;
     524    map newbasemap; ideal WHS; matrix eigenvals,D,thesolution; intvec weights;
     525    list l,sols; poly h,g;
    524526    for(k=2;k<=1+V.precision;k++)
    525527    {
     
    527529        //print("DEBUG: W=");print(W);
    528530        // we need the eigenvalues of W to use as homogeneous weights later on
    529         matrix eigenvals = diagEntries(W.lin);
    530         intvec weights = vecToIntvec(eigenvals);
     531        eigenvals = diagEntries(W.lin);
     532        weights = vecToIntvec(eigenvals);
    531533        // newbase will hold the new coordinates. We compute an entire step k,
    532534        // then convert W to newbase.
     
    534536
    535537        // i loop: compute one new coordinate in the current step of the sequence:
    536         map newbasemap;
    537538        for(i=1;i<=W.dimension;i++)
    538539        {
    539540            //print("DEBUG: i");print(i);
    540541            // compute the complement of the weakly homogeneous space (see below)
    541             ideal WHS = weaklyHomogeneousSpaceComplement(k,int(leadcoef(eigenvals[i,1])),weights);
     542            WHS = weaklyHomogeneousSpaceComplement(k,int(leadcoef(eigenvals[i,1])),weights);
    542543            // use this to compute the matrix representation of W restricted to WHS in
    543544            // the monomial basis
    544             matrix D = vecFieldToMatrix(W,WHS);
     545            D = vecFieldToMatrix(W,WHS);
    545546            // subtract current eigenvalue (see algorithm)
    546547            D = D-eigenvals[i,1]*unitmat(ncols(D));
     
    559560            {
    560561                // 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_m
    564                 //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])
    568569                {
    569                     //print("DEBUG: g(i) is already weakly quasihomogeneous in SaitoBase");
     570                    //print("DEBUG: g is already weakly quasihomogeneous in SaitoBase");
    570571                    newbase[i,1] = var(i);
    571572                    i++; // continue does not increment for us!
     
    573574                }
    574575
    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 a
     576                // 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
    577578                // vector in the basis of WHS.
    578                 list 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));
    580581
    581582                // by Saito, there should be a solution. If no solutions are found for a valid
     
    588589                }
    589590
    590                 matrix thesolution = sols[2]; // this is h from p.137, represented as a vector.
    591                 poly h = vecToHomogeneousPoly(thesolution,WHS);
     591                thesolution = sols[2]; // this is h from p.137, represented as a vector.
     592                h = vecToHomogeneousPoly(thesolution,WHS);
    592593                //print("DEBUG: h=");print(h);
    593594
     
    603604        W = changeCoordinates(W,newbasemap);
    604605        //print("DEBUG: new W = ");print(W);
     606        kill newbase;
    605607    } // end of k-loop: we have computed enough steps in the coordinate sequence to be
    606608    // exact up to V.precision.
     
    660662    // k-loop: compute one step in the sequence of coordinate systems:
    661663    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;
    662667    for(k=2;k<=1+numSteps;k++)
    663668    {
     
    665670        // eigenvals will contain a list of arrays, where the n-th array contains
    666671        // all eigenvals of the n-th vecfield
    667         list eigenvals;
    668672        for(i=1;i<=size(W);i++)
    669673        {
    670             matrix t = diagEntries(W[i].lin);
     674            t = diagEntries(W[i].lin);
    671675            eigenvals = insert(eigenvals,t,size(eigenvals));
    672676        }
     
    677681
    678682        // i-loop: compute one new coordinate in the current step of the sequence
    679         map newbasemap;
    680683        for(i=1;i<=W[1].dimension;i++)
    681684        {
    682685            //print("DEBUG: i");print(i);
    683             list weights;
    684             list myLeadCoefs;
    685686            for(j=1;j<=size(W);j++)
    686687            {
    687688                weights = insert(weights,vecToIntvec(eigenvals[j]),size(weights));
    688                 matrix curEigVals = eigenvals[j];
     689                curEigVals = eigenvals[j];
    689690                myLeadCoefs = insert(myLeadCoefs,int(leadcoef(curEigVals[i,1])),size(myLeadCoefs));
    690691            }
     
    692693            list D; // one matrix D per vecfield
    693694
    694             int nontrivialFlag = 0;
     695            nontrivialFlag = 0;
    695696
    696697            for(j=1;j<=size(W);j++)
    697698            {
    698699                //print("DEBUG: j");print(j);
    699                 ideal M = maxideal(k);
     700                M = maxideal(k);
    700701                // notable difference to SaitoBase():
    701702                // we do not compute the weakly homogeneous space.
     
    705706                // and use the resulting coefficients as diagonal entries.
    706707                matrix Dcur[ncols(M)][ncols(M)];
    707                 for(int a=1;a<=ncols(M);a++)
     708                for(a=1;a<=ncols(M);a++)
    708709                {
    709                     poly p = applyVecField(W[j],M[a],1);//apply W.lin to all monomials of deg k
     710                    p = applyVecField(W[j],M[a],1);//apply W.lin to all monomials of deg k
    710711                    //print("DEBUG: M[a],p");print(M[a]);print(p);
    711712                    Dcur[a,a] = leadcoef(p);
    712713                }
    713714                D = insert(D,Dcur,size(D));
    714                 matrix curEigVals = eigenvals[j];
     715                curEigVals = eigenvals[j];
    715716                //print("DEBUG: curEigVals");print(curEigVals);
    716717                D[j] = D[j]-curEigVals[i,1]*unitmat(ncols(D[j]));
     
    720721                    nontrivialFlag = 1;
    721722                }
     723                kill Dcur;
    722724            }
    723725            if(nontrivialFlag == 0)
     
    730732            {
    731733                // paste all Ds together into one single matrix
    732                 int numRows = 0;
     734                numRows = 0;
    733735                for(j=1;j<=size(W);j++)
    734736                {
     
    743745                for(j=1;j<=size(W);j++)
    744746                {
    745                     matrix curVec = W[j].vec;
     747                    curVec = W[j].vec;
    746748                    poly g(j) = curVec[i,1];
    747749                    g(j) = homogeneousPart(g(j),k);
     
    752754                // paste the vector representations of all g(j) together into one big vector:
    753755                matrix g[numRows][1];
    754                 int counter = 1;
     756                counter = 1;
    755757                for(j=1;j<=size(W);j++)
    756758                {
    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++)
    759762                    {
    760763                        g[counter,1] = gj[irow,1];
     
    764767                //print("DEBUG: g");print(g);
    765768                //exists h(i): D*h(i) = g(i)
    766                 list l = ludecomp(Dcomp);
    767                 list sols =lusolve(l[1],l[2],l[3],g);
     769                l = ludecomp(Dcomp);
     770                sols =lusolve(l[1],l[2],l[3],g);
    768771                if(sols[1]==0)
    769772                {
     
    771774                    ERROR("error in diagonalizeVecField: no solutions found");
    772775                }
    773                 matrix thesolution = sols[2];
    774                 poly h = vecToHomogeneousPoly(thesolution,maxideal(k));
     776                thesolution = sols[2];
     777                h = vecToHomogeneousPoly(thesolution,maxideal(k));
    775778                //print("DEBUG: h=");print(h);
    776779
    777780                newbase[i,1] = var(i)+h;
    778781            }
     782            kill Dcomp,D;
    779783        } // end of i-loop
    780784
     
    813817{
    814818    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;
    816823    for(int j=1;j<=ncols(W);j++)
    817824    {
    818825        // compute the image of the j-th basis vector:
    819826        // only the image of the linear part of V is interesting
    820         matrix linpart = V.lin * pvector();
    821         VecField Vtemp = [linpart[1..nrows(linpart),1]];
     827        linpart = V.lin * pvector();
     828        Vtemp = [linpart[1..nrows(linpart),1]];
    822829        Vtemp.precision = V.precision;
    823         poly p = applyVecField(Vtemp,W[j]);
     830        p = applyVecField(Vtemp,W[j]);
    824831
    825832        // find out how to write this in the basis again by brute force:
    826         poly mon,lcoef;
    827833        while(p != 0)
    828834        {
     
    830836            lcoef = leadcoef(p);
    831837            p = p-mon*lcoef;
    832             for(int h=1;h<=ncols(W);h++)
     838            for(h=1;h<=ncols(W);h++)
    833839            {
    834840                if(mon == W[h])
Note: See TracChangeset for help on using the changeset viewer.