realroot_doc 0.1.1
|
Namespace for explicit type conversion. More...
Namespace for explicit type conversion.
This namespace provides convertion and assign functions for various types. It allows to control type transformations. The function (A& a, const B& b)@ set the variable @ to the value @. The function convert(const A& a, astype<B>())@ returns an object of type @, let by @.
void assign | ( | A & | a, |
const B & | b | ||
) | [inline] |
Generic definition of the assignement function.
Definition at line 52 of file assign.hpp.
Referenced by solver_cffirst< Real, POL >::all_roots(), mmx::as(), assign(), mmx::array::assign_i(), binary_sleeve_subdivision< K >::init_pol(), Interval< T, r >::Interval(), monom< C, E >::monom(), solver< C, Sleeve< V > >::solve(), mmx::solve(), solver< C, ProjRd< MTH > >::solve_monomial(), and mmx::to_FT().
{ a=as<A>(b); }
void mmx::let::assign | ( | tensor::bernstein< C > & | b, |
const sparse::monomial_seq< D, O > & | m, | ||
const DOM & | dom | ||
) | [inline] |
Definition at line 404 of file tensor_bernstein_fcts.hpp.
{ b = tensor::bernstein<C>(m,dom); }
void mmx::let::assign | ( | tensor::bernstein< C > & | b, |
const sparse::monomial_seq< D, O > & | m | ||
) | [inline] |
Definition at line 399 of file tensor_bernstein_fcts.hpp.
{ b = tensor::bernstein<C>(m); }
void mmx::let::assign | ( | tensor::bernstein< C > & | b, |
const tensor::monomials< D > & | m | ||
) | [inline] |
Definition at line 391 of file tensor_bernstein_fcts.hpp.
References mmx::tensor::convertm2b(), monomials< C >::env, and monomials< C >::size().
{ b = tensor::bernstein<C>(m.env); for(int i=0;i<m.size();i++) b[i] =as<C>(m[i]); tensor::convertm2b(b); }
void mmx::let::assign | ( | tensor::bernstein< C > & | p, |
const tensor::bernstein< U > & | q | ||
) |
Definition at line 383 of file tensor_bernstein_fcts.hpp.
References assign(), monomials< C >::data, and monomials< C >::env.
{ p.env=q.env; p.data = typename tensor::bernstein<C>::vector_type(q.data.size()); for(unsigned i=0;i<q.data.size();i++) assign(p.data[i],q.data[i]); }
void mmx::let::assign | ( | C & | p, |
const U & | q | ||
) |
void mmx::let::assign | ( | sparse::monomial_seq< U, O, UMONOM, UREP > & | p, |
const sparse::monomial_seq< V, O, VMONOM, VREP > & | q | ||
) |
Definition at line 1020 of file sparse_monomials.hpp.
References assign().
{ typedef typename sparse::monomial_seq<U,O,UMONOM,UREP>::Monomial MonomialU; typedef typename sparse::monomial_seq<V,O,VMONOM,VREP>::Monomial MonomialV; for ( typename sparse::monomial_seq<V,O,VMONOM,VREP>::const_iterator it = q.begin(); it != q.end(); ++it ) { U c; assign(c,it->coeff()); MonomialU m(c,it->rep()); p.push_back(m); } }
void mmx::let::assign | ( | sparse::monomial_seq< C, O, MONOM, REP > & | p, |
const C & | c | ||
) |
Definition at line 1015 of file sparse_monomials.hpp.
{ p = sparse::monomial_seq<C,O,MONOM,REP>(); p.push_back(c); }
void mmx::let::assign | ( | sleeve_rep< C > & | f, |
const polynomial< D, with< MonomialTensor > > & | p | ||
) |
Definition at line 103 of file solver_uv_sleeve.hpp.
References assert, mmx::degree(), sleeve_rep< C >::dw, mmx::in(), mmx::numerics::rnd_dw(), mmx::numerics::rnd_up(), sleeve_rep< C >::size(), and sleeve_rep< C >::up.
{ assert(f.size()==(unsigned)(degree(p)+1)); typedef typename kernelof<D>::T::integer integer; typedef typename kernelof<D>::T::rational rational; binomials<integer> bn; unsigned ip=0, in=0; int d=degree(p); for(unsigned i=0;i< p.size();i++) { if(p[i]>p[ip]) { ip = i; } if(p[i]<p[in]) in=i; } rational mx = (p[ip]>-p[in]?as<rational>(p[ip]):as<rational>(-p[in])); rational c; { numerics::rounding<C> rnd( numerics::rnd_up() ); for ( int i = 0; i <= d; i ++ ) { c = as<rational>(p[i])/(mx*bn(d,i)); f.up[i]=as<C>(c); } } { numerics::rounding<C> rnd( numerics::rnd_dw() ); for ( int i = 0; i <= d; i ++ ) { c = as<rational>(p[i])/(mx*bn(d,i)); f.dw[i]=as<C>(c); } } // polynom< ring<rational,Bernstein> > q; // let::assign(q,p); // assign(f,q); }
void mmx::let::assign | ( | int & | a, |
double | d | ||
) | [inline] |
Definition at line 55 of file assign.hpp.
{ a = (int)rint(d); };
void assign | ( | Seq< C, R > & | r, |
const Seq< C, S > & | x | ||
) |
Definition at line 325 of file Seq.hpp.
References Seq< C, R >::begin(), Seq< C, R >::end(), and Seq< C, R >::push_back().
{ r = Seq<C,R>(); for(typename Seq<C,S>::const_iterator it=x.begin();it!= x.end();++it) r.push_back(*it); }
void assign | ( | Seq< C, R > & | r, |
const Seq< X, S > & | x | ||
) |
Definition at line 333 of file Seq.hpp.
References mmx::assign(), Seq< C, R >::begin(), Seq< C, R >::end(), and Seq< C, R >::push_back().
{ r = Seq<C,R>(); for(typename Seq<X,S>::const_iterator it=x.begin();it!= x.end();++it) { C tmp; assign(tmp,*it); r.push_back(tmp); }; }
void mmx::let::assign | ( | double & | d, |
const scalar< MPQ > & | x | ||
) | [inline] |
Definition at line 551 of file scalar_rational.hpp.
References scalar< T >::rep().
{ d = mpq_get_d(&x.rep()); }
void mmx::let::assign | ( | scalar< MPQ > & | q, |
double | d | ||
) | [inline] |
Definition at line 550 of file scalar_rational.hpp.
References scalar< T >::rep().
{ mpq_set_d(&q.rep(),d); }
void mmx::let::assign | ( | scalar< MPQ > & | x, |
char * | s | ||
) | [inline] |
Definition at line 549 of file scalar_rational.hpp.
References scalar< T >::rep().
{ mpq_set_str(&x.rep(), s, 10);}
void mmx::let::assign | ( | double & | r, |
const scalar< MPZ > & | z | ||
) | [inline] |
Definition at line 725 of file scalar_integer.hpp.
References scalar< T >::rep().
{ r = mpz_get_d(&z.rep()); }
void mmx::let::assign | ( | long int & | x, |
const scalar< MPZ > & | r | ||
) | [inline] |
Definition at line 724 of file scalar_integer.hpp.
References scalar< T >::rep().
{ x = mpz_get_si(&r.rep()); }
void mmx::let::assign | ( | int & | x, |
const scalar< MPZ > & | r | ||
) | [inline] |
Definition at line 723 of file scalar_integer.hpp.
References scalar< T >::rep().
{ x = mpz_get_si(&r.rep()); }
void mmx::let::assign | ( | scalar< MPZ > & | x, |
const scalar< MPZ > & | r | ||
) | [inline] |
Definition at line 722 of file scalar_integer.hpp.
References scalar< T >::rep().
{ mpz_set(&x.rep(),&r.rep()); }
void mmx::let::assign | ( | scalar< MPZ > & | z, |
double | d | ||
) | [inline] |
Definition at line 721 of file scalar_integer.hpp.
{ z = (int)d; };
void mmx::let::assign | ( | scalar< MPZ > & | z, |
int | n | ||
) | [inline] |
Definition at line 720 of file scalar_integer.hpp.
References scalar< T >::rep().
{ mpz_set_si(&z.rep(),n); }
void mmx::let::assign | ( | scalar< MPZ > & | z, |
char * | s | ||
) | [inline] |
Definition at line 719 of file scalar_integer.hpp.
References scalar< T >::rep().
{ mpz_set_str(&z.rep(), s, 10); }
void mmx::let::assign | ( | polynomial< D, with< Univariate > > & | p, |
const polynomial< C, with< Univariate > > & | q | ||
) | [inline] |
Definition at line 88 of file polynomial_univariate.hpp.
References mmx::degree().
{ int d = degree(q); p = polynomial< D, with<Univariate> >(D(1),d); for(int i=0;i<=d;i++) p[i]= D(q[i]); }
void mmx::let::assign | ( | polynomial< D, with< MonomialTensor > > & | p, |
const polynomial< C, with< MonomialTensor > > & | q | ||
) | [inline] |
Definition at line 99 of file polynomial_tensor.hpp.
{ //int d = q.size(); p = polynomial< D, with<MonomialTensor> >(0); const int * vr=q.rep().vrs(); const int * sz=q.rep().szs(); for (int i=0; i< q.nbvar();i++) p += polynomial< D, with<MonomialTensor> >(D(1),sz[i]-1,vr[i]); for(unsigned i=0;i<q.size();i++) p[i]= as<D>(q[i]); }
void mmx::let::assign | ( | polynomial< C1, R1 > & | p, |
const polynomial< C2, R2 > & | q, | ||
const DOM & | dmn | ||
) | [inline] |
Definition at line 166 of file polynomial_fcts.hpp.
References assign().
{ assign(p.rep(),q.rep(), dmn); }
void mmx::let::assign | ( | double & | d, |
unsigned | i | ||
) | [inline] |
Definition at line 58 of file assign.hpp.
{d = double(i);}
void mmx::let::assign | ( | C & | r, |
const monom< C, E > & | m | ||
) | [inline] |
Definition at line 187 of file monomial.hpp.
{ r = m.coeff(); };
void assign | ( | Interval< T, r > & | i, |
const char * | s | ||
) |
Definition at line 605 of file Interval_fcts.hpp.
References assign(), mmx::sparse::copy(), Interval< T, r >::M, and Interval< T, r >::m.
{ int n = strlen(s)+1; if ( *s == '[' ) { char _s[ n ]; std::copy(s,s+n,_s); char * sm = _s+1; char * sM = _s+1; while ( *sM != ',' ) sM++; *sM = 0; sM++; char * e = sM; while ( *e && *e != ']' ) e++; *e = 0; let::assign(i.m,(char*)sm); let::assign(i.M,(char*)sM); } else { T tmp; let::assign(tmp,(char*)s); i.m = i.M = tmp; }; };
void mmx::let::assign | ( | Interval< C > & | a, |
const T & | b | ||
) | [inline] |
Definition at line 194 of file Interval.hpp.
References mmx::assign(), and mmx::sparse::swap().
{ C mn,mx; { numerics::rounding<C> rnd( numerics::rounding<C>::rnd_up() ); assign(mx,b); } { numerics::rounding<C> rhd( numerics::rounding<C>::rnd_dw() ); assign(mn,b); } if( mx < mn ) std::swap(mn,mx); new (&a) Interval<C>(mn,mx); };
void mmx::let::assign | ( | Interval< X, r0 > & | a, |
const Interval< Y, r1 > & | b | ||
) | [inline] |
Definition at line 159 of file Interval.hpp.
References mmx::assign(), Interval< T, r >::M, and Interval< T, r >::m.
void mmx::let::assign | ( | Interval< QQ > & | a, |
const QQ & | u, | ||
const QQ & | v | ||
) | [inline] |
Definition at line 214 of file GMPXX.hpp.
References Interval< T, r >::lower(), and Interval< T, r >::upper().
{ a.lower()=u; a.upper()=v; }
void mmx::let::assign | ( | Interval< double > & | a, |
const QQ & | u, | ||
const QQ & | v | ||
) | [inline] |
Definition at line 197 of file GMPXX.hpp.
References assign(), mmx::numerics::rnd_dw(), and mmx::numerics::rnd_up().
{ double mn,mx; { numerics::rounding<double> rnd( numerics::rnd_up() ); assign(mx,v); } { numerics::rounding<double> rnd( numerics::rnd_dw() ); assign(mn,u); } new (&a) Interval<double>(mn,mx); };
void mmx::let::assign | ( | Interval< double > & | a, |
const QQ & | b | ||
) | [inline] |
Definition at line 179 of file GMPXX.hpp.
References assign(), mmx::numerics::rnd_dw(), mmx::numerics::rnd_up(), and mmx::sparse::swap().
{ double mn,mx; { numerics::rounding<double> rnd( numerics::rnd_up() ); assign(mx,b); } { numerics::rounding<double> rnd( numerics::rnd_dw() ); assign(mn,b); } if( mx < mn ) std::swap(mn,mx); QQ MN(mn); QQ MX(mx); new (&a) Interval<double>(mn,mx); };
void mmx::let::assign | ( | sleeve_rep< C > & | f, |
const polynomial< D, with< Bernstein > > & | p | ||
) |
Definition at line 91 of file solver_uv_sleeve.hpp.
References assert, mmx::degree(), sleeve_rep< C >::dw, mmx::numerics::rnd_dw(), mmx::numerics::rnd_up(), sleeve_rep< C >::size(), and sleeve_rep< C >::up.
{ assert(f.size()==(unsigned)(degree(p)+1)); { numerics::rounding<C> rnd(numerics::rnd_up()); for(unsigned i=0;i<f.size();i++) f.up[i]=as<C>(p[i]); } { numerics::rounding<C> rnd(numerics::rnd_dw()); for(unsigned i=0;i<f.size();i++) f.dw[i]=as<C>(p[i]); } }
void assign | ( | double & | r, |
const ZZ & | z | ||
) | [inline] |
void mmx::let::assign | ( | long int & | x, |
const ZZ & | r | ||
) | [inline] |
void mmx::let::assign | ( | int & | x, |
const ZZ & | r | ||
) | [inline] |
void assign | ( | ZZ & | z, |
double | d | ||
) | [inline] |
void mmx::let::assign | ( | ZZ & | z, |
int | n | ||
) | [inline] |
void assign | ( | QQ & | x, |
char * | s | ||
) | [inline] |
void assign | ( | mpf_t | r, |
const ZZ & | x | ||
) | [inline] |
void mmx::let::assign | ( | int & | i, |
const char * | s | ||
) | [inline] |
Definition at line 66 of file assign.hpp.
{i = atoi(s);}
void assign | ( | ZZ & | x, |
const QQ & | r | ||
) | [inline] |
Definition at line 81 of file GMP.hpp.
References mmx::denominator(), and mmx::numerator().
{ x= numerator(r)/denominator(r);}
void mmx::let::assign | ( | std::complex< double > & | z, |
const char * | s | ||
) | [inline] |
Definition at line 81 of file assign.hpp.
{ z = std::complex<double>(atof(s),0); }
void mmx::let::assign | ( | long double & | d, |
char * | s | ||
) | [inline] |
Definition at line 78 of file assign.hpp.
{d = atof(s);}
void mmx::let::assign | ( | double & | d, |
char * | s | ||
) | [inline] |
Definition at line 76 of file assign.hpp.
{d = atof(s);}
void mmx::let::assign | ( | float & | d, |
char * | s | ||
) | [inline] |
Definition at line 74 of file assign.hpp.
{d = atof(s);}
void mmx::let::assign | ( | long long int & | i, |
const char * | s | ||
) | [inline] |
Definition at line 70 of file assign.hpp.
{i = atoll(s);}
void mmx::let::assign | ( | long int & | i, |
const char * | s | ||
) | [inline] |
Definition at line 67 of file assign.hpp.
{i = atol(s);}
void mmx::let::assign | ( | mpz_t | r, |
const ZZ & | x | ||
) | [inline] |
void mmx::let::assign | ( | X & | a, |
const char * | s | ||
) | [inline] |
Definition at line 64 of file assign.hpp.
{ a = X(s); }
void mmx::let::assign | ( | std::complex< C > & | z, |
const C & | x | ||
) | [inline] |
Definition at line 62 of file assign.hpp.
{ z= std::complex<C>(x);}
void mmx::let::assign | ( | double & | d, |
double | z | ||
) | [inline] |
Definition at line 59 of file assign.hpp.
{d = z;}
void mmx::let::assign | ( | polynomial< C1, R1 > & | p, |
const polynomial< C2, R2 > & | q | ||
) | [inline] |
Definition at line 161 of file polynomial_fcts.hpp.
References assign().
{ assign(p.rep(),q.rep()); }
void mmx::let::assign | ( | double & | d, |
int | i | ||
) | [inline] |
Definition at line 57 of file assign.hpp.
{d = double(i);}