Loading...
Searching...
No Matches
gmp_complex Class Reference

gmp_complex numbers based on More...

`#include <mpr_complex.h>`

## Public Member Functions

| gmp_complex (const gmp_float re=0.0, const gmp_float im=0.0)
| gmp_complex (const mprfloat re, const mprfloat im=0.0)
| gmp_complex (const long re, const long im)
| gmp_complex (const gmp_complex &v)
| ~gmp_complex ()
gmp_complex & | neg ()
gmp_complex & | operator+= (const gmp_complex &a)
gmp_complex & | operator-= (const gmp_complex &a)
gmp_complex & | operator*= (const gmp_complex &a)
gmp_complex & | operator/= (const gmp_complex &a)
gmp_complex & | operator= (const gmp_complex &a)
gmp_complex & | operator= (const gmp_float &f)
gmp_float | real () const
gmp_float | imag () const
void | real (gmp_float val)
void | imag (gmp_float val)
bool | isZero ()
void | SmallToZero ()

## Private Attributes

gmp_float | r
gmp_float | i

## Friends

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 | operator+ (const gmp_complex &a, const gmp_float b_d)
gmp_complex | operator- (const gmp_complex &a, const gmp_float b_d)
gmp_complex | operator* (const gmp_complex &a, const gmp_float b_d)
gmp_complex | operator/ (const gmp_complex &a, const gmp_float b_d)
bool | operator== (const gmp_complex &a, const gmp_complex &b)
bool | operator> (const gmp_complex &a, const gmp_complex &b)
bool | operator< (const gmp_complex &a, const gmp_complex &b)
bool | operator>= (const gmp_complex &a, const gmp_complex &b)
bool | operator<= (const gmp_complex &a, const gmp_complex &b)

## Detailed Description

gmp_complex numbers based on

Definition at line 180 of file mpr_complex.h.

## Constructor & Destructor Documentation

## gmp_complex() [1/4]

gmp_complex::gmp_complex | ( | const gmp_float | re = 0.0,
|  | const gmp_float | im = 0.0 )

inline

Definition at line 186 of file mpr_complex.h.

{
r= re;
i= im;
}
gmp_complex::i
gmp_float i
Definition mpr_complex.h:183
gmp_complex::r
gmp_float r
Definition mpr_complex.h:183

## gmp_complex() [2/4]

gmp_complex::gmp_complex | ( | const mprfloat | re,
|  | const mprfloat | im = 0.0 )

inline

Definition at line 191 of file mpr_complex.h.

{
r= re;
i= im;
}

## gmp_complex() [3/4]

gmp_complex::gmp_complex | ( | const long | re,
|  | const long | im )

inline

Definition at line 196 of file mpr_complex.h.

{
r= re;
i= im;
}

## gmp_complex() [4/4]

gmp_complex::gmp_complex | ( | const gmp_complex & | v | ) |

inline

Definition at line 201 of file mpr_complex.h.

{
r= v.r;
i= v.i;
}
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39

## ~gmp_complex()

gmp_complex::~gmp_complex | ( |  | ) |

inline

Definition at line 206 of file mpr_complex.h.

{}

## Member Function Documentation

## imag() [1/2]

gmp_float gmp_complex::imag | ( |  | ) | const

inline

Definition at line 237 of file mpr_complex.h.

{ return i; }

## imag() [2/2]

void gmp_complex::imag | ( | gmp_float | val | ) |

inline

Definition at line 240 of file mpr_complex.h.

{ i = val; }

## isZero()

bool gmp_complex::isZero | ( |  | ) |

inline

Definition at line 243 of file mpr_complex.h.

{ return (r.isZero() && i.isZero()); }

## neg()

gmp_complex & gmp_complex::neg | ( |  | ) |

Definition at line 649 of file mpr_complex.cc.

{
i.neg();
r.neg();
return *this;
}

## operator*=()

gmp_complex & gmp_complex::operator*= | ( | const gmp_complex & | a | ) |

Definition at line 642 of file mpr_complex.cc.

{
gmp_float f = r * b.r - i * b.i;
i = r * b.i + i * b.r;
r = f;
return *this;
}
b
CanonicalForm b
Definition cfModGcd.cc:4111
f
FILE * f
Definition checklibs.c:9

## operator+=()

gmp_complex & gmp_complex::operator+= | ( | const gmp_complex & | a | ) |

Definition at line 630 of file mpr_complex.cc.

{
r+=b.r;
i+=b.i;
return *this;
}

## operator-=()

gmp_complex & gmp_complex::operator-= | ( | const gmp_complex & | a | ) |

Definition at line 636 of file mpr_complex.cc.

{
r-=b.r;
i-=b.i;
return *this;
}

## operator/=()

gmp_complex & gmp_complex::operator/= | ( | const gmp_complex & | a | ) |

Definition at line 655 of file mpr_complex.cc.

{
gmp_float d = b.r*b.r + b.i*b.i;
r = (r * b.r + i * b.i) / d;
i = (i * b.r - r * b.i) / d;
return *this;
}

## operator=() [1/2]

gmp_complex & gmp_complex::operator= | ( | const gmp_complex & | a | ) |

inline

Definition at line 290 of file mpr_complex.h.

{
r= a.r;
i= a.i;
return *this;
}

## operator=() [2/2]

gmp_complex & gmp_complex::operator= | ( | const gmp_float & | f | ) |

inline

Definition at line 298 of file mpr_complex.h.

{
r= f;
i= (long int)0;
return *this;
}

## real() [1/2]

gmp_float gmp_complex::real | ( |  | ) | const

inline

Definition at line 236 of file mpr_complex.h.

{ return r; }

## real() [2/2]

void gmp_complex::real | ( | gmp_float | val | ) |

inline

Definition at line 239 of file mpr_complex.h.

{ r = val; }

## SmallToZero()

void gmp_complex::SmallToZero | ( |  | ) |

Definition at line 773 of file mpr_complex.cc.

{
gmp_float ar=this->real();
gmp_float ai=this->imag();
if (ar.isZero() || ai.isZero()) return;
mpf_abs(*ar._mpfp(), *ar._mpfp());
mpf_abs(*ai._mpfp(), *ai._mpfp());
mpf_set_prec(*ar._mpfp(), 32);
mpf_set_prec(*ai._mpfp(), 32);
if (ar > ai)
{
mpf_div(*ai._mpfp(), *ai._mpfp(), *ar._mpfp());
if (ai < *gmpRel) this->imag(0.0);
}
else
{
mpf_div(*ar._mpfp(), *ar._mpfp(), *ai._mpfp());
if (ar < *gmpRel) this->real(0.0);
}
}
gmp_complex::imag
gmp_float imag() const
Definition mpr_complex.h:237
gmp_complex::real
gmp_float real() const
Definition mpr_complex.h:236
gmp_float::_mpfp
mpf_t * _mpfp()
Definition mpr_complex.h:136
gmp_float::isZero
bool isZero() const
Definition mpr_complex.cc:252
gmpRel
STATIC_VAR gmp_float * gmpRel
Definition mpr_complex.cc:44

## Friends And Related Symbol Documentation

## operator* [1/2]

gmp_complex operator* | ( | const gmp_complex & | a,
|  | const gmp_complex & | b )

friend

Definition at line 616 of file mpr_complex.cc.

{
return gmp_complex( a.r * b.r - a.i * b.i,
a.r * b.i + a.i * b.r);
}
gmp_complex::gmp_complex
gmp_complex(const gmp_float re=0.0, const gmp_float im=0.0)
Definition mpr_complex.h:186

## operator* [2/2]

gmp_complex operator* | ( | const gmp_complex & | a,
|  | const gmp_float | b_d )

friend

Definition at line 257 of file mpr_complex.h.

{
return gmp_complex( a.r * b_d, a.i * b_d );
}

## operator+ [1/2]

gmp_complex operator+ | ( | const gmp_complex & | a,
|  | const gmp_complex & | b )

friend

Definition at line 608 of file mpr_complex.cc.

{
return gmp_complex( a.r + b.r, a.i + b.i );
}

## operator+ [2/2]

gmp_complex operator+ | ( | const gmp_complex & | a,
|  | const gmp_float | b_d )

friend

Definition at line 249 of file mpr_complex.h.

{
return gmp_complex( a.r + b_d, a.i );
}

## operator- [1/2]

gmp_complex operator- | ( | const gmp_complex & | a,
|  | const gmp_complex & | b )

friend

Definition at line 612 of file mpr_complex.cc.

{
return gmp_complex( a.r - b.r, a.i - b.i );
}

## operator- [2/2]

gmp_complex operator- | ( | const gmp_complex & | a,
|  | const gmp_float | b_d )

friend

Definition at line 253 of file mpr_complex.h.

{
return gmp_complex( a.r - b_d, a.i );
}

## operator/ [1/2]

gmp_complex operator/ | ( | const gmp_complex & | a,
|  | const gmp_complex & | b )

friend

Definition at line 621 of file mpr_complex.cc.

{
gmp_float d = b.r*b.r + b.i*b.i;
return gmp_complex( (a.r * b.r + a.i * b.i) / d,
(a.i * b.r - a.r * b.i) / d);
}

## operator/ [2/2]

gmp_complex operator/ | ( | const gmp_complex & | a,
|  | const gmp_float | b_d )

friend

Definition at line 261 of file mpr_complex.h.

{
return gmp_complex( a.r / b_d, a.i / b_d );
}

## operator<

bool operator< | ( | const gmp_complex & | a,
|  | const gmp_complex & | b )

friend

Definition at line 275 of file mpr_complex.h.

{
return ( a.real() < b.real() );
}

## operator<=

bool operator<= | ( | const gmp_complex & | a,
|  | const gmp_complex & | b )

friend

Definition at line 283 of file mpr_complex.h.

{
return ( a.real() <= b.real() );
}

## operator==

bool operator== | ( | const gmp_complex & | a,
|  | const gmp_complex & | b )

friend

Definition at line 267 of file mpr_complex.h.

{
return ( b.real() == a.real() ) && ( b.imag() == a.imag() );
}

## operator>

bool operator> | ( | const gmp_complex & | a,
|  | const gmp_complex & | b )

friend

Definition at line 271 of file mpr_complex.h.

{
return ( a.real() > b.real() );
}

## operator>=

bool operator>= | ( | const gmp_complex & | a,
|  | const gmp_complex & | b )

friend

Definition at line 279 of file mpr_complex.h.

{
return ( a.real() >= b.real() );
}

## Field Documentation

## i

gmp_float gmp_complex::i

private

Definition at line 183 of file mpr_complex.h.

## r

gmp_float gmp_complex::r

private

Definition at line 183 of file mpr_complex.h.

The documentation for this class was generated from the following files:

- libpolys/coeffs/mpr_complex.h
- libpolys/coeffs/mpr_complex.cc