Changeset 8cb8e1 in git


Ignore:
Timestamp:
Apr 28, 2010, 2:53:08 PM (13 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
Children:
db3180ca57d54e8d3b4f38b7dc0c1af1a3bdba44
Parents:
77e585d91301adb39a7f4d69c34f795b82ace33a
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2010-04-28 14:53:08+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 11:49:01+01:00
Message:
Fixed gnumpc.*
Location:
coeffs
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • coeffs/gnumpc.cc

    r77e585 r8cb8e1  
    1616#include "gnumpfl.h"
    1717#include "mpr_complex.h"
     18#include "output.h"
     19#include "omalloc.h"
    1820
    1921extern size_t gmp_output_digits;
    2022
    2123
    22 number ngcMapQ(number from)
     24number ngcMapQ(number from, const coeffs)
    2325{
    2426  if ( from != NULL )
     
    3941  number N() const {return _n;}
    4042};
    41 static number ngcMapLongR(number from)
     43static number ngcMapLongR(number from, const coeffs)
    4244{
    4345  if ( from != NULL )
     
    4951    return NULL;
    5052}
    51 static number ngcMapR(number from)
     53static number ngcMapR(number from, const coeffs)
    5254{
    5355  if ( from != NULL )
     
    6062}
    6163extern ring ngfMapRing;
    62 static number ngcMapP(number from)
     64static number ngcMapP(number from, const coeffs)
    6365{
    6466  if ( from != NULL)
     
    145147
    146148/*2
    147 * copy a to b
    148 */
    149 number ngcCopy(number a)
     149 * copy a to b
     150*/
     151number ngcCopy(number a, const coeffs)
    150152{
    151153  gmp_complex* b= new gmp_complex( *(gmp_complex*)a );
     
    163165gmp_complex ngc_m1(-1);
    164166
    165 number ngcNeg (number a)
     167number ngcNeg (number a, const coeffs)
    166168{
    167169  gmp_complex* r=(gmp_complex*)a;
     
    173175* 1/a
    174176*/
    175 number ngcInvers(number a)
     177number ngcInvers(number a, const coeffs)
    176178{
    177179  gmp_complex* r = NULL;
     
    190192* u:= a + b
    191193*/
    192 number ngcAdd (number a, number b)
     194number ngcAdd (number a, number b, const coeffs)
    193195{
    194196  gmp_complex* r= new gmp_complex( (*(gmp_complex*)a) + (*(gmp_complex*)b) );
     
    199201* u:= a - b
    200202*/
    201 number ngcSub (number a, number b)
     203number ngcSub (number a, number b, const coeffs R)
    202204{
    203205  gmp_complex* r= new gmp_complex( (*(gmp_complex*)a) - (*(gmp_complex*)b) );
     
    217219* u := a / b
    218220*/
    219 number ngcDiv (number a, number b)
     221number ngcDiv (number a, number b, const coeffs)
    220222{
    221223  if (((gmp_complex*)b)->isZero())
     
    232234* u:= x ^ exp
    233235*/
    234 void ngcPower ( number x, int exp, number * u )
     236void ngcPower ( number x, int exp, number * u, const coeffs R)
    235237{
    236238  if ( exp == 0 )
     
    259261  if (exp&1==1)
    260262  {
    261     ngcPower(x,exp-1,u);
     263    ngcPower(x,exp-1,u, R);
    262264    gmp_complex *n=new gmp_complex();
    263265    *n=*(gmp_complex*)x;
     
    269271    number w;
    270272    nNew(&w);
    271     ngcPower(x,exp/2,&w);
    272     ngcPower(w,2,u);
     273    ngcPower(x,exp/2,&w, R);
     274    ngcPower(w,2,u, R);
    273275    nDelete(&w);
    274276  }
    275277}
    276278
    277 BOOLEAN ngcIsZero (number a)
     279BOOLEAN ngcIsZero (number a, const coeffs)
    278280{
    279281  return ( ((gmp_complex*)a)->real().isZero() && ((gmp_complex*)a)->imag().isZero());
    280282}
    281283
    282 number ngcRePart(number a)
     284number ngcRePart(number a, const coeffs)
    283285{
    284286  gmp_complex* n = new gmp_complex(((gmp_complex*)a)->real());
     
    286288}
    287289
    288 number ngcImPart(number a)
     290number ngcImPart(number a, const coeffs)
    289291{
    290292  gmp_complex* n = new gmp_complex(((gmp_complex*)a)->imag());
     
    295297* za >= 0 ?
    296298*/
    297 BOOLEAN ngcGreaterZero (number a)
     299BOOLEAN ngcGreaterZero (number a, const coeffs)
    298300{
    299301  if ( ! ((gmp_complex*)a)->imag().isZero() )
     
    306308* a > b ?
    307309*/
    308 BOOLEAN ngcGreater (number a, number b)
     310BOOLEAN ngcGreater (number a, number b, const coeffs)
    309311{
    310312  gmp_complex *aa=(gmp_complex*)a;
     
    316318* a = b ?
    317319*/
    318 BOOLEAN ngcEqual (number a, number b)
     320BOOLEAN ngcEqual (number a, number b, const coeffs)
    319321{
    320322  gmp_complex *aa=(gmp_complex*)a;
     
    326328* a == 1 ?
    327329*/
    328 BOOLEAN ngcIsOne (number a)
     330BOOLEAN ngcIsOne (number a, const coeffs)
    329331{
    330332  return (((gmp_complex*)a)->real().isOne() && ((gmp_complex*)a)->imag().isZero());
     
    335337* a == -1 ?
    336338*/
    337 BOOLEAN ngcIsMOne (number a)
     339BOOLEAN ngcIsMOne (number a, const coeffs)
    338340{
    339341  return (((gmp_complex*)a)->real().isMOne() && ((gmp_complex*)a)->imag().isZero());
     
    344346* extracts the number a from s, returns the rest
    345347*/
    346 const char * ngcRead (const char * s, number * a)
     348const char * ngcRead (const char * s, number * a, const coeffs R)
    347349{
    348350  if ((*s >= '0') && (*s <= '9'))
    349351  {
    350352    gmp_float *re=NULL;
    351     s=ngfRead(s,(number *)&re);
     353    s=ngfRead(s,(number *)&re, R);
    352354    gmp_complex *aa=new gmp_complex(*re);
    353355    *a=(number)aa;
  • coeffs/gnumpc.h

    r77e585 r8cb8e1  
    2626number   ngcDiv(number a, number b, const coeffs r);
    2727void     ngcPower(number x, int exp, number *lu, const coeffs r);
    28 number   ngcCopy(number a);
     28number   ngcCopy(number a, const coeffs);
    2929number   ngc_Copy(number a, coeffs r);
    3030const char * ngcRead (const char *s, number *a, const coeffs r);
     
    3535
    3636#ifdef LDEBUG
    37 BOOLEAN  ngcDBTest(number a, const char *f, const int l);
     37BOOLEAN  ngcDBTest(number a, const char *f, const int l, const coeffs);
    3838#endif
    3939void     ngcDelete(number *a, const coeffs r);
  • coeffs/numbers.h

    r77e585 r8cb8e1  
    114114
    115115
     116#ifdef _TRY
     117#define rField_is_Q(r) nField_is_Q(r)
     118#define rField_is_long_R(r) nField_is_long_R(r)
     119#define rField_is_long_C(r) nField_is_long_C(r)
     120#define rField_is_R(r) nField_is_R(r)
     121#define rField_is_Zp(r) nField_is_Zp(r)
     122#endif
     123
     124
    116125#ifdef HAVE_RINGS
    117126static inline BOOLEAN nField_is_Zp(const coeffs r)
     
    124133{ return (r->ringtype == 0) && (r->ch == 0) && (r->parameter==NULL); }
    125134
     135
    126136static inline BOOLEAN nField_is_numeric(const coeffs r) /* R, long R, long C */
    127137{ return (r->ringtype == 0) && (r->ch ==  -1); }
     
    162172  return FALSE;
    163173}
     174
    164175#else
     176
     177
    165178static inline BOOLEAN nField_is_Zp(const coeffs r)
    166179{ return (r->ch > 1) && (r->parameter==NULL); }
Note: See TracChangeset for help on using the changeset viewer.