Changeset fc4f9a in git


Ignore:
Timestamp:
Mar 23, 2009, 5:59:56 PM (14 years ago)
Author:
Martin Monerjan
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'f875bbaccd0831e36aaed09ff6adeb3eb45aeb94')
Children:
aba53ce3c77ba50e34a7922b440ad0d9b503f81d
Parents:
4159ffa27176a5b3cf13ba9bc75034da1faab9a1
Message:
-no more printf
-various ways of #including cddlib
-more on class facet
-tried to get facet::f->printFacet() to work
-removed some no longer useful cddlib stuff


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

Legend:

Unmodified
Added
Removed
  • kernel/gfan.cc

    r4159ff rfc4f9a  
    11/*
    22Compute the Groebner fan of an ideal
    3 Author: $Author: monerjan $
    4 Date: $Date: 2009-03-02 14:44:49 $
    5 Header: $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.17 2009-03-02 14:44:49 monerjan Exp $
    6 Id: $Id: gfan.cc,v 1.17 2009-03-02 14:44:49 monerjan Exp $
     3$Author: monerjan $
     4$Date: 2009-03-23 16:59:56 $
     5$Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.18 2009-03-23 16:59:56 monerjan Exp $
     6$Id: gfan.cc,v 1.18 2009-03-23 16:59:56 monerjan Exp $
    77*/
    88
     
    1616#include "ideals.h"
    1717#include "kmatrix.h"
     18#include "iostream.h"
     19
     20//Hacks for different working places
     21#define HOME
     22
     23#ifdef UNI
    1824#include "/users/urmel/alggeom/monerjan/cddlib/include/setoper.h" //Support for cddlib. Dirty hack
    1925#include "/users/urmel/alggeom/monerjan/cddlib/include/cdd.h"
     26#endif
     27
     28#ifdef HOME
     29#include "/home/momo/studium/diplomarbeit/cddlib/include/setoper.h"
     30#include "/home/momo/studium/diplomarbeit/cddlib/include/cdd.h"
     31#endif
     32
     33#ifdef ITWM
     34#endif
    2035
    2136#ifndef gfan_DEBUG
     
    2843                intvec fNormal;         //inner normal, describing the facet uniquely
    2944        public:
    30                 facet();                //constructor
     45                facet(intvec FN)                //constructor
     46                {
     47                        fNormal = FN;
     48                }
     49               
     50                ~facet();               //destructor
     51                void printNormal(){
     52                        std::cout << "The normal is = " << "fNormal" << endl;
     53                        return;
     54                }
     55               
    3156                bool isFlippable;       //flippable facet? Want to have cone->isflippable.facet[i]
    3257                bool isIncoming;        //Is the facet incoming or outgoing?
     
    4368        public:
    4469                gcone(int);             //constructor with dimension
    45                 poly gcMarkedTerm;      //marked terms of the cone's Gröbner basis
     70                ~gcone();               //destructor
     71                poly gcMarkedTerm;      //marked terms of the cone's Grï¿œbner basis
    4672                ideal gcBasis;          //GB of the cone
    4773                gcone *next;            //Pointer to *previous* cone in search tree
    4874       
    4975                void flip();            //Compute "the other side"
    50                 void remRedFacets();    //Remove redundant facets of the cone
     76                void remRedFacets();    //Remove redundant facets of the cone NOT NEEDED since this is already done by cddlib while compunting the normals
     77               
     78                ideal GenGrbWlk(ideal, ideal);  //Implementation of the Generic Groebner Walk. Needed for a) Computing the sink and b) finding search facets
    5179               
    5280
     
    5684{
    5785        #ifdef gfan_DEBUG
    58         printf("Computing a groebner basis...\n");
     86        cout << "Computing a groebner basis..." << endl;
    5987        #endif
    6088
     
    6694}
    6795
    68 /****** getWallIneq computes the inequalities ***/
     96/****** getConeNormals computes the inequalities ***/
    6997/*INPUT_TYPE: ideal                             */
    7098/*RETURN_TYPE: matrix                           */
    7199/************************************************/
    72 void getWallIneq(ideal I)
    73 {
    74         #ifdef gfan_DEBUG
    75         printf("*** Computing Inequalities... ***\n");
     100void getConeNormals(ideal I)
     101{
     102        #ifdef gfan_DEBUG
     103        cout << "*** Computing Inequalities... ***" << endl;
    76104        #endif
    77105
     
    93121        // End of var declaration
    94122
    95         printf("The Groebner basis has %i elements\n",lengthGB);
    96         printf("The current ring has %i variables\n",numvar);
     123        cout << "The Groebner basis has " << lengthGB << " elements" << endl;
     124        cout << "The current ring has " << numvar << " variables" << endl;
    97125        cols = numvar;
    98126
     
    104132                rows=rows+pLength(aktpoly)-1;
    105133        }
    106         printf("rows=%i\n",rows);
    107         printf("Will create a %i x %i - matrix to store inequalities\n",rows,cols);
     134        cout << "rows=" << rows << endl;
     135        cout << "Will create a " << rows << " x " << cols << " matrix to store inequalities" << endl;
    108136
    109137        dd_rowrange aktmatrixrow=0;     // needed to store the diffs of the expvects in the rows of ddineq
     
    119147                aktpoly=(poly)I->m[i];          //get aktpoly as i-th component of I
    120148                pCompCount=pLength(aktpoly);    //How many terms does aktpoly consist of?
    121                 printf("Poly No. %i has %i components\n",i,pCompCount);
     149                cout << "Poly No. " << i << " has " << pCompCount << " components" << endl;
    122150
    123151                int *v=(int *)omAlloc((numvar+1)*sizeof(int));
     
    155183
    156184        #ifdef gfan_DEBUG
    157         printf("The inequality matrix is:\n");
     185        cout << "The inequality matrix is" << endl;
    158186        dd_WriteMatrix(stdout, ddineq);
    159187        #endif
     
    167195        } else
    168196        {
    169                 printf("Redundant rows: ");
     197                cout << "Redundant rows: ";
    170198                set_fwrite(stdout, ddredrows);          //otherwise print the redundant rows
    171199        }//if dd_Error
     
    174202        dd_MatrixCanonicalize(&ddineq, &ddlinset, &ddredrows, &ddnewpos, &dderr);
    175203        #ifdef gfan_DEBUG
    176         printf("Having removed redundant rows, the inequalities now read:\n");
     204        cout << "Having removed redundancies, the normals now read:" << endl;
    177205        dd_WriteMatrix(stdout,ddineq);
    178206        #endif
    179207
    180         dd_PolyhedraPtr ddpolyh;
     208        /*dd_PolyhedraPtr ddpolyh;
    181209        dd_MatrixPtr G;
    182210        ddpolyh=dd_DDMatrix2Poly(ddineq, &dderr);
     
    184212        printf("\nSpanning vectors = rows:\n");
    185213        dd_WriteMatrix(stdout, G);
    186 
     214        */
     215       
     216       
     217        /*Write the normals into class facet
     218                How do I get the #rows in ddineq? \exists s.th. like dd_NumRows?
     219        Strange enough: facet *f=new facet(intvec(2,3)) does work for the constructor facet(intvec FN){fNormal = FN;}
     220        */
     221        for (int kk = 1; kk<=2; kk++){
     222                facet *f = new facet(intvec(2,3));
     223                //facet *fPtr = &f;
     224                cout << &f << endl;
     225                f->printNormal();
     226        }
     227       
    187228        //ddineq->representation=dd_Inequality;         //We want our LP to be Ax>=0
    188229
     
    205246{
    206247        #ifdef gfan_DEBUG
    207         printf("Now in subroutine gfan\n");
     248        cout << "Now in subroutine gfan" << endl;
    208249        #endif
    209250        ideal res;
    210251        matrix ineq; //Matrix containing the boundary inequalities
    211 
     252        /*
     253        1. Select target order
     254        2. Compute GB of inputIdeal wrt target order
     255        3. getConeNormals
     256        */
    212257        res=getGB(inputIdeal);
    213         getWallIneq(res);
     258        getConeNormals(res);
    214259        return res;
    215260}
Note: See TracChangeset for help on using the changeset viewer.