Changeset ed30c5 in git for kernel


Ignore:
Timestamp:
Nov 22, 2008, 9:48:23 PM (15 years ago)
Author:
Christian Eder
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
99d87535652761aa8ed969de6b6ab84ee03fea8a
Parents:
3b5daf5c3b6d494f4399c4436450100041ce3dc0
Message:
updated input


git-svn-id: file:///usr/local/Singular/svn/trunk@11207 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
kernel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/f5gb.cc

    r3b5daf red30c5  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: f5gb.cc,v 1.11 2008-11-20 17:55:04 ederc Exp $ */
     4/* $Id: f5gb.cc,v 1.12 2008-11-22 20:48:23 ederc Exp $ */
    55/*
    66* ABSTRACT: f5gb interface
    77*/
    88#include "mod2.h"
    9 
     9#include <list>
    1010#ifdef HAVE_F5
    1111#include "kutil.h"
     
    2323#include "pInline1.h"
    2424#include "f5gb.h"
    25 #include "lpolynom.h"
     25#include "lpolynomial.h"
    2626
    27 
    28 // global variables
    29 const poly one = pInit();
    3027
    3128
     
    6865* computes incrementally gbs of subsets of the input
    6966* gb{f_m} -> gb{f_m,f_(m-1)} -> gb{f_m,...,f_1}
    70 */ 
     67 
    7168lpoly *f5_inc(lpoly* lp, lpoly* g_prev)
    7269{
     
    8986        *
    9087        * return lp;
    91         */
     88       
    9289}   
    9390
    94 
     91*/
    9592// generating the list lp of ideal generators and test if 1 is in lp
    96 bool generate_input_list(lpoly* lp, ideal id)
     93bool generate_input_list(lpoly* lp, ideal id, poly ONE)
    9794{
    9895        long j;
     
    10198                lp[j].setPoly(id->m[j]);
    10299               
    103                 if(pComparePolys(lp[j].getPoly(), one)){
     100                if(pComparePolys(lp[j].getPoly(), ONE)){
    104101                        Print("1 in GB\n");
    105102                        return(1);
     
    107104               
    108105                lp[j].setIndex(j+1);
    109                 lp[j].setTerm(one);
     106                lp[j].setTerm(ONE);
    110107                lp[j].setDel(false);
    111108                lp[j].setNext(&lp[j+1]);
     
    126123* implementation
    127124*/
    128 ideal F5main(ideal i, ring r)
    129 {
    130         ideal iTmp, g_basis;
    131         bool one_id;
    132         long j,k;
    133         pSetCoeff(one, nInit(1));
    134         pWrite(one);
    135         lpoly *lp, *gb;
    136         intvec* sort;
    137         iTmp = idInit(IDELEMS(i),i->rank);
    138  
    139         for(j=0; j<IDELEMS(i); j++)
    140         {
    141                 if(NULL != i->m[j])
    142                 {
    143                         iTmp->m[j] = i->m[j];
    144                 }
    145         ;}
    146        
    147         iTmp = kInterRed(i,0); 
    148         qsort_degree(&iTmp->m[0],&iTmp->m[IDELEMS(iTmp)-1]);
    149         idShow(iTmp);
    150        
    151         // generating the list lp of ideal generators
    152         lp = new lpoly[IDELEMS(iTmp)];
    153        
    154         one_id = generate_input_list(lp,iTmp);       
    155          
    156        
    157         // PROBLEM: muss signatur mitliefern, daher datentyp
    158         //          ideal nicht zu gebrauchen?
    159        
     125ideal F5main(ideal i, ring r) {
     126    lpoly* lp;
     127    long j;
    160128
    161         // gb: Grobner Bases, pointer on the first element in the list,
    162         // end of the list is marked by next = NULL
    163        
    164         gb = new lpoly;
    165         gb = &lp[IDELEMS(iTmp)-1];
    166         (*gb).setNext(NULL);
    167         Print("last element in sequence = first element in gb:\n");
    168         pWrite((*gb).getPoly());
    169         Print("Next: %p\n", lp[IDELEMS(iTmp)-2].getNext());
    170         Print("Next: %p\n", lp[IDELEMS(iTmp)-1].getNext());
    171        
    172         for(j=IDELEMS(iTmp)-2; j>0; j--){
    173                 //PROBLEM: muss dynamisch Speicher allozieren
    174                 gb = f5_inc(&lp[j], gb);
    175                
    176                 for(k=0; k< IDELEMS(iTmp); k++){
    177                        
    178                         if(pComparePolys(gb[k].getPoly(),one)){
    179                                 Print("1 in GB\n");
    180                                 return(iTmp);
    181                         }
    182 
    183                 }
    184        
    185          
     129    // definition of one-polynomial as global constant ONE
     130    poly one = pInit();
     131    pSetCoeff(one, nInit(1));
     132    static const poly ONE = one;
     133   
     134    //
     135    for(j=0; j<IDELEMS(i); j++) {
     136        if(NULL != i->m[j]) {
     137            if(pComparePolys(i->m[j],ONE)) {
     138                Print("One Polynomial in Input => Computations stopped\n");
     139                return(i);
     140            }   
    186141        }
    187 
    188         Print("Es klappt!\n");
    189         return(iTmp);
    190                        
     142    }
     143   
     144    i = kInterRed(i,0); 
     145    qsort_degree(&i->m[0],&i->m[IDELEMS(i)-1]);
     146    idShow(i);
     147           
     148    /* if(generate_input_list(lp,iTmp,ONE)) {
     149            Print("One Polynomial in Input => Computations stopped");
     150            iTmp = idInit(1,0);
     151            iTmp->m[0] = ONE;
     152            return(iTmp);
     153    }
     154    */
     155    Print("Es klappt!\nWIRKLICH!");
     156    return(i);
     157   
    191158
    192159
  • kernel/f5gb.h

    r3b5daf red30c5  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: f5gb.h,v 1.10 2008-11-20 17:55:04 ederc Exp $ */
     4/* $Id: f5gb.h,v 1.11 2008-11-22 20:48:23 ederc Exp $ */
    55/*
    66* ABSTRACT: f5gb interface
     
    1010
    1111#ifdef HAVE_F5
    12 #include "lpolynom.h"
     12#include "lpolynomial.h"
    1313
    1414
    1515// sort polynomials in ideal i by decreasing total degree
    16 void qsort_degree(poly* left, poly* right);
     16 void qsort_degree(poly* left, poly* right);
    1717
    1818
    1919// generating the list lp of ideal generators and
    2020// test if 1 is in lp(return 1) or not(return 0)
    21 bool generate_input_list(lpoly* lp, ideal id);
     21 bool generate_input_list(lpoly* lp, ideal id, poly one);
    2222
    2323/* computes incrementally gbs of subsets of the input
    2424   gb{f_m} -> gb{f_m,f_(m-1)} -> gb{f_m,...,f_1} 
    2525*/
    26 lpoly* f5_inc(lpoly* lp, lpoly* g_prev);
     26// lpoly* f5_inc(lpoly* lp, lpoly* g_prev);
    2727
    2828
Note: See TracChangeset for help on using the changeset viewer.