Changeset aba53c in git for kernel


Ignore:
Timestamp:
Mar 24, 2009, 6:37:40 PM (15 years ago)
Author:
Martin Monerjan
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'd08f5f0bb3329b8ca19f23b74cb1473686415c3a')
Children:
fe919cbede83a96748fd037a48aa15876e31e41e
Parents:
fc4f9a6dc1aa8816f99642c699541cb71324666f
Message:
Started to get normals from ddMatrix into intvec
Esoteric things with pointers


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

Legend:

Unmodified
Added
Removed
  • kernel/gfan.cc

    rfc4f9a raba53c  
    22Compute the Groebner fan of an ideal
    33$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 $
     4$Date: 2009-03-24 17:37:40 $
     5$Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.19 2009-03-24 17:37:40 monerjan Exp $
     6$Id: gfan.cc,v 1.19 2009-03-24 17:37:40 monerjan Exp $
    77*/
    88
     
    1616#include "ideals.h"
    1717#include "kmatrix.h"
    18 #include "iostream.h"
     18#include "iostream.h"   //deprecated
    1919
    2020//Hacks for different working places
     
    3232
    3333#ifdef ITWM
     34#include "/u/slg/monerjan/cddlib/include/setoper.h"
     35#include "/u/slg/monerjan/cddlib/include/cdd.h"
    3436#endif
    3537
     
    4345                intvec fNormal;         //inner normal, describing the facet uniquely
    4446        public:
    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;
     47                facet()                 //default constructor. Do I need a constructor of type facet(intvec) ?
     48                {
     49                        //fNormal = FN;
     50                        this->next=NULL;        //By default each facet is last
     51                }
     52               
     53                ~facet(){;}             //destructor
     54                void setFacetNormal(intvec iv){
     55                        fNormal = iv;
    5356                        return;
    5457                }
     
    5659                bool isFlippable;       //flippable facet? Want to have cone->isflippable.facet[i]
    5760                bool isIncoming;        //Is the facet incoming or outgoing?
     61                facet *next;            //Pointer to next facet
    5862};
    5963
     
    6973                gcone(int);             //constructor with dimension
    7074                ~gcone();               //destructor
    71                 poly gcMarkedTerm;      //marked terms of the cone's Grï¿œbner basis
     75                poly gcMarkedTerm;      //marked terms of the cone's Groebner basis
    7276                ideal gcBasis;          //GB of the cone
    7377                gcone *next;            //Pointer to *previous* cone in search tree
     
    96100/****** getConeNormals computes the inequalities ***/
    97101/*INPUT_TYPE: ideal                             */
    98 /*RETURN_TYPE: matrix                           */
     102/*RETURN_TYPE: pointer to first facet           */
    99103/************************************************/
    100 void getConeNormals(ideal I)
     104facet getConeNormals(ideal I)
    101105{
    102106        #ifdef gfan_DEBUG
     
    201205        //Remove reduntant rows here!
    202206        dd_MatrixCanonicalize(&ddineq, &ddlinset, &ddredrows, &ddnewpos, &dderr);
     207        ddrows = ddineq->rowsize;       //Size of the matrix with redundancies removed
     208        ddcols = ddineq->colsize;
    203209        #ifdef gfan_DEBUG
    204210        cout << "Having removed redundancies, the normals now read:" << endl;
    205211        dd_WriteMatrix(stdout,ddineq);
     212        cout << "Rows = " << ddrows << endl;
     213        cout << "Cols = " << ddcols << endl;
    206214        #endif
    207215
     
    216224       
    217225        /*Write the normals into class facet
    218                 How do I get the #rows in ddineq? \exists s.th. like dd_NumRows?
     226                How do I get the #rows in ddineq? \exists s.th. like dd_NumRows? dd_get_si(ddineq->matrix[i][j]) ?
    219227        Strange enough: facet *f=new facet(intvec(2,3)) does work for the constructor facet(intvec FN){fNormal = FN;}
    220228        */
    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();
     229        #ifdef gfan_DEBUG
     230        cout << "Creating list of normals" << endl;
     231        #endif
     232        /*The pointer *fRoot should be the return value of this function*/
     233        facet *fRoot = new facet();             //instantiate new facet with intvec with numvar rows, one column and initial values all 0
     234        //facet *fRoot;
     235        facet *fAct;                    //instantiate pointer to active facet
     236        fAct = (facet*)&fRoot; 
     237        //fAct = fRoot;                 //Let fAct point to fRoot
     238        for (int kk = 0; kk<ddrows; kk++)
     239        {
     240                intvec load;    //intvec to sto
     241                for (int jj = 1; jj <ddcols; jj++)
     242                {
     243                        double *foo;
     244                        foo = (double*)ddineq->matrix[kk][jj];  //get entry from actual position
     245#ifdef gfan_DEBUG
     246                        std::cout << "fAct is " << *foo << " at " << fAct << endl;
     247#endif
     248                        /*next two lines commented out. How to store values into intvec? */
     249                        //load[jj] = (int)*foo;                 //store typecasted entry at pos jj of load
     250                        //fAct->setFacetNormal(load);
     251                        if (jj<ddcols)                          //Is this facet NOT the last facet? Writing while instead of if is a really bad idea :)
     252                        {
     253                                fAct->next = new facet();       //If so: instantiate new facet. Otherwise this->next=NULL due to the constructor
     254                                fAct = fAct->next;              //scary :)
     255                        }
     256                }
    226257        }
     258        /*
     259        Now we should have a concatenated list containing the facet normals which we can adress via *f
     260        */
    227261       
    228262        //ddineq->representation=dd_Inequality;         //We want our LP to be Ax>=0
    229 
    230263        //Clean up but don't delete the return value! (Whatever it will turn out to be)
    231264        dd_FreeMatrix(ddineq);
     
    239272        dd_free_global_constants();
    240273
    241         //res=(ideal)aktpoly;
    242         //return res;
     274
     275        return *fRoot;
    243276}
    244277
     
    252285        /*
    253286        1. Select target order
    254         2. Compute GB of inputIdeal wrt target order
     287        2. Compute GB of inputIdeal wrt target order -> newRing, setCurrRing etc...
    255288        3. getConeNormals
    256289        */
Note: See TracChangeset for help on using the changeset viewer.