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 767 of file mpr_complex.cc.
771 if ( digits < 1 )
return true;
773 eps=
pow(10.0,(
int)digits);
781 return (c->
real() < eps && (c->
imag() < eps && c->
imag() > epsm));
783 return (c->
real() > epsm && (c->
imag() < eps && c->
imag() > epsm));
Rational pow(const Rational &a, int e)
§ complexToStr()
Definition at line 706 of file mpr_complex.cc.
708 const char * complex_parameter =
"I";
714 N = strlen(complex_parameter);
719 char *out,*in_imag,*in_real;
730 int len=(strlen(in_real)+strlen(in_imag)+7+
N)*
sizeof(
char);
734 sprintf(out,
"(%s%s%s*%s)",in_real,c.
imag().
sign()>=0?
"+":
"-",complex_parameter,in_imag);
738 sprintf(out,
"%s", complex_parameter);
740 sprintf(out,
"-%s", complex_parameter);
742 sprintf(out,
"(%s%s*%s)",c.
imag().
sign()>=0?
"":
"-", complex_parameter,in_imag);
747 int len=(strlen(in_real)+strlen(in_imag)+9) *
sizeof(
char);
751 sprintf(out,
"(%s%s%s)",in_real,c.
imag().
sign()>=0?
"+I*":
"-I*",in_imag);
753 sprintf(out,
"(%s%s)",c.
imag().
sign()>=0?
"I*":
"-I*",in_imag);
755 omFree( (
void *) in_real );
756 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 580 of file mpr_complex.cc.
587 insize= (oprec+2) *
sizeof(
char) + 10;
590 mpf_get_str(in,&exponent,10,oprec,*(r.
mpfp()));
604 out= (
char*)
omAlloc( (strlen(nout)+1) *
sizeof(char) );
611 char *out= (
char*)
omAlloc( (1024) *
sizeof(char) );
612 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 487 of file mpr_complex.cc.
491 int sign= (in[0] ==
'-') ? 1 : 0;
497 sign ? strcpy(csign,
"-") : strcpy(csign,
"+");
500 sign ? strcpy(csign,
"-") : strcpy(csign,
" ");
504 sign ? strcpy(csign,
"-") : strcpy(csign,
"");
508 if ( strlen(in) == 0 )
510 *
size= 2*
sizeof(char);
517 if (
exponent+sign < (
int)strlen(in) )
521 *
size= (strlen(in)+15+eexponent) *
sizeof(
char);
526 strncat(out,in+sign,eeexponent);
535 memset(out+strlen(out),
'0',eexponent);
537 strcat(out,in+sign+eeexponent);
539 else if (
exponent+sign > (
int)strlen(in) )
544 sprintf(out,
"%s%s",csign,in+sign);
545 memset(out+strlen(out),
'0',
exponent-strlen(in)+sign);
549 *
size= (strlen(in)+2) *
sizeof(
char) + 10;
552 sprintf(out,
"%s%s",csign,in+sign);
565 *
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.
475 WerrorS(
"Can not map from field C to field R!");
479 WerrorS(
"Ground field not implemented!");
void WerrorS(const char *s)
§ 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 634 of file mpr_complex.cc.
638 (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 678 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