42 TFadBinaryAdd(
const L& left,
const R& rigth) : left_(left), right_(rigth) {;}
46 const value_type
val()
const {
return left_.val() + right_.val();}
47 const value_type
dx(
int i)
const {
return left_.dx(i) + right_.dx(i);}
49 int lsz = left_.size(), rsz = right_.size();
53 bool hasFastAccess()
const {
return left_.hasFastAccess() && right_.hasFastAccess();}
54 value_type
fastAccessDx(
int i)
const {
return left_.fastAccessDx(i)+right_.fastAccessDx(i);}
69 TFadBinaryAdd(
const L& left,
const R& rigth) : left_(left), right_(rigth) {;}
73 const value_type
val()
const {
return left_.val() + right_.
val();}
74 const value_type
dx(
int i)
const {
return left_.dx(i);}
75 int size()
const {
return left_.size();}
78 value_type
fastAccessDx(
int i)
const {
return left_.fastAccessDx(i);}
93 TFadBinaryAdd(
const L& left,
const R& rigth) : left_(left), right_(rigth) {;}
97 const value_type
val()
const {
return left_.
val() + right_.val();}
98 value_type
dx(
int i)
const {
return right_.dx(i);}
99 int size()
const {
return right_.size();}
127 const value_type
val()
const {
return left_.val() - right_.val();}
128 const value_type
dx(
int i)
const {
return left_.dx(i) - right_.dx(i);}
130 int lsz = left_.size(), rsz = right_.size();
131 return max(lsz, rsz);
134 bool hasFastAccess()
const {
return left_.hasFastAccess() && right_.hasFastAccess();}
135 value_type
fastAccessDx(
int i)
const {
return left_.fastAccessDx(i) - right_.fastAccessDx(i);}
154 const value_type
val()
const {
return left_.val() - right_.
val();}
155 const value_type
dx(
int i)
const {
return left_.dx(i);}
156 int size()
const {
return left_.size();}
178 const value_type
val()
const {
return left_.
val() - right_.val();}
179 const value_type
dx(
int i)
const {
return - right_.dx(i);}
180 int size()
const {
return right_.size(); }
183 value_type
fastAccessDx(
int i)
const {
return - right_.fastAccessDx(i);}
200 TFadBinaryMul(
const L& left,
const R& rigth) : left_(left), right_(rigth) {;}
203 const value_type
val()
const {
return left_.val() * right_.val() ;}
204 const value_type
dx(
int i)
const {
return left_.dx(i) * right_.val() + right_.dx(i) * left_.val();}
206 int lsz = left_.size(), rsz = right_.size();
207 return max(lsz, rsz);
210 bool hasFastAccess()
const {
return left_.hasFastAccess() && right_.hasFastAccess();}
211 value_type
fastAccessDx(
int i)
const {
return left_.fastAccessDx(i) * right_.val() + right_.fastAccessDx(i) * left_.val();}
226 TFadBinaryMul(
const L& left,
const R& rigth) : left_(left), right_(rigth) {;}
229 const value_type
val()
const {
return left_.val() * right_.
val() ;}
230 const value_type
dx(
int i)
const {
return left_.dx(i) * right_.
val();}
231 int size()
const {
return left_.size();}
248 TFadBinaryMul(
const L& left,
const R& rigth) : left_(left), right_(rigth) {;}
251 const value_type
val()
const {
return left_.
val() * right_.val() ;}
252 const value_type
dx(
int i)
const {
return right_.dx(i) * left_.
val();}
253 int size()
const {
return right_.size();}
273 TFadBinaryDiv(
const L& left,
const R& rigth) : left_(left), right_(rigth) {;}
277 const value_type
val()
const {
return left_.val() / right_.val();}
278 const value_type
dx(
int i)
const {
return (left_.dx(i) * right_.val() - right_.dx(i) * left_.val() ) / (right_.val() * right_.val()) ;}
280 int lsz = left_.size(), rsz = right_.size();
281 return max(lsz, rsz);
284 bool hasFastAccess()
const {
return left_.hasFastAccess() && right_.hasFastAccess();}
285 value_type
fastAccessDx(
int i)
const {
return (left_.fastAccessDx(i) * right_.val() - right_.fastAccessDx(i) * left_.val() )
286 / (right_.val() * right_.val()) ;}
301 TFadBinaryDiv(
const L& left,
const R& rigth) : left_(left), right_(rigth) {;}
305 const value_type
val()
const {
return left_.val() / right_.
val();}
306 const value_type
dx(
int i)
const {
return left_.dx(i) / right_.
val();}
307 int size()
const {
return left_.size();}
325 TFadBinaryDiv(
const L& left,
const R& rigth) : left_(left), right_(rigth) {;}
328 const value_type
val()
const {
return left_.
val() / right_.val();}
329 const value_type
dx(
int i)
const {
return (- right_.dx(i) * left_.
val() ) / (right_.val() * right_.val()) ;}
330 int size()
const {
return right_.size();}
333 value_type
fastAccessDx(
int i)
const {
return (- right_.fastAccessDx(i) * left_.
val() )
334 / (right_.val() * right_.val()) ;}
352 TFadBinaryPow(
const L& left,
const R& rigth) : left_(left), right_(rigth) {;}
356 const value_type
val()
const {
return std::pow( left_.val(), right_.val() );}
357 const value_type
dx(
int i)
const 359 return (right_.dx(i)*
std::log(left_.val())+right_.val()*left_.dx(i)/left_.val())
360 *
std::pow( left_.val(), right_.val() );
363 int lsz = left_.size(), rsz = right_.size();
364 return max(lsz, rsz);
367 bool hasFastAccess()
const {
return left_.hasFastAccess() && right_.hasFastAccess();}
370 return (right_.fastAccessDx(i)*
std::log(left_.val())+right_.val()*left_.fastAccessDx(i)/left_.val())
371 *
std::pow( left_.val(), right_.val() );
387 TFadBinaryPow(
const L& left,
const R& rigth) : left_(left), right_(rigth) {;}
392 const value_type
dx(
int i)
const 394 return (right_.
val()*left_.dx(i)/left_.val())*
std::pow( left_.val(), right_.
val() );
396 int size()
const {
return left_.size();}
401 return (right_.
val()*left_.fastAccessDx(i)/left_.val())
418 TFadBinaryPow(
const L& left,
const R& rigth) : left_(left), right_(rigth) {;}
422 value_type
dx(
int i)
const 426 int size()
const {
return right_.size();}
431 return (right_.fastAccessDx(i)*
std::log(left_.
val()))
447 TFadBinaryPow(
const L& left,
const R& rigth) : left_(left), right_(rigth) {;}
452 value_type
dx(
int i)
const 467 #define FAD_BIN_MACRO(OP,TYPE) \ 468 template<class E1, class E2> \ 469 inline TFadExpr< TYPE< TFadExpr<E1>, TFadExpr<E2> > > \ 470 OP (const TFadExpr<E1> &v, const TFadExpr<E2> &w){ \ 471 typedef TYPE<TFadExpr<E1>, TFadExpr<E2> > expr_t; \ 472 return TFadExpr<expr_t> (expr_t (v , w )); \ 476 inline TFadExpr<TYPE<TFadExpr<E>,TFadCst<typename E::value_type> > > \ 477 OP (const TFadExpr<E> &e, const typename E::value_type &t){ \ 478 typedef typename E::value_type A; \ 479 typedef TYPE<TFadExpr<E>,TFadCst<A> > expr_t; \ 480 return TFadExpr<expr_t>(expr_t (e, TFadCst<A> (t))); \ 483 template<typename A,int Num> \ 484 inline TFadExpr<TYPE<TFadCst<A>,TFad<Num,A> > > \ 485 OP (const A& a, const TFad<Num,A> &e){ \ 486 typedef TYPE<TFadCst<A>,TFad<Num,A> > expr_t; \ 487 return TFadExpr<expr_t> (expr_t (TFadCst<A>(a), e )); \ 490 template<typename A,int Num> \ 491 inline TFadExpr<TYPE<TFad<Num,A>,TFadCst<A> > > \ 492 OP (const TFad<Num,A> &e, const A& a){ \ 493 typedef TYPE<TFad<Num,A>,TFadCst<A> > expr_t; \ 494 return TFadExpr<expr_t>(expr_t (e ,TFadCst<A>(a))); \ 498 inline TFadExpr<TYPE<TFadCst<typename E::value_type>,TFadExpr<E> > > \ 499 OP (const typename E::value_type &t, const TFadExpr<E> &e){ \ 500 typedef typename E::value_type A; \ 501 typedef TYPE<TFadCst<A>,TFadExpr<E> > expr_t; \ 502 return TFadExpr<expr_t> (expr_t (TFadCst<A> (t),e )); \ 505 template<class E,int Num> \ 506 inline TFadExpr<TYPE<TFadExpr<E>,TFad<Num,typename E::value_type> > > \ 507 OP (const TFadExpr<E> &e,const TFad<Num,typename E::value_type>& v){ \ 509 typedef TYPE<TFadExpr<E>,TFad<Num,typename E::value_type> > expr_t; \ 510 return TFadExpr<expr_t>(expr_t (e, v )); \ 513 template<typename A,int Num> \ 514 inline TFadExpr<TYPE<TFad<Num,A>,TFad<Num,A> > > \ 515 OP (const TFad<Num,A> &e1,const TFad<Num,A>& e2){ \ 516 typedef TYPE<TFad<Num,A>,TFad<Num,A> > expr_t; \ 517 return TFadExpr<expr_t>(expr_t (e1 , e2 )); \ 520 template<class E, int Num> \ 521 inline TFadExpr<TYPE<TFad<Num,typename E::value_type>,TFadExpr<E> > > \ 522 OP (const TFad<Num,typename E::value_type> &v, const TFadExpr<E> &e){ \ 524 typedef TYPE<TFad<Num,typename E::value_type>,TFadExpr<E> > expr_t; \ 525 return TFadExpr<expr_t> (expr_t (v , e )); \ value_type fastAccessDx(int i) const
TFadBinaryAdd(const L &left, const R &rigth)
const value_type val() const
TFadBinaryPow(const L &left, const R &rigth)
bool hasFastAccess() const
bool hasFastAccess() const
const value_type val() const
R::value_type value_type_R
bool hasFastAccess() const
value_type fastAccessDx(int i) const
bool hasFastAccess() const
TFadBinaryMul(const L &left, const R &rigth)
const value_type dx(int i) const
value_type fastAccessDx(int i) const
bool hasFastAccess() const
value_type dx(int i) const
TFadBinaryPow(const L &left, const R &rigth)
value_type fastAccessDx(int i) const
const value_type val() const
const value_type val() const
value_type fastAccessDx(int i) const
L::value_type value_type_L
value_type fastAccessDx(int i) const
const value_type dx(int i) const
TFadBinaryMinus(const L &left, const R &rigth)
const value_type val() const
value_type dx(int i) const
TFadBinaryDiv(const L &left, const R &rigth)
L::value_type value_type_L
const value_type dx(int i) const
const value_type dx(int i) const
TFadBinaryMinus(const L &left, const R &rigth)
value_type fastAccessDx(int i) const
TFadBinaryPow(const L &left, const R &rigth)
TFadBinaryMinus(const L &left, const R &rigth)
value_type fastAccessDx(int i) const
value_type fastAccessDx(int i) const
const value_type val() const
const value_type dx(int i) const
bool hasFastAccess() const
NumericalTraits< value_type_L, value_type_R >::promote value_type
const value_type dx(int i) const
NumericalTraits< value_type_L, value_type_R >::promote value_type
const value_type val() const
R::value_type value_type_R
L::value_type value_type_L
NumericalTraits< value_type_L, value_type_R >::promote value_type
value_type dx(int i) const
const value_type val() const
const value_type dx(int i) const
const value_type & val() const
TFadBinaryPow(const L &left, const R &rigth)
R::value_type value_type_R
const value_type val() const
const value_type val() const
TFadBinaryMul(const L &left, const R &rigth)
bool hasFastAccess() const
const value_type dx(int i) const
bool hasFastAccess() const
NumericalTraits< value_type_L, value_type_R >::promote value_type
const value_type dx(int i) const
bool hasFastAccess() const
R::value_type value_type_R
const value_type val() const
TFadBinaryDiv(const L &left, const R &rigth)
TFadBinaryMul(const L &left, const R &rigth)
bool hasFastAccess() const
const value_type val() const
value_type fastAccessDx(int i) const
const value_type dx(int i) const
TFadBinaryDiv(const L &left, const R &rigth)
L::value_type value_type_L
TPZFlopCounter pow(const TPZFlopCounter &orig, const TPZFlopCounter &xp)
Returns the power and increments the counter of the power.
bool hasFastAccess() const
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ log
L::value_type value_type_L
const value_type dx(int i) const
const value_type dx(int i) const
#define FAD_BIN_MACRO(OP, TYPE)
value_type fastAccessDx(int i) const
TFadBinaryAdd(const L &left, const R &rigth)
const value_type val() const
R::value_type value_type_R
const value_type dx(int i) const
bool hasFastAccess() const
bool hasFastAccess() const
bool hasFastAccess() const
value_type fastAccessDx(int i) const
const value_type val() const
value_type fastAccessDx(int i) const
bool hasFastAccess() const
value_type fastAccessDx(int i) const
const value_type val() const
const value_type val() const
NumericalTraits< value_type_L, value_type_R >::promote value_type
value_type fastAccessDx(int i) const
bool hasFastAccess() const
TFadBinaryAdd(const L &left, const R &rigth)
value_type fastAccessDx(int i) const
bool hasFastAccess() const