Changeset 32cc7e in git


Ignore:
Timestamp:
Sep 28, 2011, 5:47:12 PM (13 years ago)
Author:
Burcin Erocal <burcin@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
85fd9012469ea8abe27f4869c1fdec9987b77063
Parents:
aa98be749867c7cb115d6a8245308363068b1c0d
git-author:
Burcin Erocal <burcin@erocal.org>2011-09-28 17:47:12+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 16:13:41+01:00
Message:
Implement setting precision of real and complex coefficient domains.
Location:
libpolys/coeffs
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/coeffs.h

    raa98be r32cc7e  
    7272} GFInfo;
    7373
     74typedef struct
     75{
     76  short      float_len; /**< additional char-flags, rInit */
     77  short      float_len2; /**< additional char-flags, rInit */
     78  const char* par_name; /**< parameter name */
     79} LongComplexInfo;
    7480
    7581struct n_Procs_s
     
    290296{
    291297  assume(r!=NULL); // r==NULL is an error
    292   if (r->cfSetChar!=NULL) r->cfSetChar(r);
     298  assume(r->cfSetChar != NULL);
     299  r->cfSetChar(r);
    293300}
    294301
  • libpolys/coeffs/ffields.cc

    raa98be r32cc7e  
    762762  //r->cfInitChar=npInitChar;
    763763  //r->cfKillChar=nfKillChar;
    764   r->cfSetChar= NULL;
    765764  r->nCoeffIsEqual=nfCoeffIsEqual;
    766765
  • libpolys/coeffs/gnumpc.cc

    raa98be r32cc7e  
    375375}
    376376
    377 BOOLEAN ngcInitChar(coeffs n, void* p)
     377BOOLEAN ngcCoeffIsEqual (const coeffs r, n_coeffType n, void * parameter)
     378{
     379  if (n==ID) {
     380    LongComplexInfo* p = (LongComplexInfo *)(parameter);
     381    if (p->float_len == r->float_len && p->float_len2 == r->float_len2 &&
     382                    strcmp(p->par_name, r->complex_parameter))
     383      return TRUE;
     384  }
     385  return FALSE;
     386}
     387
     388BOOLEAN ngcInitChar(coeffs n, void* parameter)
    378389{
    379390  assume( getCoeffType(n) == ID );
     391  assume( parameter != NULL);
     392
    380393  n->cfKillChar = ndKillChar; /* dummy */
    381394  n->ch = 0;
     
    411424#endif
    412425
    413   n->nCoeffIsEqual = ndCoeffIsEqual;
    414 
     426  n->nCoeffIsEqual = ngcCoeffIsEqual;
     427
     428  n->cfSetChar=ngcSetChar;
    415429
    416430
     
    418432  //r->cfInitChar=nlInitChar;
    419433  r->cfKillChar=NULL;
    420   r->cfSetChar=NULL;
    421   r->nCoeffIsEqual=nlCoeffsEqual;
    422434
    423435  r->cfMult  = nlMult;
     
    477489*/
    478490
    479 /// TODO: Any variables?
    480   if( p == NULL )
    481     n->complex_parameter = omStrDup((char*)"i");
    482   else
    483     n->complex_parameter = omStrDup( (char*) p );
     491  LongComplexInfo* p = (LongComplexInfo*)parameter;
     492  n->complex_parameter = omStrDup(p->par_name);
     493  n->float_len = p->float_len;
     494  n->float_len2 = p->float_len2;
    484495
    485496  return FALSE;
    486497}
    487498
    488 
     499void ngcSetChar(const coeffs r)
     500{
     501  setGMPFloatDigits(r->float_len, r->float_len2);
     502}
    489503
    490504
  • libpolys/coeffs/gnumpc.h

    raa98be r32cc7e  
    1616BOOLEAN ngcInitChar(coeffs r, void*);
    1717
     18void ngcSetChar(const coeffs r);
    1819
    1920// Private interface should be hidden!!!
  • libpolys/coeffs/gnumpfl.cc

    raa98be r32cc7e  
    304304/*2
    305305* extracts the number a from s, returns the rest
     306*
     307* This is also called to print components of complex coefficients.
     308* Handle with care!
    306309*/
    307310const char * ngfRead (const char * start, number * a, const coeffs r)
    308311{
    309   assume( getCoeffType(r) == ID );
     312  assume( getCoeffType(r) == ID or getCoeffType(r) == n_long_C);
    310313 
    311314  char *s= (char *)start;
     
    383386}
    384387
    385 BOOLEAN ngfInitChar(coeffs n, void *)
     388BOOLEAN ngfCoeffIsEqual (const coeffs r, n_coeffType n, void * parameter)
     389{
     390  if (n==ID) {
     391    LongComplexInfo* p = (LongComplexInfo *)(parameter);
     392    if (p->float_len == r->float_len && p->float_len2 == r->float_len2)
     393      return TRUE;
     394  }
     395  return FALSE;
     396}
     397
     398void ngfSetChar(const coeffs r)
     399{
     400  setGMPFloatDigits(r->float_len, r->float_len2);
     401}
     402
     403BOOLEAN ngfInitChar(coeffs n, void *parameter)
    386404{
    387405  assume( getCoeffType(n) == ID );
     406  assume( parameter != NULL);
     407  LongComplexInfo *p = (LongComplexInfo*)parameter;
     408
    388409  n->cfKillChar = ndKillChar; /* dummy */
     410
     411  n->cfSetChar = ngfSetChar;
    389412  n->ch = 0;
    390413 
     
    416439#endif
    417440
    418   n->nCoeffIsEqual = ndCoeffIsEqual;
     441  n->nCoeffIsEqual = ngfCoeffIsEqual;
     442
     443  n->float_len = p->float_len;
     444  n->float_len2 = p->float_len2;
     445
    419446  return FALSE;
    420447}
  • libpolys/coeffs/gnumpfl.h

    raa98be r32cc7e  
    4242void     ngfDelete(number *a, const coeffs r);
    4343
    44 void setGMPFloatDigits( size_t digits, size_t rest );
    4544number ngfMapQ(number from, const coeffs r);
    4645
  • libpolys/coeffs/longrat.cc

    raa98be r32cc7e  
    26022602
    26032603  r->cfKillChar=NULL;
    2604   r->cfSetChar=NULL;
    26052604  r->nCoeffIsEqual=ndCoeffIsEqual;
    26062605  r->cfKillChar = ndKillChar; /* dummy */
  • libpolys/coeffs/numbers.cc

    raa98be r32cc7e  
    116116}
    117117void ndKillChar(coeffs) {}
     118void ndSetChar(const coeffs) {}
    118119
    119120number nd_Copy(number a, const coeffs r) { return n_Copy(a, r); }
     
    235236
    236237    //n->cfKillChar = ndKillChar; /* dummy */
     238    n->cfSetChar = ndSetChar; /* dummy */
    237239    // temp. removed to catch all the coeffs which miss to implement this!
    238240
     
    276278    assume(n->nCoeffIsEqual!=NULL);
    277279    if(n->cfKillChar==NULL) Warn("cfKillChar is NULL for coeff %d",t);
    278     if(n->cfSetChar!=NULL) Warn("cfSetChar is NOT NULL for coeff %d",t);
     280                assume(n->cfSetChar!=NULL);
    279281    assume(n->cfMult!=NULL);
    280282    assume(n->cfSub!=NULL);
  • libpolys/coeffs/rintegers.cc

    raa98be r32cc7e  
    386386{
    387387  assume( getCoeffType(r) == ID );
    388   r->cfSetChar= NULL;
    389388  r->nCoeffIsEqual = ndCoeffIsEqual;
    390389  r->cfKillChar = ndKillChar;
Note: See TracChangeset for help on using the changeset viewer.