Changeset b45f583 in git for kernel/gfan.cc


Ignore:
Timestamp:
Nov 18, 2009, 4:32:14 PM (14 years ago)
Author:
Martin Monerjan
Branches:
(u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
Children:
631b6c81789b80cf085b6b9269a246ec2c0728a1
Parents:
d1b6cc519b995304348ae07c8a484766256489bb
Message:
Preprocessing
lprepareResult


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

Legend:

Unmodified
Added
Removed
  • kernel/gfan.cc

    rd1b6cc rb45f583  
    646646        } //for
    647647               
    648 #if false
     648#if true
    649649        /*Let's make the preprocessing here. This could already be done in the above for-loop,
    650650        * but for a start it is more convenient here.
     
    660660        for(int ii=0;ii<ddineq->rowsize;ii++)
    661661        {
    662                 double tmp;             
     662                //read row ii into gamma
     663                double tmp;     
    663664                for(int jj=1;jj<=this->numVars;jj++)
    664665                {
     
    677678                LObject *P = new sLObject();
    678679                memset(P,0,sizeof(LObject));
    679 //              P->p1=L->m[0];
    680 //              P->p2=L->m[1];
    681 //              ksCreateSpoly(P);
    682 //              pWrite(P->p);
    683 //              cout << "gamma=";
    684 //              gamma->show(1,0);
    685 //              cout << endl;
    686 //              cout << "inv=";
    687 //              for(int qq=0;qq<IDELEMS(initialForm);qq++)
    688 //              {
    689 //                      pWrite0(initialForm->m[qq]);
    690 //                      cout << ",";                   
    691 //              }
    692 //              cout << endl;
     680
    693681                for(int jj=0;jj<=IDELEMS(initialForm)-2;jj++)
    694682                {
    695683                        bool isMaybeFacet=FALSE;
    696684                        P->p1=initialForm->m[jj];       //build spolys of initialForm in_v
    697 //                      cout << "P->p1=";
    698 //                      pWrite0(P->p1);
    699 //                      cout << endl;
     685
    700686                        for(int kk=jj+1;kk<=IDELEMS(initialForm)-1;kk++)
    701687                        {
    702688                                P->p2=initialForm->m[kk];
    703                                 ksCreateSpoly(P);
    704                                 /*cout << "P->p2=";
    705                                 pWrite0(P->p2);
    706                                 cout << endl;
    707                                 cout << "spoly(p1,p2)=";
    708                                 pWrite0(P->p);
    709                                 cout << endl;   */                     
     689                                ksCreateSpoly(P);                                                       
    710690                                if(P->p!=NULL)  //spoly non zero=?
    711691                                {       
     
    727707                                                        {                                                       
    728708                                                                isMaybeFacet=TRUE;
    729                                                                 break;
     709                                                                break;//for
    730710                                                        }
    731711                                                }
    732712                                                if(isMaybeFacet==TRUE)
    733                                                 {
    734 //                                                      dd_MatrixRowRemove(&ddineq,ii);
    735 //                                                      set_addelem(redRows,ii);
    736 //                                                      dd_set_si(ddineq->matrix[ii][0],1);
    737 //                                                      falseGammaCounter++;
    738 //                                                      cout << "Removing gamma!" << endl;
     713                                                {                                                       
    739714                                                        break;//while(p!=NULL)
    740715                                                }
     
    750725                                                void *_tmp = realloc(redRowsArray,(num_alloc*sizeof(int)));
    751726                                                if(!_tmp)
    752                                                         WerrorS("Couldn't realloc memory\n");
     727                                                        WerrorS("Woah dude! Couldn't realloc memory\n");
    753728                                                redRowsArray = (int*)_tmp;
    754729                                                redRowsArray[num_elts]=ii;
    755730                                                num_elts++;
    756                                                 break;//for(int kk, since we have found one that is not in L   
     731                                                //break;//for(int kk, since we have found one that is not in L 
     732                                                goto _start;    //mea culpa, mea culpa, mea maxima culpa
    757733                                        }
    758                                 }//if(P->p!=NULL)
    759                         }
    760                 }//for
     734                                }//if(P->p!=NULL)                               
     735                        }//for k
     736                }//for jj
     737                _start:;
    761738                delete P;
    762739                //idDelete(L);         
     
    26842661/** \brief Gather the output
    26852662* List of lists
     2663*\param *gc Pointer to gcone, preferably gcRoot ;-)
    26862664*\param n the number of cones
     2665*
    26872666*/
    26882667lists lprepareResult(gcone *gc, int n)
     
    26942673       
    26952674        lists res=(lists)omAllocBin(slists_bin);
    2696         res->Init(n);
     2675        res->Init(n);   //initialize to store n cones
    26972676        for(int ii=0;ii<n;ii++)
    26982677        {
    26992678                res->m[ii].rtyp=LIST_CMD;
    27002679                lists l=(lists)omAllocBin(slists_bin);
    2701                 l->Init(4);
     2680                l->Init(5);
    27022681                l->m[0].rtyp=INT_CMD;
    2703                 l->m[1].rtyp=INTVEC_CMD;
    2704                 l->m[2].rtyp=IDEAL_CMD;
    2705                 l->m[3].rtyp=RING_CMD;
    2706 //              l->m[4].rtyp=LIST_CMD;
    27072682                l->m[0].data=(void*)gcAct->getUCN();
     2683                l->m[1].rtyp=IDEAL_CMD;
     2684                l->m[1].data=(void*)idrCopyR_NoSort(gcAct->gcBasis,gcAct->getBaseRing());
     2685               
     2686                l->m[2].rtyp=INTVEC_CMD;
    27082687                intvec iv=(gcAct->f2M(gcAct,gcAct->facetPtr));
    2709                 l->m[1].data=(void*)ivCopy(&iv);
    2710                 l->m[2].data=(void*)idrCopyR_NoSort(gcAct->gcBasis,gcAct->getBaseRing());
    2711                 l->m[3].data=(void*)(gcAct->getBaseRing());
    2712 //              l->m[4].data=(void*)0;
     2688                l->m[2].data=(void*)ivCopy(&iv);
     2689               
     2690                l->m[3].rtyp=LIST_CMD;
     2691                        lists lCodim2List = (lists)omAllocBin(slists_bin);
     2692                        lCodim2List->Init(gcAct->numFacets);           
     2693 
     2694                        fAct = gcAct->facetPtr;//fAct->codim2Ptr;
     2695                        int jj=0;
     2696                        while(fAct!=NULL && jj<gcAct->numFacets)
     2697                        {
     2698                                lCodim2List->m[jj].rtyp=INTVEC_CMD;
     2699                                intvec ivC2=(gcAct->f2M(gcAct,fAct,2));
     2700                                lCodim2List->m[jj].data=(void*)ivCopy(&ivC2);
     2701                                jj++;
     2702                                fAct = fAct->next;
     2703                        }               
     2704                l->m[3].data=(void*)lCodim2List;
     2705               
     2706               
     2707                l->m[4].rtyp=RING_CMD;
     2708                l->m[4].data=(void*)(gcAct->getBaseRing());             
     2709               
    27132710                res->m[ii].data=(void*)l;
    27142711                gcAct = gcAct->next;
     
    27182715}
    27192716/** \brief Write facets of a cone into a matrix
    2720 * Takes a pointer to a facet as 2nd arg in order to determine whether
    2721 * it operates in codim 1 or 2
     2717* Takes a pointer to a facet as 2nd arg
     2718* f should always point to gc->facetPtr
     2719* param n is used to determine whether it operates in codim 1 or 2
     2720*
    27222721*/
    2723 intvec gcone::f2M(gcone *gc, facet *f)
     2722intvec gcone::f2M(gcone *gc, facet *f, int n)
    27242723{
    27252724        facet *fAct;
    2726         int codim=1;
    2727         if(f==gc->facetPtr)
     2725        intvec *res;
     2726        intvec *fNormal = new intvec(gc->numVars);
     2727//      int codim=n;
     2728//      int bound;
     2729//      if(f==gc->facetPtr)
     2730        if(n==1)
     2731        {
     2732                intvec *m1Res=new intvec(gc->numFacets,gc->numVars,0);
     2733                res = m1Res;
    27282734                fAct = gc->facetPtr;
     2735//              bound = gc->numFacets*(this->numVars);         
     2736        }
    27292737        else
    27302738        {
    2731                 fAct = gc->facetPtr->codim2Ptr;
    2732                 codim=2;
    2733         }
    2734         /** mrRes is a matrix containing the facet normals AS ROWS*/
    2735         intvec *mRes=new intvec(this->numFacets,gc->numVars,0);//nrows==numFacets, ncols==numVars
    2736         intvec *fNormal = new intvec(this->numVars);
     2739                fAct = f->codim2Ptr;
     2740                intvec *m2Res = new intvec(f->numCodim2Facets,gc->numVars,0);
     2741                res = m2Res;           
     2742//              bound = fAct->numCodim2Facets*(this->numVars);
     2743
     2744        }
    27372745        int ii=0;
    2738 //      for(int ii=0;ii<gc->numFacets*(this->numVars);ii++)
    2739         while(fAct!=NULL && ii<gc->numFacets*(this->numVars))
    2740         {
    2741                 fNormal=fAct->getFacetNormal();
    2742                 for(int jj=0;jj<this->numVars ;jj++ )
    2743                 {                       
    2744                         (*mRes)[ii]=(*fNormal)[jj];
     2746        while(fAct!=NULL )//&& ii < bound )
     2747        {
     2748                fNormal = fAct->getFacetNormal();
     2749                for(int jj=0;jj<this->numVars;jj++)
     2750                {
     2751                        (*res)[ii]=(*fNormal)[jj];
    27452752                        ii++;
    27462753                }
    27472754                fAct = fAct->next;
    27482755        }
    2749         return *mRes;
     2756
     2757        delete fNormal;
     2758        return *res;
    27502759}
    27512760
Note: See TracChangeset for help on using the changeset viewer.