Changeset 864fc2 in git for kernel/gfan.cc


Ignore:
Timestamp:
Apr 8, 2009, 4:02:26 PM (15 years ago)
Author:
Martin Monerjan
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
e7778adedbf4b7cd363cb88f576d7b16023f2ca3
Parents:
7e96fe079ce8711823d420d4b4ba8e959e156a77
Message:
created gcone::restOfDiv(poly, ideal) to compute f^{G} and
gcone::ffG(ideal, ideal) to compute f-f^{G}. However checks and construction
of zeropolynomial don't work. This rev will hang in restOfDiv line 488

Substituted fast_map stuff by idrCopyR


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

Legend:

Unmodified
Added
Removed
  • kernel/gfan.cc

    r7e96fe r864fc2  
    22Compute the Groebner fan of an ideal
    33$Author: monerjan $
    4 $Date: 2009-04-07 09:44:20 $
    5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.30 2009-04-07 09:44:20 monerjan Exp $
    6 $Id: gfan.cc,v 1.30 2009-04-07 09:44:20 monerjan Exp $
     4$Date: 2009-04-08 14:02:26 $
     5$Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.31 2009-04-08 14:02:26 monerjan Exp $
     6$Id: gfan.cc,v 1.31 2009-04-08 14:02:26 monerjan Exp $
    77*/
    88
     
    1212
    1313#include "kstd1.h"
     14#include "kutil.h"
    1415#include "intvec.h"
    1516#include "polys.h"
     
    1819#include "fast_maps.h"  //Mapping of ideals
    1920#include "maps.h"
     21#include "ring.h"
     22#include "prCopy.h"
    2023#include "iostream.h"   //deprecated
    2124
     
    438441                        rComplete(dstRing);
    439442                        rChangeCurrRing(dstRing);
    440                         map theMap=(map)idMaxIdeal(1);
     443                        //map theMap=(map)idMaxIdeal(1);
    441444                        rWrite(currRing); cout << endl;
    442445                        ideal ina;
    443                         ina=fast_map(initialForm,srcRing,(ideal)theMap,dstRing);                       
     446                        //ina=fast_map(initialForm,srcRing,(ideal)theMap,dstRing);                     
     447                        ina=idrCopyR(initialForm,srcRing);
    444448                        cout << "ina=";
    445449                        idShow(ina); cout << endl;
     
    455459                        ideal srcRing_HH;
    456460                        //map theMap = (map)idMaxIdeal(1);
    457                         srcRing_H=fast_map(H,dstRing,(ideal)theMap,srcRing);
    458                         srcRing_HH=srcRing_H-stdred(srcRing_H,this->gcBasis);
     461                        //srcRing_H=fast_map(H,dstRing,(ideal)theMap,srcRing);
     462                        srcRing_H=idrCopyR(H,dstRing);
     463                        idShow(srcRing_H);
     464                        srcRing_HH=ffG(srcRing_H,this->gcBasis);                       
     465                        idShow(srcRing_HH);
    459466                        /*Substep 2.3
    460467                        turn the minimal basis into a reduced one
     
    463470                }//void flip(ideal gb, facet *f)
    464471                               
     472                /** \brief Compute the remainder of a polynomial by a given ideal
     473                *
     474                * Compute \f$ f^{\mathcal{G}} \f$
     475                * Algorithm is taken from Cox, Little, O'Shea, IVA 2nd Ed. p 62
     476                * However, since we are only interested in the remainder, there is no need to
     477                * compute the factors \f$ a_i \f$
     478                */
     479                poly restOfDiv(poly const &f, ideal const &I)
     480                {
     481                        cout << "Entering restOfDiv" << endl;
     482                        poly p=f;
     483                        pWrite(p);
     484                        //poly r=kCreateZeroPoly(,currRing,currRing);   //The 0-polynomial, hopefully
     485                        poly r=0;
     486                        int ii;
     487                        bool divOccured;
     488                        cout << "TICK 1" << endl;       //Hangs after this line. Zeropoly stuff
     489                        while (pHead(p)!=NULL)
     490                        {
     491                                ii=1;
     492                                divOccured=TRUE;
     493                                while( (ii<=IDELEMS(I) && (divOccured==FALSE) ))
     494                                {
     495                                        cout << "TICK 2" << endl;
     496                                        if (pLmDivisibleBy(I->m[ii],p))
     497                                        {
     498                                                cout << "TICK 3" << endl;
     499                                                p=pSub(p,pMult( pDivide(pHead(p),pHead(I->m[ii])), I->m[ii]));
     500                                                cout << "TICK 4" << endl;
     501                                                pWrite(p);
     502                                                pSetm(p);
     503                                                divOccured=TRUE;
     504                                        }
     505                                        else
     506                                        {
     507                                                ii += 1;
     508                                        }//if (pLmDivisibleBy(I->m[ii],p,currRing))
     509                                        if (divOccured==FALSE)
     510                                        {
     511                                                cout << "TICK 5" << endl;
     512                                                r=pAdd(r,pHead(p));
     513                                                cout << "TICK 6" << endl;
     514                                                p=pSub(p,pHead(p));
     515                                                cout << "TICK 7" << endl;
     516                                                pWrite(p);
     517                                        }//if (divOccured==FALSE)
     518                                }//while( (ii<IDELEMS(I) && (divOccured==FALSE) ))
     519                        }//while (p!=0)
     520                        return r;
     521                }//poly restOfDiv(poly const &f, ideal const &I)
     522               
     523                /** \brief Compute \f$ f-f^{\mathcal{G}} \f$
     524                */
     525                ideal ffG(ideal const &H, ideal const &G)
     526                {
     527                        cout << "Entering ffG" << endl;
     528                        int size=IDELEMS(G);
     529                        ideal res=idInit(size,1);
     530                        for (int ii=0;ii<size;ii++)
     531                        {
     532                                res->m[ii]=restOfDiv(H->m[ii],G);
     533                        }
     534                        return res;
     535                }
     536               
    465537                /** \brief Compute a Groebner Basis
    466538                *
     
    537609        /* Construct a new ring which will serve as our root
    538610        Does not yet work as expected. Will work fine with order dp,Dp but otherwise hangs in getGB
     611        resolved 07.04.2009 MM
    539612        */
    540613        rootRing=rCopy0(currRing);
     
    545618        /* Fetch the inputIdeal into our rootRing */
    546619        map theMap=(map)idMaxIdeal(1);  //evil hack!
    547         //idShow(idMaxIdeal(1));
    548         /*for (int ii=0;ii<pVariables;ii++)
    549         {
    550                 theMap->m[ii]=inputIdeal->m[ii];
    551         }*/
    552         theMap->preimage=NULL;
     620        theMap->preimage=NULL;  //neccessary?
    553621        ideal rootIdeal;
    554622        rootIdeal=fast_map(inputIdeal,inputRing,(ideal)theMap, currRing);
Note: See TracChangeset for help on using the changeset viewer.