Changeset d663f2 in git


Ignore:
Timestamp:
Aug 25, 2011, 6:52:34 PM (12 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
Children:
50b874afcba55b265e25d44bbebf37f1a74402a6
Parents:
ef6f951a70b932a931c74771bcc97ed20e73dad7
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2011-08-25 18:52:34+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 16:12:29+01:00
Message:
FIX: fixing longrat-related bugs (due to the Uglyness in p_Numbers.h!)
Location:
libpolys
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/longrat.cc

    ref6f95 rd663f2  
    66* ABSTRACT: computation with long rational numbers (Hubert Grassmann)
    77*/
     8
    89#include "config.h"
    910#include <misc/auxiliary.h>
     
    129130}
    130131
    131 //#ifndef SI_THREADS
    132 omBin rnumber_bin = omGetSpecBin(sizeof(snumber));
    133 //#endif
    134132
    135133number nlOne=INT_TO_SR(1);
     
    160158static number nlMapLongR(number from, const coeffs src, const coeffs dst);
    161159static number nlMapR(number from, const coeffs src, const coeffs dst);
     160
    162161
    163162#ifdef HAVE_RINGS
     
    323322  else
    324323  {
    325     number z=(number)omAllocBin(rnumber_bin);
     324    number z = ALLOC_RNUMBER(); //Q!? // (number)omAllocBin(rnumber_bin);
    326325#if defined(LDEBUG)
    327326    z->debug=123456;
     
    542541}
    543542
    544 void nlMPZ(mpz_t m, number &n, const coeffs r)
    545 {
    546   assume( getCoeffType(r) == ID );
    547    
    548   nlTest(n, r);
    549   nlNormalize(n, r);
    550   if (SR_HDL(n) & SR_INT) mpz_init_set_si(m, SR_TO_INT(n));     /* n fits in an int */
    551   else             mpz_init_set(m, (mpz_ptr)n->z);
    552 }
    553 
    554 
    555543/*2
    556544* convert number to int
     
    723711    bb->debug=654324;
    724712#endif
    725     omFreeBin((void *)bb, rnumber_bin);
     713    FREE_RNUMBER(bb); // omFreeBin((void *)bb, rnumber_bin);
    726714  }
    727715  u=nlShort3(u);
     
    789777    bb->debug=654324;
    790778#endif
    791     omFreeBin((void *)bb, rnumber_bin);
     779    FREE_RNUMBER(bb); // omFreeBin((void *)bb, rnumber_bin);
    792780  }
    793781  u=nlShort3(u);
     
    866854    bb->debug=654324;
    867855#endif
    868     omFreeBin((void *)bb, rnumber_bin);
     856    FREE_RNUMBER(bb); // omFreeBin((void *)bb, rnumber_bin);
    869857  }
    870858  if (mpz_isNeg(u->z))
     
    909897    if (r==0)
    910898    {
    911       omFreeBin((void *)u, rnumber_bin);
     899      FREE_RNUMBER(u); // omFreeBin((void *)u, rnumber_bin);
    912900      return INT_TO_SR(i/j);
    913901    }
     
    14561444#endif
    14571445    }
    1458     omFreeBin((void *) *a, rnumber_bin);
     1446    FREE_RNUMBER(*a); // omFreeBin((void *) *a, rnumber_bin);
    14591447  }
    14601448}
     
    21122100}
    21132101
    2114 
    2115 number nlInitMPZ(mpz_t m, const coeffs r)
    2116 {
    2117   number z = ALLOC_RNUMBER();
    2118   mpz_init_set(z->z, m);
    2119   mpz_init_set_ui(z->n, 1);
    2120   z->s = 3;
    2121   return z;   
    2122 }
    2123 
    21242102/*2
    21252103* a == 1 ?
     
    24482426#ifndef P_NUMBERS_H
    24492427
     2428static void nlMPZ(mpz_t m, number &n, const coeffs r)
     2429{
     2430  assume( getCoeffType(r) == ID );
     2431   
     2432  nlTest(n, r);
     2433  nlNormalize(n, r);
     2434  if (SR_HDL(n) & SR_INT) mpz_init_set_si(m, SR_TO_INT(n));     /* n fits in an int */
     2435  else             mpz_init_set(m, (mpz_ptr)n->z);
     2436}
     2437
     2438
     2439static number nlInitMPZ(mpz_t m, const coeffs r)
     2440{
     2441  number z = ALLOC_RNUMBER();
     2442  mpz_init_set(z->z, m);
     2443  mpz_init_set_ui(z->n, 1);
     2444  z->s = 3;
     2445  return z;   
     2446}
     2447
     2448
    24502449void nlInpGcd(number &a, number b, const coeffs r)
    24512450{
     
    26072606  r->cfKillChar = ndKillChar; /* dummy */
    26082607
     2608  r->cfInitMPZ = nlInitMPZ;
     2609  r->cfMPZ  = nlMPZ;
     2610   
    26092611  r->cfMult  = nlMult;
    26102612  r->cfSub   = nlSub;
     
    26152617  r->cfExactDiv= nlExactDiv;
    26162618  r->cfInit = nlInit;
    2617   r->cfInitMPZ = nlInitMPZ;
    26182619  r->cfSize  = nlSize;
    26192620  r->cfInt  = nlInt;
    2620   r->cfMPZ = nlMPZ;
    2621  
     2621   
    26222622  r->cfChineseRemainder=nlChineseRemainder;
    26232623  r->cfFarey=nlFarey;
     
    27072707    {
    27082708      mpz_clear(&r->z);
    2709       omFreeBin((void *)r, rnumber_bin);
     2709      FREE_RNUMBER(r); //  omFreeBin((void *)r, rnumber_bin);
    27102710      r=INT_TO_SR(ui);
    27112711    }
  • libpolys/coeffs/longrat.h

    ref6f95 rd663f2  
    6161number   nlInit2 (int i, int j, const coeffs r);
    6262number   nlInit2gmp (mpz_t i, mpz_t j);
     63
     64// number nlInitMPZ(mpz_t m, const coeffs r);
     65// void nlMPZ(mpz_t m, number &n, const coeffs r);
     66
    6367number   nlGcd(number a, number b, const coeffs r);
    6468number   nlLcm(number a, number b, const coeffs r);   /*special routine !*/
     
    100104extern omBin rnumber_bin;
    101105
    102 
    103106#define FREE_RNUMBER(x) omFreeBin((void *)x, rnumber_bin)
    104107#define ALLOC_RNUMBER() (number)omAllocBin(rnumber_bin)
  • libpolys/coeffs/longrat0.cc

    ref6f95 rd663f2  
    1010#include <stdio.h>
    1111#include <string.h>
     12
    1213#include "config.h"
     14#include <misc/auxiliary.h>
     15
     16#include <omalloc/omalloc.h>
    1317#include <reporter/reporter.h>
    14 #include <coeffs/coeffs.h>
    15 #include <omalloc/omalloc.h>
    16 #include <coeffs/longrat.h>
    17 #include <coeffs/numbers.h>
     18
     19#include "coeffs.h"
     20#include "numbers.h"
     21
     22#include "longrat.h"
     23
     24/// Our Type!
     25static const n_coeffType ID = n_Q;
     26
     27//#ifndef SI_THREADS
     28omBin rnumber_bin = omGetSpecBin(sizeof(snumber)); // TODO: move this into coeffs-struct (for Q)?!
     29//#endif
     30
    1831
    1932#define SR_HDL(A) ((long)(A))
     
    143156}
    144157
     158
  • libpolys/coeffs/modulop.cc

    ref6f95 rd663f2  
    632632  if(res->s==0)
    633633    iz=(long)npDiv((number)iz,(number)in,dst_r);
    634   omFreeBin((void *)res, rnumber_bin);
     634  FREE_RNUMBER(res); // Q!?
    635635  return (number)iz;
    636636}
  • libpolys/polys/clapconv.cc

    ref6f95 rd663f2  
    356356      p_SetExp( term, i ,exp[i], r);
    357357    //if (rRing_has_Comp(currRing)) p_SetComp(term, 0, currRing); // done by pInit
    358     pGetCoeff(term)=(number)omAlloc0Bin(rnumber_bin);
     358    pGetCoeff(term) = ALLOC0_RNUMBER(); // Q!?
    359359    ((lnumber)pGetCoeff(term))->z=convFactoryPSingP( f, r->extRing );
    360360    p_Setm( term,r );
  • libpolys/polys/templates/p_Numbers.h

    ref6f95 rd663f2  
    7676
    7777#define DO_LINLINE
    78 #include <coeffs/longrat.cc>
     78#include <coeffs/longrat.cc> // TODO: fix this Uglyness?!!!
     79
    7980#define n_Copy_FieldQ(n, r)        nlCopy(n, r->cf)
    8081#define n_Delete_FieldQ(n, r)      nlDelete(n,r->cf)
Note: See TracChangeset for help on using the changeset viewer.