21 #ifndef _tinyfadbin_h_ 22 #define _tinyfadbin_h_ 25 template <
int Num,
class L,
class R>
inline 34 for (
int i=0; i<Num; ++i)
35 tmp.
dx(i) = un.
dx(i) + deux.
dx(i);
42 template <
int Num,
class L,
class R>
inline 51 for (
int i=0; i<Num; ++i)
54 tmp.
val() = un.
val() + deux;
59 template <
int Num,
class L,
class R>
inline 65 template <
int Num,
class L,
class R>
inline 74 for (
int i=0; i<Num; ++i)
82 template <
int Num,
class L,
class R>
inline 91 for (
int i=0; i<Num; ++i)
92 tmp.
dx(i) = un.
dx(i)*deux;
94 tmp.
val() = un.
val() * deux;
100 template <
int Num,
class L,
class R>
inline 108 template <
int Num,
class L,
class R>
inline 117 for (
int i=0; i<Num; ++i)
118 tmp.
dx(i) = un.
dx(i) - deux.
dx(i);
125 template <
int Num,
class L,
class R>
inline 134 for (
int i=0; i<Num; ++i)
135 tmp.
dx(i) -= deux.
dx(i);
137 tmp.
val() = un - deux.
val();
142 template <
int Num,
class L,
class R>
inline 151 for (
int i=0; i<Num; ++i)
152 tmp.
dx(i) = un.
dx(i);
154 tmp.
val() = un.
val() - deux;
159 template <
int Num,
class L,
class R>
inline 165 if (deux.
val() == 0.)
error(
"TinyFad & TinyFad::operator /(const TinyFad<Num,L> & un, const TinyFad<Num,R> & deux), dividing by 0");
169 value_type dval = deux.
val();
171 for (
int i=0; i<Num; ++i)
172 tmp.
dx(i) = ( un.
dx(i)* deux.
val() - un.
val() * deux.
dx(i) ) / dval / dval ;
174 tmp.
val() = un.
val() / dval;
179 template <
int Num,
class L,
class R>
inline 185 if (deux.
val() == 0.)
error(
"TinyFad & TinyFad::operator /(const L & un, const TinyFad<Num,R> & deux), dividing by 0");
189 value_type dval = deux.
val();
191 for (
int i=0; i<Num; ++i)
192 tmp.
dx(i) = - un * deux.
dx(i) / dval / dval ;
194 tmp.
val() = un / dval;
199 template <
int Num,
class L,
class R>
inline 205 if (deux == 0.)
error(
"TinyFad & TinyFad::operator /(const TinyFad<Num,L> & un, const R & deux), dividing by 0");
210 for (
int i=0; i<Num; ++i)
211 tmp.
dx(i) = un.
dx(i) / deux;
213 tmp.
val() = un.
val() / deux;
TinyFad< Num, typename NumericalTraits< L, R >::promote > operator+(const TinyFad< Num, L > &un, const TinyFad< Num, R > &deux)
TinyFad< Num, typename NumericalTraits< L, R >::promote > operator*(const TinyFad< Num, L > &un, const TinyFad< Num, R > &deux)
AutoPointerMutexArrayInit tmp
const T & dx(int i) const
TinyFad< Num, typename NumericalTraits< L, R >::promote > operator-(const TinyFad< Num, L > &un, const TinyFad< Num, R > &deux)
TinyFad< Num, typename NumericalTraits< L, R >::promote > operator/(const TinyFad< Num, L > &un, const TinyFad< Num, R > &deux)