Go to the source code of this file.
|
| 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 two parts: the "output" part a and the "rest" part b. More...
|
| |
| gmp_float | operator+ (const gmp_float &a, const gmp_float &b) |
| |
| gmp_float | operator- (const gmp_float &a, const gmp_float &b) |
| |
| gmp_float | operator* (const gmp_float &a, const gmp_float &b) |
| |
| gmp_float | operator/ (const gmp_float &a, const gmp_float &b) |
| |
| bool | operator== (const gmp_float &a, const gmp_float &b) |
| |
| bool | operator> (const gmp_float &a, const gmp_float &b) |
| |
| bool | operator< (const gmp_float &a, const gmp_float &b) |
| |
| bool | operator>= (const gmp_float &a, const gmp_float &b) |
| |
| bool | operator<= (const gmp_float &a, const gmp_float &b) |
| |
| gmp_float | operator- (const gmp_float &a) |
| |
| gmp_float | abs (const gmp_float &a) |
| |
| gmp_float | sqrt (const gmp_float &a) |
| |
| gmp_float | sin (const gmp_float &a) |
| |
| gmp_float | cos (const gmp_float &a) |
| |
| gmp_float | log (const gmp_float &a) |
| |
| gmp_float | hypot (const gmp_float &a, const gmp_float &b) |
| |
| gmp_float | exp (const gmp_float &a) |
| |
| gmp_float | max (const gmp_float &a, const gmp_float &b) |
| |
| gmp_float | numberToFloat (number num, const coeffs src) |
| |
| gmp_float | numberFieldToFloat (number num, int k, const coeffs src) |
| |
| 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) |
| |
| gmp_complex | operator+ (const gmp_complex &a, const gmp_complex &b) |
| |
| gmp_complex | operator- (const gmp_complex &a, const gmp_complex &b) |
| |
| gmp_complex | operator* (const gmp_complex &a, const gmp_complex &b) |
| |
| gmp_complex | operator/ (const gmp_complex &a, const gmp_complex &b) |
| |
| gmp_complex | sqrt (const gmp_complex &x) |
| |
| char * | complexToStr (gmp_complex &c, const unsigned int oprec, const coeffs src) |
| |
| bool | complexNearZero (gmp_complex *c, int digits) |
| |
§ DEFPREC
§ EXTRABYTES
§ SIGN_EMPTY
§ SIGN_PLUS
§ SIGN_SPACE
§ SR_HDL
| #define SR_HDL |
( |
|
A | ) |
((long)(A)) |
§ SR_TO_INT
| #define SR_TO_INT |
( |
|
SR | ) |
(((long)SR) >> 2) |
§ abs()
§ complexNearZero()
Definition at line 778 of file mpr_complex.cc.
782 if ( digits < 1 )
return true;
784 eps=
pow(10.0,(
int)digits);
792 return (c->
real() < eps && (c->
imag() < eps && c->
imag() > epsm));
794 return (c->
real() > epsm && (c->
imag() < eps && c->
imag() > epsm));
Rational pow(const Rational &a, int e)
§ complexToStr()
Definition at line 717 of file mpr_complex.cc.
719 const char * complex_parameter =
"I";
725 N = strlen(complex_parameter);
730 char *out,*in_imag,*in_real;
741 int len=(strlen(in_real)+strlen(in_imag)+7+
N)*
sizeof(
char);
745 sprintf(out,
"(%s%s%s*%s)",in_real,c.
imag().
sign()>=0?
"+":
"-",complex_parameter,in_imag);
749 sprintf(out,
"%s", complex_parameter);
751 sprintf(out,
"-%s", complex_parameter);
753 sprintf(out,
"(%s%s*%s)",c.
imag().
sign()>=0?
"":
"-", complex_parameter,in_imag);
758 int len=(strlen(in_real)+strlen(in_imag)+9) *
sizeof(
char);
762 sprintf(out,
"(%s%s%s)",in_real,c.
imag().
sign()>=0?
"+I*":
"-I*",in_imag);
764 sprintf(out,
"(%s%s)",c.
imag().
sign()>=0?
"I*":
"-I*",in_imag);
766 omFree( (
void *) in_real );
767 omFree( (
void *) in_imag );
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
static FORCE_INLINE BOOLEAN nCoeff_is_long_C(const coeffs r)
const CanonicalForm CFMap CFMap & N
gmp_float abs(const gmp_float &a)
char * floatToStr(const gmp_float &r, const unsigned int oprec)
§ cos()
§ exp()
§ floatToStr()
Definition at line 591 of file mpr_complex.cc.
598 insize= (oprec+2) *
sizeof(
char) + 10;
601 mpf_get_str(in,&exponent,10,oprec,*(r.
mpfp()));
615 out= (
char*)
omAlloc( (strlen(nout)+1) *
sizeof(char) );
622 char *out= (
char*)
omAlloc( (1024) *
sizeof(char) );
623 sprintf(out,
"% .10f",(
double)r);
char * nicifyFloatStr(char *in, mp_exp_t exponent, size_t oprec, int *size, int thesign)
const mpf_t * mpfp() const
int exponent(const CanonicalForm &f, int q)
int exponent ( const CanonicalForm & f, int q )
§ hypot()
Definition at line 350 of file mpr_complex.cc.
353 return (
sqrt( (a*a) + (b*b) ) );
gmp_float hypot(const gmp_float &a, const gmp_float &b)
gmp_float sqrt(const gmp_float &a)
§ log()
§ max()
§ nicifyFloatStr()
| char* nicifyFloatStr |
( |
char * |
in, |
|
|
mp_exp_t |
exponent, |
|
|
size_t |
oprec, |
|
|
int * |
size, |
|
|
int |
thesign |
|
) |
| |
Definition at line 498 of file mpr_complex.cc.
502 int sign= (in[0] ==
'-') ? 1 : 0;
508 sign ? strcpy(csign,
"-") : strcpy(csign,
"+");
511 sign ? strcpy(csign,
"-") : strcpy(csign,
" ");
515 sign ? strcpy(csign,
"-") : strcpy(csign,
"");
519 if ( strlen(in) == 0 )
521 *
size= 2*
sizeof(char);
528 if (
exponent+sign < (
int)strlen(in) )
532 *
size= (strlen(in)+15+eexponent) *
sizeof(
char);
537 strncat(out,in+sign,eeexponent);
546 memset(out+strlen(out),
'0',eexponent);
548 strcat(out,in+sign+eeexponent);
550 else if (
exponent+sign > (
int)strlen(in) )
555 sprintf(out,
"%s%s",csign,in+sign);
556 memset(out+strlen(out),
'0',
exponent-strlen(in)+sign);
560 *
size= (strlen(in)+2) *
sizeof(
char) + 10;
563 sprintf(out,
"%s%s",csign,in+sign);
576 *
size= (strlen(in)+12+c) *
sizeof(
char) + 10;
int exponent(const CanonicalForm &f, int q)
int exponent ( const CanonicalForm & f, int q )
§ numberFieldToFloat()
Definition at line 440 of file mpr_complex.cc.
486 WerrorS(
"Can not map from field C to field R!");
490 WerrorS(
"Ground field not implemented!");
void WerrorS(const char *s)
void nlNormalize(number &x, const coeffs r)
§ numberToFloat()
Definition at line 374 of file mpr_complex.cc.
430 WerrorS(
"Ground field not implemented!");
434 WerrorS(
"Ground field not implemented!");
static FORCE_INLINE BOOLEAN nCoeff_is_long_R(const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_R(const coeffs r)
void WerrorS(const char *s)
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_long_C(const coeffs r)
void nlNormalize(number &x, const coeffs r)
§ operator*() [1/2]
§ operator*() [2/2]
§ operator+() [1/2]
§ operator+() [2/2]
§ operator-() [1/3]
§ operator-() [2/3]
§ operator-() [3/3]
§ operator/() [1/2]
§ operator/() [2/2]
Definition at line 645 of file mpr_complex.cc.
649 (a.
i * b.
r - a.
r * b.
i) / d);
gmp_complex numbers based on
§ operator<()
§ operator<=()
§ operator==()
Definition at line 239 of file mpr_complex.cc.
241 if(mpf_sgn(a.
t) != mpf_sgn(b.
t))
243 if((mpf_sgn(a.
t)==0) && (mpf_sgn(b.
t)==0))
static gmp_float * gmpRel
§ operator>()
§ operator>=()
§ setGMPFloatDigits()
| 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 two parts: the "output" part a and the "rest" part b.
According to the GMP-precision digits is recomputed to bits (basis 2). Two numbers a, b are equal if | a - b | < | a | * 0.1^digits . In this case we have a - b = 0 . The epsilon e is e=0.1^(digits+rest) with 1+e != 1, but 1+0.1*e = 1.
Definition at line 62 of file mpr_complex.cc.
64 size_t bits = 1 + (size_t) ((
float)digits * 3.5);
65 size_t rb = 1 + (size_t) ((
float)rest * 3.5);
68 mpf_set_default_prec( db );
static gmp_float * gmpRel
§ sin()
§ sqrt() [1/2]
§ sqrt() [2/2]
Definition at line 689 of file mpr_complex.cc.
gmp_complex numbers based on
gmp_float sqrt(const gmp_float &a)
gmp_float abs(const gmp_float &a)
§ diff
§ gmp_output_digits
§ gmpRel