mirror of https://github.com/CGAL/cgal
removed useless pointers from algebraic numbers
This commit is contained in:
parent
fb78628096
commit
98ea5fbe8f
|
|
@ -40,12 +40,9 @@ public:
|
|||
RS_polynomial_1 *_poly;
|
||||
int _nr;
|
||||
int _mult;
|
||||
mpfi_ptr _prev,_next;
|
||||
mutable Sign _lefteval;
|
||||
|
||||
Algebraic_1_rep():
|
||||
_poly(NULL),_nr(-1),_mult(-1),
|
||||
_prev(NULL),_next(NULL),_lefteval(ZERO){}
|
||||
Algebraic_1_rep():_poly(NULL),_nr(-1),_mult(-1),_lefteval(ZERO){}
|
||||
~Algebraic_1_rep(){}
|
||||
|
||||
private:
|
||||
|
|
@ -80,17 +77,16 @@ public:
|
|||
Algebraic_1(mpfi_srcptr,
|
||||
const RS_polynomial_1&,
|
||||
int,
|
||||
int,
|
||||
mpfi_ptr,
|
||||
mpfi_ptr);
|
||||
int
|
||||
//,mpfi_ptr,mpfi_ptr
|
||||
);
|
||||
|
||||
// the another interesting variant
|
||||
Algebraic_1(mpfi_srcptr,
|
||||
const RS_polynomial_1&,
|
||||
int,
|
||||
int,
|
||||
mpfi_ptr,
|
||||
mpfi_ptr,
|
||||
//mpfi_ptr,mpfi_ptr,
|
||||
CGAL::Sign);
|
||||
|
||||
// functions related to the member data
|
||||
|
|
@ -109,12 +105,8 @@ public:
|
|||
void set_nr(int);
|
||||
void set_mult(int);
|
||||
void set_prec(mp_prec_t);
|
||||
void set_prev(mpfi_ptr);
|
||||
void set_next(mpfi_ptr);
|
||||
void set_lefteval(Sign)const;
|
||||
mp_prec_t get_prec()const;
|
||||
mpfi_ptr prev()const;
|
||||
mpfi_ptr next()const;
|
||||
Sign lefteval()const;
|
||||
mpfr_srcptr left()const;
|
||||
mpfr_srcptr right()const;
|
||||
|
|
|
|||
|
|
@ -35,8 +35,6 @@ Algebraic_1::Algebraic_1(const Algebraic_1 &i,mpfr_prec_t pl,mpfr_prec_t pr){
|
|||
set_pol(i.pol());
|
||||
set_nr(i.nr());
|
||||
set_mult(i.mult());
|
||||
set_prev(i.prev());
|
||||
set_next(i.next());
|
||||
set_lefteval(i.lefteval());
|
||||
}
|
||||
|
||||
|
|
@ -200,16 +198,12 @@ Algebraic_1::Algebraic_1(
|
|||
mpfi_srcptr i,
|
||||
const RS_polynomial_1 &p,
|
||||
int n,
|
||||
int m,
|
||||
mpfi_ptr prevroot,
|
||||
mpfi_ptr nextroot){
|
||||
int m){
|
||||
mpfi_init(mpfi());
|
||||
set_mpfi_ptr(i);
|
||||
set_pol(p);
|
||||
set_nr(n);
|
||||
set_mult(m);
|
||||
set_prev(prevroot);
|
||||
set_next(nextroot);
|
||||
// we don't evaluate in the sf part of p, since p is sf
|
||||
// TODO: add assertion
|
||||
set_lefteval(RSSign::signat(p,&i->left));
|
||||
|
|
@ -219,14 +213,12 @@ Algebraic_1::Algebraic_1(
|
|||
// left evaluation
|
||||
inline
|
||||
Algebraic_1::Algebraic_1(mpfi_srcptr i,const RS_polynomial_1 &p,int n,int m,
|
||||
mpfi_ptr prevroot,mpfi_ptr nextroot,CGAL::Sign s){
|
||||
CGAL::Sign s){
|
||||
mpfi_init(mpfi());
|
||||
set_mpfi_ptr(i);
|
||||
set_pol(p);
|
||||
set_nr(n);
|
||||
set_mult(m);
|
||||
set_prev(prevroot);
|
||||
set_next(nextroot);
|
||||
set_lefteval(s);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -96,16 +96,6 @@ void Algebraic_1::set_prec(mp_prec_t p){
|
|||
mpfi_round_prec(mpfi(),p);
|
||||
}
|
||||
|
||||
inline
|
||||
void Algebraic_1::set_prev(mpfi_ptr p){
|
||||
ptr()->_prev=p;
|
||||
}
|
||||
|
||||
inline
|
||||
void Algebraic_1::set_next(mpfi_ptr n){
|
||||
ptr()->_next=n;
|
||||
}
|
||||
|
||||
inline
|
||||
void Algebraic_1::set_lefteval(Sign s)const{
|
||||
Ptr()->_lefteval=s;
|
||||
|
|
@ -126,16 +116,6 @@ mpfr_srcptr Algebraic_1::right()const{
|
|||
return &(mpfi()->right);
|
||||
}
|
||||
|
||||
inline
|
||||
mpfi_ptr Algebraic_1::prev()const{
|
||||
return ptr()->_prev;
|
||||
}
|
||||
|
||||
inline
|
||||
mpfi_ptr Algebraic_1::next()const{
|
||||
return ptr()->_next;
|
||||
}
|
||||
|
||||
inline
|
||||
Sign Algebraic_1::lefteval()const{
|
||||
return ptr()->_lefteval;
|
||||
|
|
|
|||
|
|
@ -35,8 +35,6 @@ Algebraic_1 Algebraic_1::operator-()const{
|
|||
pol().minusx(),
|
||||
nr(),
|
||||
mult(),
|
||||
NULL,
|
||||
NULL,
|
||||
-lefteval());
|
||||
return *inverse;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,8 +97,8 @@ std::istream& operator>>(std::istream &is,Algebraic_1 &a){
|
|||
*(new RS_polynomial_1(pol)), // polynomial
|
||||
nr, // number of root
|
||||
mult, // multiplicity
|
||||
(mpfi_ptr)NULL, // previous root
|
||||
(mpfi_ptr)NULL, // next root
|
||||
//(mpfi_ptr)NULL, // previous root
|
||||
//(mpfi_ptr)NULL, // next root
|
||||
(CGAL::Sign)eval);// evaluation on the left bound
|
||||
goto is_ret;
|
||||
is_fail_ret:
|
||||
|
|
|
|||
|
|
@ -162,9 +162,10 @@ struct Solve_RS_1{
|
|||
}
|
||||
}
|
||||
for(int i=0;i<nr;++i){
|
||||
*res++=std::make_pair(*new Algebraic(x[i],p,i,m[i],
|
||||
i?x[i-1]:NULL,
|
||||
i==nr-1?NULL:x[i+1]),
|
||||
*res++=std::make_pair(*new Algebraic(x[i],p,i,m[i]
|
||||
//,i?x[i-1]:NULL,
|
||||
//i==nr-1?NULL:x[i+1]
|
||||
),
|
||||
m[i]);
|
||||
}
|
||||
free(m);
|
||||
|
|
@ -191,9 +192,10 @@ struct Solve_RS_1{
|
|||
m=0; // we won't calculate multiplicities
|
||||
}
|
||||
for(int i=0;i<nr;++i)
|
||||
*res++=*new Algebraic(x[i],p,i,m,
|
||||
i?x[i-1]:NULL,
|
||||
i==nr-1?NULL:x[i+1]);
|
||||
*res++=*new Algebraic(x[i],p,i,m
|
||||
//,i?x[i-1]:NULL,
|
||||
//i==nr-1?NULL:x[i+1]
|
||||
);
|
||||
free(x);
|
||||
return res;
|
||||
}
|
||||
|
|
@ -283,7 +285,9 @@ struct Construct_alg_1{
|
|||
mpfi_init(i);
|
||||
mpfr_set(&i->left,l.fr(),GMP_RNDD);
|
||||
mpfr_set(&i->right,u.fr(),GMP_RNDU);
|
||||
return Algebraic(i,convert()(p),0,0,NULL,NULL);
|
||||
return Algebraic(i,convert()(p),0,0
|
||||
//,NULL,NULL
|
||||
);
|
||||
}
|
||||
}; // Construct_alg_1
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue