Changeset 95d8df in git


Ignore:
Timestamp:
Aug 4, 2010, 4:58:45 PM (14 years ago)
Author:
Mohamed Barakat <mohamed.barakat@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
Children:
c08a3a5909a74bf11408f124df305d4f97512a5a
Parents:
19ae6525f1a81956e108659a7612e6af4ad15c93
git-author:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2010-08-04 16:58:45+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 11:55:25+01:00
Message:
make omalloc, misc, reporter, resources, coeffs + make test in coeffs
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • coeffs/gnumpc.cc

    r19ae652 r95d8df  
    6969}
    7070
    71 int ngcSize(number n)
     71int ngcSize(number n, const coeffs R)
    7272{
    7373  int r = (int)((gmp_complex*)n)->real();
     
    8080     return 1;
    8181     (this code ensures that zero has the size zero) */
    82   if ((oneNorm == 0.0) & (ngcIsZero(n) == FALSE)) oneNorm = 1;
     82  if ((oneNorm == 0.0) & (ngcIsZero(n,R) == FALSE)) oneNorm = 1;
    8383  return oneNorm;
    8484}
     
    118118
    119119  gmp_complex* r=(gmp_complex*)a;
    120   (*r) *= ngc_m1;
     120  (*r).neg();
    121121  return (number)a;
    122122}
     
    136136  else
    137137  {
    138     b = new gmp_complex( (gmp_complex)1 / (*(gmp_complex*)a) );
    139   }
    140   return (number)b;
     138    r = new gmp_complex( (gmp_complex)1 / (*(gmp_complex*)a) );
     139  }
     140  return (number)r;
    141141}
    142142
  • coeffs/gnumpfl.cc

    r19ae652 r95d8df  
    2727static const n_coeffType ID = n_long_R;
    2828
    29 static number ngfMapP(number from, const coeffs src, const coeffs dst)
    30 {
    31   return ngfInit(npInt(from,src), dst);
    32 }
    33 number ngfMapQ(number from, const coeffs src, const coeffs dst)
    34 {
    35   gmp_float *res=new gmp_float(numberFieldToFloat(from,QTOF));
    36   return (number)res;
    37 }
    3829union nf
    3930{
     
    4536  number N() const {return _n;}
    4637};
    47 static number ngfMapR(number from, const coeffs src, const coeffs dst)
    48 {
    49   gmp_float *res=new gmp_float((double)nf(from).F());
    50   return (number)res;
    51 }
    52 static number ngfMapC(number from, const coeffs src, const coeffs dst)
    53 {
    54   gmp_float *res=new gmp_float(((gmp_complex*)from)->real());
    55   return (number)res;
    56 }
    5738
    5839/*2
     
    8869     return 1;
    8970     (this code ensures that zero has the size zero) */
    90   if ((i == 0) && (ngfIsZero(n) == FALSE)) i = 1;
     71  if ((i == 0) && (ngfIsZero(n,r) == FALSE)) i = 1;
    9172  return i;
    9273}
     
    220201  {
    221202    gmp_float* n = new gmp_float(1);
    222     *u=(number)n;
    223     return;
     203    return (number)n;
    224204  }
    225205  else if ( ngfIsZero(x, r) ) // 0^e, e>0
    226206  {
    227     *u=ngfInit(0, r);
    228     return;
     207    return ngfInit(0, r);
    229208  }
    230209  else if ( exp == 1 )
    231210  {
    232     n_New(u, r);
    233     gmp_float* n = new gmp_float();
    234     *n= *(gmp_float*)x;
    235     *u=(number)n;
    236     return;
     211    return ngfCopy(x,r);
    237212  }
    238213  return (number) ( new gmp_float( (*(gmp_float*)x)^exp ) );
     
    444419}
    445420
    446 number ngfMapQ(number from, const coeffs aRing, const coeffs r)
    447 {
    448   assume( getCoeffType(r) == ID );
    449   assume( getCoeffType(aRing) == n_Q );
    450  
    451   if ( from != NULL )
    452   {
    453     gmp_float *res=new gmp_float(numberFieldToFloat(from,QTOF,r));
    454     return (number)res;
    455   }
    456   else
    457     return NULL;
    458 }
    459 
    460 static number ngfMapR(number from, const coeffs aRing, const coeffs r)
    461 {
    462   assume( getCoeffType(r) == ID );
    463   assume( getCoeffType(aRing) == n_R );
    464  
    465   if ( from != NULL )
    466   {
    467     gmp_float *res=new gmp_float((double)nrFloat(from));
    468     return (number)res;
    469   }
    470   else
    471     return NULL;
    472 }
    473 
    474 static number ngfMapP(number from, const coeffs aRing, const coeffs r)
    475 {
    476   assume( getCoeffType(r) == ID );
    477   assume( getCoeffType(aRing) ==  n_Zp );
    478  
    479   if ( from != NULL )
    480     return ngfInit(npInt(from,aRing), r);
    481   else
    482     return NULL;
    483 }
    484 
    485 static number ngfMapC(number from, const coeffs aRing, const coeffs r)
    486 {
    487   assume( getCoeffType(r) == ID );
    488   assume( getCoeffType(aRing) ==  n_long_C );
    489  
    490   if ( (from != NULL) || ((gmp_complex*)from)->real().isZero() )
    491   {
    492     gmp_float *res=new gmp_float(((gmp_complex*)from)->real());
    493     return (number)res;
    494   }
    495   else
    496     return NULL;
     421number ngfMapQ(number from, const coeffs src, const coeffs dst)
     422{
     423  assume( getCoeffType(dst) == ID );
     424  assume( getCoeffType(src) == n_Q );
     425 
     426  gmp_float *res=new gmp_float(numberFieldToFloat(from,QTOF,dst));
     427  return (number)res;
     428}
     429
     430static number ngfMapR(number from, const coeffs src, const coeffs dst)
     431{
     432  assume( getCoeffType(dst) == ID );
     433  assume( getCoeffType(src) == n_R );
     434 
     435  gmp_float *res=new gmp_float((double)nf(from).F());
     436  return (number)res;
     437}
     438
     439static number ngfMapP(number from, const coeffs src, const coeffs dst)
     440{
     441  assume( getCoeffType(dst) == ID );
     442  assume( getCoeffType(src) ==  n_Zp );
     443 
     444  return ngfInit(npInt(from,src), dst);
     445}
     446
     447static number ngfMapC(number from, const coeffs src, const coeffs dst)
     448{
     449  assume( getCoeffType(dst) == ID );
     450  assume( getCoeffType(src) ==  n_long_C );
     451 
     452  gmp_float *res=new gmp_float(((gmp_complex*)from)->real());
     453  return (number)res;
    497454}
    498455
  • coeffs/longrat.h

    r19ae652 r95d8df  
    1111// #include "config.h"
    1212#include "si_gmp.h"
    13 #include <aux.h>
     13#include <auxiliary.h>
    1414
    1515#define SR_HDL(A) ((long)(A))
  • coeffs/mpr_complex.cc

    r19ae652 r95d8df  
    662662  return *this;
    663663}
     664gmp_complex & gmp_complex::neg ( )
     665{
     666  i.neg();
     667  r.neg();
     668  return *this;
     669}
    664670gmp_complex & gmp_complex::operator /= ( const gmp_complex & b )
    665671{
  • coeffs/mpr_complex.h

    r19ae652 r95d8df  
    9999    return *this;
    100100  };
     101
     102  inline gmp_float & neg ( ) { mpf_neg(t,t); return *this; };
    101103
    102104  friend gmp_float operator + ( const gmp_float & a, const gmp_float & b );
     
    204206  ~gmp_complex() {}
    205207
     208  gmp_complex & neg ( );
     209 
    206210  friend gmp_complex operator + ( const gmp_complex & a, const gmp_complex & b );
    207211  friend gmp_complex operator - ( const gmp_complex & a, const gmp_complex & b );
  • coeffs/rmodulo2m.cc

    r19ae652 r95d8df  
    186186  k = k & r->nr2mModul;
    187187  /* now we have: from = j * k mod 2^m */
    188   return (number)nr2mMult((number)j, (number)k);
     188  return (number)nr2mMult((number)j, (number)k,r);
    189189}
    190190
  • reporter/reporter.cc

    r19ae652 r95d8df  
    193193#ifdef HAVE_FACTORY
    194194  // libfac:
    195   extern int libfac_interruptflag;
    196   libfac_interruptflag=1;
     195  //extern int libfac_interruptflag;
     196  //libfac_interruptflag=1;
    197197#endif
    198198}
Note: See TracChangeset for help on using the changeset viewer.