My Project
Loading...
Searching...
No Matches
mpr_complex.cc
Go to the documentation of this file.
1/****************************************
2* Computer Algebra System SINGULAR *
3****************************************/
4
5/*
6* ABSTRACT - multipolynomial resultants - real floating-point numbers using gmp
7* and complex numbers based on pairs of real floating-point numbers
8*
9*/
10
11// WARNING! ALWAYS use omAlloc and FreeL when alloc. memory for some char* !!
12
13
14#include "misc/auxiliary.h"
15
16#include "reporter/reporter.h"
17
18#include "coeffs/coeffs.h"
19#include "coeffs/numbers.h"
20
21#include "coeffs/mpr_complex.h"
22
23#include "coeffs/longrat.h"
24
25#include <cmath>
26
27
28//%s
29// this was copied form longrat0.cc
30// and will be used in numberToFloat.
31// Make sure that it is up to date!!
32#define SR_HDL(A) ((long)(A))
33#define SR_TO_INT(SR) (((long)SR) >> 2)
34
35#define SIGN_PLUS 1
36#define SIGN_SPACE 2
37#define SIGN_EMPTY 4
38
39#define EXTRABYTES 4
40
41#define DEFPREC 20 // minimum number of digits (output operations)
43
46
47
48/** Set size of mantissa
49 * digits - the number of output digits (basis 10)
50 * the size of mantissa consists of two parts:
51 * the "output" part a and the "rest" part b.
52 * According to the GMP-precision digits is
53 * recomputed to bits (basis 2).
54 * Two numbers a, b are equal if
55 * | a - b | < | a | * 0.1^digits .
56 * In this case we have a - b = 0 .
57 * The epsilon e is e=0.1^(digits+rest) with
58 * 1+e != 1, but 1+0.1*e = 1.
59 */
60void setGMPFloatDigits( size_t digits, size_t rest )
61{
62 size_t bits = 1 + (size_t) ((float)digits * 3.5);
63 size_t rb = 1 + (size_t) ((float)rest * 3.5);
64 size_t db = bits+rb;
65 gmp_output_digits= digits;
66 mpf_set_default_prec( db );
67 if (diff!=NULL) delete diff;
68 diff=new gmp_float(0.0);
69 mpf_set_prec(*diff->_mpfp(),32);
70 if (gmpRel!=NULL) delete gmpRel;
71 gmpRel=new gmp_float(0.0);
72 mpf_set_prec(*gmpRel->_mpfp(),32);
73 mpf_set_d(*gmpRel->_mpfp(),0.1);
74 mpf_pow_ui(*gmpRel->_mpfp(),*gmpRel->_mpfp(),digits);
75}
76
77#if 1
78void gmp_float::setFromStr(const char * in )
79{
80 BOOLEAN neg=false;
81 if (*in == '-') { in++; neg=TRUE; }
82 char *s;
83 if ((s=strchr((char *)in,'E')) !=NULL)
84 {
85 *s='e';
86 }
87
88 // gmp doesn't understand number which begin with "." -- it needs 0.
89 // so, insert the zero
90 if (*in == '.')
91 {
92 int len = strlen(in)+2;
93 char* c_in = (char*) omAlloc(len);
94 *c_in = '0';
95 strcpy(&(c_in[1]), in);
96
97 if(mpf_set_str( t, c_in, 10 )!=0) WerrorS("syntax error in GMP float");
98 omFreeSize((void*)c_in, len);
99 }
100 else
101 {
102 if(mpf_set_str( t, in, 10 )!=0) WerrorS("syntax error in GMP float");
103 }
104 if (neg) mpf_neg( t, t );
105}
106#else
107// problems with solve_s.tst
108void gmp_float::setFromStr(const char * in )
109{
110 BOOLEAN neg=false;
111 BOOLEAN E_found=FALSE;
112 if (*in == '-') { in++; neg=TRUE; }
113 char *s;
114 if ((s=strchr(in,'E')) !=NULL)
115 {
116 *s='e';
117 E_found=TRUE;
118 }
119 // gmp doesn't understand number like 1e1, it need 1e+1
120 // so, insert the +
121 if (E_found ||((s=strchr(in,'e')) !=NULL))
122 {
123 if ((*(s+1)!='+') && (*(s+1)!='-'))
124 {
125 int len = strlen(in)+3;
126 char* c_in = (char*) omAlloc(len);
127 if (*in == '.')
128 {
129 *c_in = '0';
130 strcpy(&(c_in[1]), in);
131 }
132 else
133 {
134 strcpy(c_in, in);
135 }
136 char * ss=strchr(c_in,'e');
137 memmove(ss+2,s+1,strlen(s+1));
138 *(ss+1)+'+';
139
140 mpf_set_str( t, c_in, 10 );
141 omFreeSize((void*)c_in, len);
142 }
143 }
144
145 // gmp doesn't understand number which begin with "." -- it needs 0.
146 // so, insert the zero
147 else if (*in == '.')
148 {
149 int len = strlen(in)+2;
150 char* c_in = (char*) omAlloc(len);
151 *c_in = '0';
152 strcpy(&(c_in[1]), in);
153
154 mpf_set_str( t, c_in, 10 );
155 omFreeSize((void*)c_in, len);
156 }
157 else
158 {
159 mpf_set_str( t, in, 10 );
160 }
161 if (neg) mpf_neg( t, t );
162}
163#endif
164
165
166// <gmp_float> = <gmp_float> operator <gmp_float>
168{
169 gmp_float tmp( a );
170 tmp += b;
171 return tmp;
172}
174{
175 gmp_float tmp( a );
176 tmp -= b;
177 return tmp;
178}
180{
181 gmp_float tmp( a );
182 tmp *= b;
183 return tmp;
184}
186{
187 gmp_float tmp( a );
188 tmp /= b;
189 return tmp;
190}
191
192// <gmp_float> operator <gmp_float>
194{
195 if (mpf_sgn(t) != -(mpf_sgn(a.t)))
196 {
197 mpf_add( t, t, a.t);
198 return *this;
199 }
200 if((mpf_sgn(a.t)==0) && (mpf_sgn(t)==0))
201 {
202 mpf_set_d( t, 0.0);
203 return *this;
204 }
205 mpf_add( t, t, a.t );
206 mpf_set(diff->t, t);
207 mpf_set_prec(diff->t, 32);
208 mpf_div(diff->t, diff->t, a.t);
209 mpf_abs(diff->t, diff->t);
210 if(mpf_cmp(diff->t, gmpRel->t) < 0)
211 mpf_set_d( t, 0.0);
212 return *this;
213}
215{
216 if (mpf_sgn(t) != mpf_sgn(a.t))
217 {
218 mpf_sub( t, t, a.t);
219 return *this;
220 }
221 if((mpf_sgn(a.t)==0) && (mpf_sgn(t)==0))
222 {
223 mpf_set_d( t, 0.0);
224 return *this;
225 }
226 mpf_sub( t, t, a.t );
227 mpf_set(diff->t, t);
228 mpf_set_prec(diff->t, 32);
229 mpf_div(diff->t, diff->t, a.t);
230 mpf_abs(diff->t, diff->t);
231 if(mpf_cmp(diff->t, gmpRel->t) < 0)
232 mpf_set_d( t, 0.0);
233 return *this;
234}
235
236// <gmp_float> == <gmp_float> ??
237bool operator == ( const gmp_float & a, const gmp_float & b )
238{
239 if(mpf_sgn(a.t) != mpf_sgn(b.t))
240 return false;
241 if((mpf_sgn(a.t)==0) && (mpf_sgn(b.t)==0))
242 return true;
243 mpf_sub(diff->t, a.t, b.t);
244 mpf_div(diff->t, diff->t, a.t);
245 mpf_abs(diff->t, diff->t);
246 if(mpf_cmp(diff->t, gmpRel->t) < 0)
247 return true;
248 else
249 return false;
250}
251// t == 0 ?
253{
254 return (mpf_sgn( t ) == 0);
255}
256// t == 1 ?
258{
259#ifdef VARIANTE_1
260 return (mpf_cmp_ui( t , 1 ) == 0);
261#else
262 if (mpf_sgn(t) <= 0)
263 return false;
264 mpf_sub_ui(diff->t, t, 1);
265 mpf_abs(diff->t, diff->t);
266 if(mpf_cmp(diff->t, gmpRel->t) < 0)
267 return true;
268 else
269 return false;
270#endif
271}
272// t == -1 ?
274{
275#ifdef VARIANTE_1
276 return (mpf_cmp_si( t , -1 ) == 0);
277#else
278 if (mpf_sgn(t) >= 0)
279 return false;
280 mpf_add_ui(diff->t, t, 1);
281 mpf_abs(diff->t, diff->t);
282 if(mpf_cmp(diff->t, gmpRel->t) < 0)
283 return true;
284 else
285 return false;
286#endif
287}
288bool operator > ( const gmp_float & a, const gmp_float & b )
289{
290 return mpf_cmp( a.t, b.t ) > 0;
291}
292bool operator < ( const gmp_float & a, const gmp_float & b )
293{
294 return mpf_cmp( a.t, b.t ) < 0;
295}
296bool operator >= ( const gmp_float & a, const gmp_float & b )
297{
298 return mpf_cmp( a.t, b.t ) >= 0;
299}
300bool operator <= ( const gmp_float & a, const gmp_float & b )
301{
302 return mpf_cmp( a.t, b.t ) <= 0;
303}
304
305// unary -
307{
308 gmp_float tmp;
309 mpf_neg( *(tmp._mpfp()), *(a.mpfp()) );
310 return tmp;
311}
312
314{
315 gmp_float tmp;
316 mpf_abs( *(tmp._mpfp()), *a.mpfp() );
317 return tmp;
318}
320{
321 gmp_float tmp;
322 mpf_sqrt( *(tmp._mpfp()), *a.mpfp() );
323 return tmp;
324}
326{
327 gmp_float tmp( sin((double)a) );
328 return tmp;
329}
331{
332 gmp_float tmp( cos((double)a) );
333 return tmp;
334}
336{
337 gmp_float tmp( log((double)a) );
338 return tmp;
339}
340gmp_float hypot( const gmp_float & a, const gmp_float & b )
341{
342#if 1
343 return ( sqrt( (a*a) + (b*b) ) );
344#else
345 gmp_float tmp( hypot( (double)a, (double)b ) );
346 return tmp;
347#endif
348}
350{
351 gmp_float tmp( exp((double)a) );
352 return tmp;
353}
354gmp_float max( const gmp_float & a, const gmp_float & b )
355{
356 gmp_float tmp;
357 a > b ? tmp= a : tmp= b;
358 return tmp;
359}
360//
361// number to float, number = Q, R, C
362// makes a COPY of num! (Ist das gut?)
363//
365{
366 gmp_float r;
367
368 if ( nCoeff_is_Q(src) )
369 {
370 if ( num != NULL )
371 {
372 if (SR_HDL(num) & SR_INT)
373 {
374 //n_Print(num, src);printf("\n");
375 int nn = SR_TO_INT(num);
376 if((long)nn == SR_TO_INT(num))
377 r = SR_TO_INT(num);
378 else
379 r = gmp_float(SR_TO_INT(num));
380 //int dd = 20;
381 //gmp_printf("\nr = %.*Ff\n",dd,*r.mpfp());
382 //getchar();
383 }
384 else
385 {
386 if ( num->s == 0 )
387 {
388 nlNormalize( num, src ); // FIXME? TODO? // extern void nlNormalize(number &x, const coeffs r); // FIXME
389 }
390 if (SR_HDL(num) & SR_INT)
391 {
392 r= SR_TO_INT(num);
393 }
394 else
395 {
396 if ( num->s != 3 )
397 {
398 r= num->z;
399 r/= (gmp_float)num->n;
400 }
401 else
402 {
403 r= num->z;
404 }
405 }
406 }
407 }
408 else
409 {
410 r= 0.0;
411 }
412 }
413 else if (nCoeff_is_long_R(src) || nCoeff_is_long_C(src))
414 {
415 r= *(gmp_float*)num;
416 }
417 else if ( nCoeff_is_R(src) )
418 {
419 // Add some code here :-)
420 WerrorS("Ground field not implemented!");
421 }
422 else
423 {
424 WerrorS("Ground field not implemented!");
425 }
426
427 return r;
428}
429
431{
432 gmp_float r;
433
434 switch (cf)
435 {
436 case QTOF:
437 if ( num != NULL )
438 {
439 if (SR_HDL(num) & SR_INT)
440 {
441 r = gmp_float(SR_TO_INT(num));
442 }
443 else
444 {
445 if ( num->s != 3 )
446 {
447 r= gmp_float(num->z);
448 r/= gmp_float(num->n);
449 }
450 else
451 {
452 r= num->z;
453 }
454 }
455 }
456 else
457 {
458 r= 0.0;
459 }
460 break;
461 case RTOF:
462 r= *(gmp_float*)num;
463 break;
464 case CTOF:
465 WerrorS("Can not map from field C to field R!");
466 break;
467 case ZTOF:
468 default:
469 WerrorS("Ground field not implemented!");
470 } // switch
471
472 return r;
473}
474
475// Do some strange things with the mantissa string and the exponent
476// to get some nice output string.
477char *nicifyFloatStr( char * in, mp_exp_t exponent, size_t oprec, int *size, int thesign )
478{
479 char *out;
480
481 int sign= (in[0] == '-') ? 1 : 0;
482 char csign[2];
483
484 switch (thesign)
485 {
486 case SIGN_PLUS:
487 sign ? strcpy(csign,"-") : strcpy(csign,"+"); //+123, -123
488 break;
489 case SIGN_SPACE:
490 sign ? strcpy(csign,"-") : strcpy(csign," "); // 123, -123
491 break;
492 case SIGN_EMPTY:
493 default:
494 sign ? strcpy(csign,"-") : strcpy(csign,""); //123, -123
495 break;
496 }
497
498 if ( strlen(in) == 0 )
499 {
500 *size= 2*sizeof(char);
501 return omStrDup("0");
502 }
503
504 if ( ((unsigned int)ABS(exponent) <= oprec)
505 /*|| (exponent+sign >= (int)strlen(in))*/ )
506 {
507 if ( exponent+sign < (int)strlen(in) )
508 {
509 int eexponent= (exponent >= 0) ? 0 : -exponent;
510 int eeexponent= (exponent >= 0) ? exponent : 0;
511 *size= (strlen(in)+15+eexponent) * sizeof(char);
512 out= (char*)omAlloc(*size);
513 memset(out,0,*size);
514
515 strcpy(out,csign);
516 strncat(out,in+sign,eeexponent);
517
518 if (exponent == 0)
519 strcat(out,"0.");
520 else if ( exponent > 0 )
521 strcat(out,".");
522 else
523 {
524 strcat(out,"0.");
525 memset(out+strlen(out),'0',eexponent);
526 }
527 strcat(out,in+sign+eeexponent);
528 }
529 else if ( exponent+sign > (int)strlen(in) )
530 {
531 *size= (strlen(in)+exponent+12)*sizeof(char);
532 out= (char*)omAlloc(*size);
533 memset(out,0,*size);
534 sprintf(out,"%s%s",csign,in+sign);
535 memset(out+strlen(out),'0',exponent-strlen(in)+sign);
536 }
537 else
538 {
539 *size= (strlen(in)+2) * sizeof(char) + 10;
540 out= (char*)omAlloc(*size);
541 memset(out,0,*size);
542 sprintf(out,"%s%s",csign,in+sign);
543 }
544 }
545 else
546 {
547// if ( exponent > 0 )
548// {
549 int c=1,d=10;
550 while ( exponent / d > 0 )
551 { // count digits
552 d*=10;
553 c++;
554 }
555 *size= (strlen(in)+12+c) * sizeof(char) + 10;
556 out= (char*)omAlloc(*size);
557 memset(out,0,*size);
558 sprintf(out,"%s0.%se%s%d",csign,in+sign,exponent>=0?"+":"",(int)exponent);
559// }
560// else
561// {
562// *size=2;
563// out= (char*)omAlloc(*size);
564// strcpy(out,"0");
565// }
566 }
567 return out;
568}
569
570char *floatToStr( const gmp_float & r, const unsigned int oprec )
571{
572#if 1
573 mp_exp_t exponent;
574 int size,insize;
575 char *nout,*out,*in;
576
577 insize= (oprec+2) * sizeof(char) + 10;
578 in= (char*)omAlloc( insize );
579
580 mpf_get_str(in,&exponent,10,oprec,*(r.mpfp()));
581
582 //if ( (exponent > 0)
583 //&& (exponent < (int)oprec)
584 //&& (strlen(in)-(in[0]=='-'?1:0) == oprec) )
585 //{
586 // omFree( (void *) in );
587 // insize= (exponent+oprec+2) * sizeof(char) + 10;
588 // in= (char*)omAlloc( insize );
589 // int newprec= exponent+oprec;
590 // mpf_get_str(in,&exponent,10,newprec,*(r.mpfp()));
591 //}
592 nout= nicifyFloatStr( in, exponent, oprec, &size, SIGN_EMPTY );
593 omFree( (void *) in );
594 out= (char*)omAlloc( (strlen(nout)+1) * sizeof(char) );
595 strcpy( out, nout );
596 omFree( (void *) nout );
597
598 return out;
599#else
600 // for testing purpose...
601 char *out= (char*)omAlloc( (1024) * sizeof(char) );
602 sprintf(out,"% .10f",(double)r);
603 return out;
604#endif
605}
606//<-
607
608//-> gmp_complex::*
609// <gmp_complex> = <gmp_complex> operator <gmp_complex>
610//
612{
613 return gmp_complex( a.r + b.r, a.i + b.i );
614}
616{
617 return gmp_complex( a.r - b.r, a.i - b.i );
618}
620{
621 return gmp_complex( a.r * b.r - a.i * b.i,
622 a.r * b.i + a.i * b.r);
623}
625{
626 gmp_float d = b.r*b.r + b.i*b.i;
627 return gmp_complex( (a.r * b.r + a.i * b.i) / d,
628 (a.i * b.r - a.r * b.i) / d);
629}
630
631// <gmp_complex> operator <gmp_complex>
632//
634{
635 r+=b.r;
636 i+=b.i;
637 return *this;
638}
640{
641 r-=b.r;
642 i-=b.i;
643 return *this;
644}
646{
647 gmp_float f = r * b.r - i * b.i;
648 i = r * b.i + i * b.r;
649 r = f;
650 return *this;
651}
653{
654 i.neg();
655 r.neg();
656 return *this;
657}
659{
660 gmp_float d = b.r*b.r + b.i*b.i;
661 r = (r * b.r + i * b.i) / d;
662 i = (i * b.r - r * b.i) / d;
663 return *this;
664}
665
666// Returns square root of gmp_complex number
667//
669{
670 gmp_float r = abs(x);
671 gmp_float nr, ni;
672 if (r == (gmp_float) 0.0)
673 {
674 nr = ni = r;
675 }
676 else if ( x.real() > (gmp_float)0)
677 {
678 nr = sqrt((gmp_float)0.5 * (r + x.real()));
679 ni = x.imag() / nr / (gmp_float)2;
680 }
681 else
682 {
683 ni = sqrt((gmp_float)0.5 * (r - x.real()));
684 if (x.imag() < (gmp_float)0)
685 {
686 ni = - ni;
687 }
688 nr = x.imag() / ni / (gmp_float)2;
689 }
690 gmp_complex tmp(nr, ni);
691 return tmp;
692}
693
694// converts a gmp_complex to a string ( <real part> + I * <imaginary part> )
695//
696char *complexToStr( gmp_complex & c, const unsigned int oprec, const coeffs src )
697{
698 const char * complex_parameter = "I";
699 int N = 1; // strlen(complex_parameter);
700
701 if (nCoeff_is_long_C(src))
702 {
703 complex_parameter = n_ParameterNames(src)[0];
704 N = strlen(complex_parameter);
705 }
706
707 assume( complex_parameter != NULL && N > 0);
708
709 char *out,*in_imag,*in_real;
710
711 c.SmallToZero();
712 if ( !c.imag().isZero() )
713 {
714
715 in_real=floatToStr( c.real(), oprec ); // get real part
716 in_imag=floatToStr( abs(c.imag()), oprec ); // get imaginary part
717
718 if (nCoeff_is_long_C(src))
719 {
720 int len=(strlen(in_real)+strlen(in_imag)+7+N)*sizeof(char);
721 out=(char*)omAlloc(len);
722 memset(out,0,len);
723 if ( !c.real().isZero() ) // (-23-i*5.43) or (15.1+i*5.3)
724 sprintf(out,"(%s%s%s*%s)",in_real,c.imag().sign()>=0?"+":"-",complex_parameter,in_imag);
725 else // (-i*43) or (i*34)
726 {
727 if (c.imag().isOne())
728 sprintf(out,"%s", complex_parameter);
729 else if (c.imag().isMOne())
730 sprintf(out,"-%s", complex_parameter);
731 else
732 sprintf(out,"(%s%s*%s)",c.imag().sign()>=0?"":"-", complex_parameter,in_imag);
733 }
734 }
735 else
736 {
737 int len=(strlen(in_real)+strlen(in_imag)+9) * sizeof(char);
738 out=(char*)omAlloc( len );
739 memset(out,0,len);
740 if ( !c.real().isZero() )
741 sprintf(out,"(%s%s%s)",in_real,c.imag().sign()>=0?"+I*":"-I*",in_imag);
742 else
743 sprintf(out,"(%s%s)",c.imag().sign()>=0?"I*":"-I*",in_imag);
744 }
745 omFree( (void *) in_real );
746 omFree( (void *) in_imag );
747 }
748 else
749 {
750 out= floatToStr( c.real(), oprec );
751 }
752
753 return out;
754}
755//<-
756
757bool complexNearZero( gmp_complex * c, int digits )
758{
759 gmp_float eps,epsm;
760
761 if ( digits < 1 ) return true;
762
763 eps=pow(10.0,(int)digits);
764 //Print("eps: %s\n",floatToStr(eps,gmp_output_digits));
765 eps=(gmp_float)1.0/eps;
766 epsm=-eps;
767
768 //Print("eps: %s\n",floatToStr(eps,gmp_output_digits));
769
770 if ( c->real().sign() > 0 ) // +
771 return (c->real() < eps && (c->imag() < eps && c->imag() > epsm));
772 else // -
773 return (c->real() > epsm && (c->imag() < eps && c->imag() > epsm));
774}
775
777{
778 gmp_float ar=this->real();
779 gmp_float ai=this->imag();
780 if (ar.isZero() || ai.isZero()) return;
781 mpf_abs(*ar._mpfp(), *ar._mpfp());
782 mpf_abs(*ai._mpfp(), *ai._mpfp());
783 mpf_set_prec(*ar._mpfp(), 32);
784 mpf_set_prec(*ai._mpfp(), 32);
785 if (ar > ai)
786 {
787 mpf_div(*ai._mpfp(), *ai._mpfp(), *ar._mpfp());
788 if (ai < *gmpRel) this->imag(0.0);
789 }
790 else
791 {
792 mpf_div(*ar._mpfp(), *ar._mpfp(), *ai._mpfp());
793 if (ar < *gmpRel) this->real(0.0);
794 }
795}
796
797//%e
798
799// local Variables: ***
800// folded-file: t ***
801// compile-command-1: "make installg" ***
802// compile-command-2: "make install" ***
803// End: ***
Rational pow(const Rational &a, int e)
Definition GMPrat.cc:411
All the auxiliary stuff.
static int ABS(int v)
Definition auxiliary.h:113
int BOOLEAN
Definition auxiliary.h:88
#define TRUE
Definition auxiliary.h:101
#define FALSE
Definition auxiliary.h:97
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
Definition cf_ops.cc:600
CanonicalForm num(const CanonicalForm &f)
const CanonicalForm CFMap CFMap & N
Definition cfEzgcd.cc:56
Variable x
Definition cfModGcd.cc:4090
CanonicalForm cf
Definition cfModGcd.cc:4091
CanonicalForm b
Definition cfModGcd.cc:4111
FILE * f
Definition checklibs.c:9
gmp_complex numbers based on
gmp_float i
gmp_float imag() const
gmp_complex(const gmp_float re=0.0, const gmp_float im=0.0)
gmp_complex & operator*=(const gmp_complex &a)
gmp_complex & operator/=(const gmp_complex &a)
void SmallToZero()
gmp_complex & neg()
gmp_complex & operator+=(const gmp_complex &a)
gmp_float r
gmp_float real() const
gmp_complex & operator-=(const gmp_complex &a)
void setFromStr(const char *in)
gmp_float(const int v=0)
Definition mpr_complex.h:34
bool isOne() const
bool isMOne() const
gmp_float & operator-=(const gmp_float &a)
mpf_t * _mpfp()
gmp_float & operator+=(const gmp_float &a)
gmp_float & neg()
bool isZero() const
const mpf_t * mpfp() const
Coefficient rings, fields and other domains suitable for Singular polynomials.
static FORCE_INLINE BOOLEAN nCoeff_is_long_R(const coeffs r)
Definition coeffs.h:884
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
Definition coeffs.h:771
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
Definition coeffs.h:799
static FORCE_INLINE BOOLEAN nCoeff_is_R(const coeffs r)
Definition coeffs.h:829
static FORCE_INLINE BOOLEAN nCoeff_is_long_C(const coeffs r)
Definition coeffs.h:887
const CanonicalForm int s
Definition facAbsFact.cc:51
void WerrorS(const char *s)
Definition feFopen.cc:24
#define STATIC_VAR
Definition globaldefs.h:7
#define VAR
Definition globaldefs.h:5
#define exponent
void nlNormalize(number &x, const coeffs r)
Definition longrat.cc:1482
#define SR_INT
Definition longrat.h:67
#define assume(x)
Definition mod2.h:389
EXTERN_VAR size_t gmp_output_digits
Definition mpr_base.h:115
gmp_float sin(const gmp_float &a)
gmp_float operator*(const gmp_float &a, const gmp_float &b)
char * complexToStr(gmp_complex &c, const unsigned int oprec, const coeffs src)
bool operator<(const gmp_float &a, const gmp_float &b)
bool operator<=(const gmp_float &a, const gmp_float &b)
gmp_float abs(const gmp_float &a)
gmp_float max(const gmp_float &a, const gmp_float &b)
#define SIGN_EMPTY
char * nicifyFloatStr(char *in, mp_exp_t exponent, size_t oprec, int *size, int thesign)
char * floatToStr(const gmp_float &r, const unsigned int oprec)
bool complexNearZero(gmp_complex *c, int digits)
gmp_float sqrt(const gmp_float &a)
#define SIGN_SPACE
#define SIGN_PLUS
#define DEFPREC
gmp_float exp(const gmp_float &a)
gmp_float operator-(const gmp_float &a, const gmp_float &b)
gmp_float operator+(const gmp_float &a, const gmp_float &b)
gmp_float cos(const gmp_float &a)
bool operator==(const gmp_float &a, const gmp_float &b)
gmp_float numberToFloat(number num, const coeffs src)
#define SR_HDL(A)
gmp_float hypot(const gmp_float &a, const gmp_float &b)
gmp_float numberFieldToFloat(number num, int cf)
gmp_float log(const gmp_float &a)
STATIC_VAR gmp_float * gmpRel
#define SR_TO_INT(SR)
gmp_float operator/(const gmp_float &a, const gmp_float &b)
STATIC_VAR gmp_float * diff
bool operator>=(const gmp_float &a, const gmp_float &b)
bool operator>(const gmp_float &a, const gmp_float &b)
void setGMPFloatDigits(size_t digits, size_t rest)
Set size of mantissa digits - the number of output digits (basis 10) the size of mantissa consists of...
#define RTOF
Definition mpr_complex.h:20
#define QTOF
Definition mpr_complex.h:19
#define ZTOF
Definition mpr_complex.h:18
#define CTOF
Definition mpr_complex.h:21
The main handler for Singular numbers which are suitable for Singular polynomials.
#define omStrDup(s)
#define omFreeSize(addr, size)
#define omAlloc(size)
#define omFree(addr)
#define NULL
Definition omList.c:12
static int sign(int x)
Definition ring.cc:3503