NeoPZ
tinyfadsix.h
Go to the documentation of this file.
1 #ifndef _tinyfadsix_h_
2 #define _tinyfadsix_h_
3 
4 //*********************************************************
5 // This file is generated by generate.cc.
6 // Use this file for any modification
7 //*********************************************************
8 
9 template <class T> class TinyFad<6,T> {
10 public:
11  typedef T value_type;
12  typedef T grad_type;
13 protected:
14 
15  int n;
16  T val_;
17 
18  T dx0_;
19  T dx1_;
20  T dx2_;
21  T dx3_;
22  T dx4_;
23  T dx5_;
24 
25 
26 public:
27  void diff(const size_t ith, const size_t sz){
28  n = ith+1;
29  dx0_ = T(0.);
30  dx1_ = T(0.);
31  dx2_ = T(0.);
32  dx3_ = T(0.);
33  dx4_ = T(0.);
34  dx5_ = T(0.);
35 
36  switch(ith){
37  case 0 : dx0_ = T(1.);break;
38  case 1 : dx1_ = T(1.);break;
39  case 2 : dx2_ = T(1.);break;
40  case 3 : dx3_ = T(1.);break;
41  case 4 : dx4_ = T(1.);break;
42  case 5 : dx5_ = T(1.);break;
43  default : cout << "ith = " << ith << " out of definition set" << endl;exit(1);
44  }
45  }
46 
47  TinyFad(const T& ind, const int ini) : n(ini+1), val_(ind) {
48  dx0_ = T(0.);
49  dx1_ = T(0.);
50  dx2_ = T(0.);
51  dx3_ = T(0.);
52  dx4_ = T(0.);
53  dx5_ = T(0.);
54 
55  switch(ini){
56  case 0 : dx0_ = T(1.);break;
57  case 1 : dx1_ = T(1.);break;
58  case 2 : dx2_ = T(1.);break;
59  case 3 : dx3_ = T(1.);break;
60  case 4 : dx4_ = T(1.);break;
61  case 5 : dx5_ = T(1.);break;
62  default : cout << "ini = " << ini << " out of definition set" << endl;exit(1);
63  }
64  }
65  TinyFad() : n(0), val_(0.) {
66  dx0_ = T(0.);
67  dx1_ = T(0.);
68  dx2_ = T(0.);
69  dx3_ = T(0.);
70  dx4_ = T(0.);
71  dx5_ = T(0.);
72  }
73  TinyFad(const No_Initialization &): n(0) {}
74  TinyFad(const T& in) : n(0), val_(in) {
75  dx0_ = T(0.);
76  dx1_ = T(0.);
77  dx2_ = T(0.);
78  dx3_ = T(0.);
79  dx4_ = T(0.);
80  dx5_ = T(0.);
81  }
82  TinyFad(const TinyFad<6,T> & in) : n(0), val_(in.val_) {
83  dx0_ = in.dx0_;
84  dx1_ = in.dx1_;
85  dx2_ = in.dx2_;
86  dx3_ = in.dx3_;
87  dx4_ = in.dx4_;
88  dx5_ = in.dx5_;
89  }
90 
91  ~TinyFad() {}
92 
93  int N() const {return n-1;}
94 
95  const T& val() const { return val_;}
96  T& val() { return val_;}
97 
98  const T& d0() const { return dx0_;}
99  T& d0() { return dx0_;}
100 
101  const T& d1() const { return dx1_;}
102  T& d1() { return dx1_;}
103 
104  const T& d2() const { return dx2_;}
105  T& d2() { return dx2_;}
106 
107  const T& d3() const { return dx3_;}
108  T& d3() { return dx3_;}
109 
110  const T& d4() const { return dx4_;}
111  T& d4() { return dx4_;}
112 
113  const T& d5() const { return dx5_;}
114  T& d5() { return dx5_;}
115 
116  T& dx(int i){
117  switch(i){
118  case 0 : return dx0_;
119  case 1 : return dx1_;
120  case 2 : return dx2_;
121  case 3 : return dx3_;
122  case 4 : return dx4_;
123  case 5 : return dx5_;
124  default : cout << "i out of bounds" << endl;exit(1);
125  }
126  }
127  const T& dx(int i) const {
128  switch(i){
129  case 0 : return dx0_;
130  case 1 : return dx1_;
131  case 2 : return dx2_;
132  case 3 : return dx3_;
133  case 4 : return dx4_;
134  case 5 : return dx5_;
135  default : cout << "i out of bounds" << endl;exit(1);
136  }
137  }
138  T& d(int i){
139  switch(i){
140  case 0 : return dx0_;
141  case 1 : return dx1_;
142  case 2 : return dx2_;
143  case 3 : return dx3_;
144  case 4 : return dx4_;
145  case 5 : return dx5_;
146  default : cout << "i out of bounds" << endl;exit(1);
147  }
148  }
149  const T& d(int i) const {
150  switch(i){
151  case 0 : return dx0_;
152  case 1 : return dx1_;
153  case 2 : return dx2_;
154  case 3 : return dx3_;
155  case 4 : return dx4_;
156  case 5 : return dx5_;
157  default : cout << "i out of bounds" << endl;exit(1);
158  }
159  }
160 
162  val_ = in.val_;
163 
164  dx0_ = in.dx0_;
165  dx1_ = in.dx1_;
166  dx2_ = in.dx2_;
167  dx3_ = in.dx3_;
168  dx4_ = in.dx4_;
169  dx5_ = in.dx5_;
170 
171  return *this;
172  }
173 
174  TinyFad<6,T> & operator = (const T & in){
175  val_ = in;
176 
177  dx0_ = T(0.);
178  dx1_ = T(0.);
179  dx2_ = T(0.);
180  dx3_ = T(0.);
181  dx4_ = T(0.);
182  dx5_ = T(0.);
183 
184  return *this;
185  }
186 
188  dx0_ += in.dx0_;
189  dx1_ += in.dx1_;
190  dx2_ += in.dx2_;
191  dx3_ += in.dx3_;
192  dx4_ += in.dx4_;
193  dx5_ += in.dx5_;
194  val_ += in.val_;
195 
196 
197  return *this;
198  }
200  dx0_ -= in.dx0_;
201  dx1_ -= in.dx1_;
202  dx2_ -= in.dx2_;
203  dx3_ -= in.dx3_;
204  dx4_ -= in.dx4_;
205  dx5_ -= in.dx5_;
206  val_ -= in.val_;
207 
208  return *this;
209  }
211  dx0_ = dx0_ * in.val_ + val_ * in.dx0_;
212  dx1_ = dx1_ * in.val_ + val_ * in.dx1_;
213  dx2_ = dx2_ * in.val_ + val_ * in.dx2_;
214  dx3_ = dx3_ * in.val_ + val_ * in.dx3_;
215  dx4_ = dx4_ * in.val_ + val_ * in.dx4_;
216  dx5_ = dx5_ * in.val_ + val_ * in.dx5_;
217  val_ *= in.val_;
218 
219  return *this;
220  }
222  if (in.val_ == 0.) error("TinyFad & TinyFad::operator /= (const TinyFad & in), dividing by 0");
223  dx0_ = ( dx0_ * in.val_ - val_ * in.dx0_ ) / in.val_ / in.val_ ;
224  dx1_ = ( dx1_ * in.val_ - val_ * in.dx1_ ) / in.val_ / in.val_ ;
225  dx2_ = ( dx2_ * in.val_ - val_ * in.dx2_ ) / in.val_ / in.val_ ;
226  dx3_ = ( dx3_ * in.val_ - val_ * in.dx3_ ) / in.val_ / in.val_ ;
227  dx4_ = ( dx4_ * in.val_ - val_ * in.dx4_ ) / in.val_ / in.val_ ;
228  dx5_ = ( dx5_ * in.val_ - val_ * in.dx5_ ) / in.val_ / in.val_ ;
229  val_ /= in.val_;
230 
231  return *this;
232  }
233 
234  TinyFad<6,T> & operator += (const T & in){ val_ += in;
235 
236  return *this;
237  }
238  TinyFad<6,T> & operator -= (const T & in){ val_ -= in;
239 
240  return *this;
241  }
242  TinyFad<6,T> & operator *= (const T & in){
243  val_ *= in;
244 
245  dx0_ *= in;
246  dx1_ *= in;
247  dx2_ *= in;
248  dx3_ *= in;
249  dx4_ *= in;
250  dx5_ *= in;
251 
252  return *this;
253  }
254  TinyFad<6,T> & operator /= (const T & in){
255  if ( in == T(0.) ) error("TinyFad & TinyFad::operator /= (const T & in), dividing by 0");
256  val_ /= in;
257 
258  dx0_ /= in;
259  dx1_ /= in;
260  dx2_ /= in;
261  dx3_ /= in;
262  dx4_ /= in;
263  dx5_ /= in;
264 
265  return *this;
266  }
267 
269  TinyFad<6,T> tmp(*this);
270  tmp.val_++;
271  return tmp;
272  };
274  TinyFad<6,T> tmp(*this);
275  tmp.val_--;
276  return tmp;
277  };
279  return *this;
280  }
282  return *this;
283  }
284 };
285 
286 
287 template <class T> inline TinyFad<6,T> operator + (const TinyFad<6,T>& in)
288 {
289  return TinyFad<6,T>(in);
290 }
291 
292 template <class T> inline TinyFad<6,T> operator - (const TinyFad<6,T>& in)
293 {
295  tmp -= in;
296  return tmp;
297 }
298 
299 template <class L, class R> inline
301 operator +(const TinyFad<6,L>& un, const TinyFad<6,R>& deux) {
302 
303  typedef typename NumericalTraits<L,R>::promote value_type;
304 
305  No_Initialization nothing;
306  TinyFad<6,value_type> tmp( nothing );
307 
308  tmp.d0() = un.d0() + deux.d0();
309 
310  tmp.d1() = un.d1() + deux.d1();
311 
312  tmp.d2() = un.d2() + deux.d2();
313 
314  tmp.d3() = un.d3() + deux.d3();
315 
316  tmp.d4() = un.d4() + deux.d4();
317 
318  tmp.d5() = un.d5() + deux.d5();
319 
320  tmp.val() = un.val() + deux.val();
321 
322  return tmp;
323 }
324 
325 template <class L, class R> inline
327 operator +(const TinyFad<6,L>& un, const R& deux) {
328 
329  typedef typename NumericalTraits<L,R>::promote value_type;
330 
331  No_Initialization nothing;
332  TinyFad<6,value_type> tmp( nothing );
333 
334  tmp.d0() = un.d0();
335 
336  tmp.d1() = un.d1();
337 
338  tmp.d2() = un.d2();
339 
340  tmp.d3() = un.d3();
341 
342  tmp.d4() = un.d4();
343 
344  tmp.d5() = un.d5();
345 
346  tmp.val() = un.val() + deux;
347 
348  return tmp;
349 }
350 
351 template <class L, class R> inline
353 operator +(const L& un, const TinyFad<6,R>& deux) {
354  return operator +(deux,un);
355 }
356 
357 template <class L, class R> inline
359 operator *(const TinyFad<6,L>& un, const TinyFad<6,R>& deux) {
360 
361  typedef typename NumericalTraits<L,R>::promote value_type;
362 
363  No_Initialization nothing;
364  TinyFad<6,value_type> tmp( nothing );
365 
366  tmp.d0() = un.d0()*deux.val() + un.val() * deux.d0();
367 
368  tmp.d1() = un.d1()*deux.val() + un.val() * deux.d1();
369 
370  tmp.d2() = un.d2()*deux.val() + un.val() * deux.d2();
371 
372  tmp.d3() = un.d3()*deux.val() + un.val() * deux.d3();
373 
374  tmp.d4() = un.d4()*deux.val() + un.val() * deux.d4();
375 
376  tmp.d5() = un.d5()*deux.val() + un.val() * deux.d5();
377 
378  tmp.val() = un.val() * deux.val();
379 
380  return tmp;
381 }
382 
383 template <class L, class R> inline
385 operator *(const TinyFad<6,L>& un, const R& deux) {
386 
387  typedef typename NumericalTraits<L,R>::promote value_type;
388 
389  No_Initialization nothing;
390  TinyFad<6,value_type> tmp( nothing );
391 
392  tmp.d0() = un.d0()*deux;
393 
394  tmp.d1() = un.d1()*deux;
395 
396  tmp.d2() = un.d2()*deux;
397 
398  tmp.d3() = un.d3()*deux;
399 
400  tmp.d4() = un.d4()*deux;
401 
402  tmp.d5() = un.d5()*deux;
403 
404  tmp.val() = un.val() * deux;
405 
406  return tmp;
407 }
408 
409 template <class L, class R> inline
411 operator *(const L& un, const TinyFad<6,R>& deux) {
412 
413  return operator *(deux,un);
414 }
415 
416 
417 template <class L, class R> inline
419 operator -(const TinyFad<6,L> & un, const TinyFad<6,R> & deux) {
420 
421  typedef typename NumericalTraits<L,R>::promote value_type;
422 
423  No_Initialization nothing;
424  TinyFad<6,value_type> tmp( nothing );
425 
426  tmp.d0() = un.d0() - deux.d0();
427 
428  tmp.d1() = un.d1() - deux.d1();
429 
430  tmp.d2() = un.d2() - deux.d2();
431 
432  tmp.d3() = un.d3() - deux.d3();
433 
434  tmp.d4() = un.d4() - deux.d4();
435 
436  tmp.d5() = un.d5() - deux.d5();
437 
438  tmp.val() = un.val() - deux.val();
439 
440  return tmp;
441 }
442 
443 template <class L, class R> inline
445 operator -(const L & un, const TinyFad<6,R> & deux) {
446 
447  typedef typename NumericalTraits<L,R>::promote value_type;
448 
449  No_Initialization nothing;
450  TinyFad<6,value_type> tmp( nothing );
451 
452  tmp.d0() -= deux.d0();
453 
454  tmp.d1() -= deux.d1();
455 
456  tmp.d2() -= deux.d2();
457 
458  tmp.d3() -= deux.d3();
459 
460  tmp.d4() -= deux.d4();
461 
462  tmp.d5() -= deux.d5();
463 
464  tmp.val() = un - deux.val();
465 
466  return tmp;
467 }
468 
469 template <class L, class R> inline
471 operator -(const TinyFad<6,L> & un, const R & deux) {
472  typedef typename NumericalTraits<L,R>::promote value_type;
473 
474  No_Initialization nothing;
475  TinyFad<6,value_type> tmp( nothing );
476 
477  tmp.d0() = un.d0();
478 
479  tmp.d1() = un.d1();
480 
481  tmp.d2() = un.d2();
482 
483  tmp.d3() = un.d3();
484 
485  tmp.d4() = un.d4();
486 
487  tmp.d5() = un.d5();
488 
489  tmp.val() = un.val() - deux;
490 
491  return tmp;
492 }
493 
494 template <class L, class R> inline
496 operator /(const TinyFad<6,L> & un, const TinyFad<6,R> & deux) {
497 
498  typedef typename NumericalTraits<L,R>::promote value_type;
499 
500  if (deux.val() == 0.) error("TinyFad & TinyFad::operator /(const TinyFad<6,L> & un, const TinyFad<6,R> & deux), dividing by 0");
501 
502  No_Initialization nothing;
503  TinyFad<6,value_type> tmp( nothing );
504  value_type dval = deux.val();
505 
506  tmp.d0() = ( un.d0()* deux.val() - un.val() * deux.d0() ) / dval / dval ;
507 
508  tmp.d1() = ( un.d1()* deux.val() - un.val() * deux.d1() ) / dval / dval ;
509 
510  tmp.d2() = ( un.d2()* deux.val() - un.val() * deux.d2() ) / dval / dval ;
511 
512  tmp.d3() = ( un.d3()* deux.val() - un.val() * deux.d3() ) / dval / dval ;
513 
514  tmp.d4() = ( un.d4()* deux.val() - un.val() * deux.d4() ) / dval / dval ;
515 
516  tmp.d5() = ( un.d5()* deux.val() - un.val() * deux.d5() ) / dval / dval ;
517 
518  tmp.val() = un.val() / dval;
519 
520  return tmp;
521 }
522 
523 template <class L, class R> inline
525 operator /(const L & un, const TinyFad<6,R> & deux) {
526 
527  typedef typename NumericalTraits<L,R>::promote value_type;
528 
529  if (deux.val() == 0.) error("TinyFad & TinyFad::operator /(const L & un, const TinyFad<6,R> & deux), dividing by 0");
530 
531  No_Initialization nothing;
532  TinyFad<6,value_type> tmp( nothing );
533  value_type dval = deux.val();
534 
535  tmp.d0() = - un * deux.d0() / dval / dval ;
536 
537  tmp.d1() = - un * deux.d1() / dval / dval ;
538 
539  tmp.d2() = - un * deux.d2() / dval / dval ;
540 
541  tmp.d3() = - un * deux.d3() / dval / dval ;
542 
543  tmp.d4() = - un * deux.d4() / dval / dval ;
544 
545  tmp.d5() = - un * deux.d5() / dval / dval ;
546 
547  tmp.val() = un / dval;
548 
549  return tmp;
550 }
551 
552 template <class L, class R> inline
554 operator /(const TinyFad<6,L> & un, const R & deux) {
555 
556  typedef typename NumericalTraits<L,R>::promote value_type;
557 
558  if (deux == 0.) error("TinyFad & TinyFad::operator /(const TinyFad<6,L> & un, const R & deux), dividing by 0");
559 
560  No_Initialization nothing;
561  TinyFad<6,value_type> tmp( nothing );
562 
563  tmp.d0() = un.d0() / deux;
564 
565  tmp.d1() = un.d1() / deux;
566 
567  tmp.d2() = un.d2() / deux;
568 
569  tmp.d3() = un.d3() / deux;
570 
571  tmp.d4() = un.d4() / deux;
572 
573  tmp.d5() = un.d5() / deux;
574 
575  tmp.val() = un.val() / deux;
576 
577  return tmp;
578 }
579 
580 template <class T> TinyFad<6,T> exp (const TinyFad<6,T>& in)
581 {
582  TinyFad<6,T> tmp(exp(in.val()));
583 
584  tmp.d0() = in.d0()*exp(in.val());
585  tmp.d1() = in.d1()*exp(in.val());
586  tmp.d2() = in.d2()*exp(in.val());
587  tmp.d3() = in.d3()*exp(in.val());
588  tmp.d4() = in.d4()*exp(in.val());
589  tmp.d5() = in.d5()*exp(in.val());
590 
591  return tmp;
592 }
593 
594 template <class T> TinyFad<6,T> log (const TinyFad<6,T>& in)
595 {
596  if ( in.val() <= 0) error("TinyFad log (const TinyFad& in) : zero or negative value");
597  TinyFad<6,T> tmp(log(in.val()));
598 
599  tmp.d0() = in.d0() / in.val();
600  tmp.d1() = in.d1() / in.val();
601  tmp.d2() = in.d2() / in.val();
602  tmp.d3() = in.d3() / in.val();
603  tmp.d4() = in.d4() / in.val();
604  tmp.d5() = in.d5() / in.val();
605 
606  return tmp;
607 }
608 
609 template <class T> TinyFad<6,T> sqrt (const TinyFad<6,T>& in)
610 {
611  if ( in.val() < 0. ) error("TinyFad<6,T> sqrt (const TinyFad& in) : negative value");
612  TinyFad<6,T> tmp(sqrt(in.val()));
613 
614  bool test=true;
615  if ( in.val() == T(0.) ){
616  if ( in.d0() != T(0.) ) test = false;
617 
618  if ( in.d1() != T(0.) ) test = false;
619 
620  if ( in.d2() != T(0.) ) test = false;
621 
622  if ( in.d3() != T(0.) ) test = false;
623 
624  if ( in.d4() != T(0.) ) test = false;
625 
626  if ( in.d5() != T(0.) ) test = false;
627 
628  if ( !test )
629  error("TinyFad<6,T> sqrt (const TinyFad& in) : null value");
630  }
631  else {
632  tmp.d0() = in.d0() / sqrt(in.val()) / 2.;
633  tmp.d1() = in.d1() / sqrt(in.val()) / 2.;
634  tmp.d2() = in.d2() / sqrt(in.val()) / 2.;
635  tmp.d3() = in.d3() / sqrt(in.val()) / 2.;
636  tmp.d4() = in.d4() / sqrt(in.val()) / 2.;
637  tmp.d5() = in.d5() / sqrt(in.val()) / 2.;
638  }
639 
640  return tmp;
641 }
642 
643 template <class T> TinyFad<6,T> sin (const TinyFad<6,T>& in)
644 {
645  TinyFad<6,T> tmp( sin(in.val()) );
646 
647  tmp.d0() = in.d0() * cos( in.val() );
648  tmp.d1() = in.d1() * cos( in.val() );
649  tmp.d2() = in.d2() * cos( in.val() );
650  tmp.d3() = in.d3() * cos( in.val() );
651  tmp.d4() = in.d4() * cos( in.val() );
652  tmp.d5() = in.d5() * cos( in.val() );
653 
654  return tmp;
655 }
656 
657 template <class T> TinyFad<6,T> cos (const TinyFad<6,T>& in)
658 {
659  TinyFad<6,T> tmp(cos(in.val()));
660 
661  tmp.d0() = - in.d0() * sin( in.val() );
662  tmp.d1() = - in.d1() * sin( in.val() );
663  tmp.d2() = - in.d2() * sin( in.val() );
664  tmp.d3() = - in.d3() * sin( in.val() );
665  tmp.d4() = - in.d4() * sin( in.val() );
666  tmp.d5() = - in.d5() * sin( in.val() );
667 
668  return tmp;
669 }
670 
671 template <class T> TinyFad<6,T> tan (const TinyFad<6,T>& in)
672 {
673  if ( in.val() == 0) error("TinyFad tan (const TinyFad& in) undiefined in 0.");
674  TinyFad<6,T> tmp(tan(in.val()));
675 
676  T cosinus = cos(in.val());
677  tmp.d0() = in.d0() / cosinus / cosinus;
678  tmp.d1() = in.d1() / cosinus / cosinus;
679  tmp.d2() = in.d2() / cosinus / cosinus;
680  tmp.d3() = in.d3() / cosinus / cosinus;
681  tmp.d4() = in.d4() / cosinus / cosinus;
682  tmp.d5() = in.d5() / cosinus / cosinus;
683 
684  return tmp;
685 }
686 
687 template <class T> TinyFad<6,T> pow (const TinyFad<6,T>& in, double e)
688 {
689  TinyFad<6,T> tmp(pow(in.val(), e));
690 
691  tmp.d0() = e*in.d0()*pow(in.val(), e-1);
692  tmp.d1() = e*in.d1()*pow(in.val(), e-1);
693  tmp.d2() = e*in.d2()*pow(in.val(), e-1);
694  tmp.d3() = e*in.d3()*pow(in.val(), e-1);
695  tmp.d4() = e*in.d4()*pow(in.val(), e-1);
696  tmp.d5() = e*in.d5()*pow(in.val(), e-1);
697 
698  return tmp;
699 }
700 
701 template <class T> TinyFad<6,T> pow (const TinyFad<6,T>& un, const TinyFad<6,T>& deux)
702 {
703  if (un.val() == 0) error("TinyFad pow (const TinyFad& un, const TinyFad& deux), un = 0. ");
704  TinyFad<6,T> tmp(pow(un.val(), deux.val()));
705 
706  tmp.d0() = deux.d0() * log(un.val()) * pow(un.val(), deux.val())
707  + deux.val() * un.d0() * pow(un.val(), deux.val()-1);
708  tmp.d1() = deux.d1() * log(un.val()) * pow(un.val(), deux.val())
709  + deux.val() * un.d1() * pow(un.val(), deux.val()-1);
710  tmp.d2() = deux.d2() * log(un.val()) * pow(un.val(), deux.val())
711  + deux.val() * un.d2() * pow(un.val(), deux.val()-1);
712  tmp.d3() = deux.d3() * log(un.val()) * pow(un.val(), deux.val())
713  + deux.val() * un.d3() * pow(un.val(), deux.val()-1);
714  tmp.d4() = deux.d4() * log(un.val()) * pow(un.val(), deux.val())
715  + deux.val() * un.d4() * pow(un.val(), deux.val()-1);
716  tmp.d5() = deux.d5() * log(un.val()) * pow(un.val(), deux.val())
717  + deux.val() * un.d5() * pow(un.val(), deux.val()-1);
718 
719  return tmp;
720 }
721 
722 template <class T> TinyFad<6,T> pow (const TinyFad<6,T>& in, const int e)
723 {
724  TinyFad<6,T> tmp( pow((double)in.val(), (double)e) );
725 
726  tmp.d0() = e*in.d0()*pow((double)in.val(), (double)e-1);
727  tmp.d1() = e*in.d1()*pow((double)in.val(), (double)e-1);
728  tmp.d2() = e*in.d2()*pow((double)in.val(), (double)e-1);
729  tmp.d3() = e*in.d3()*pow((double)in.val(), (double)e-1);
730  tmp.d4() = e*in.d4()*pow((double)in.val(), (double)e-1);
731  tmp.d5() = e*in.d5()*pow((double)in.val(), (double)e-1);
732 
733  return tmp;
734 }
735 
736 template <class T> TinyFad<6,T> abs (const TinyFad<6,T>& in)
737 {
738  int sign = in.val() > 0? 1:0;
739 
740  if (sign) return in;
741  else return (-in);
742 }
743 
744 template <class T> std::ostream& operator << (std::ostream& os, const TinyFad<6,T>& a)
745 {
746  os.setf(std::ios::fixed,std::ios::scientific);
747  os.width(12);
748  os << a.val() << " [";
749 
750  os.width(12);
751  os << a.d0();
752  os.width(12);
753  os << a.d1();
754  os.width(12);
755  os << a.d2();
756  os.width(12);
757  os << a.d3();
758  os.width(12);
759  os << a.d4();
760  os.width(12);
761  os << a.d5();
762 
763  os << "]";
764 
765  return os;
766 }
767 
768 
769 #endif
TinyFad< 6, typename NumericalTraits< L, R >::promote > operator/(const TinyFad< 6, L > &un, const TinyFad< 6, R > &deux)
Definition: tinyfadsix.h:496
const T & d1() const
Definition: tinyfadsix.h:101
TinyFad< Num, T > & operator-=(const TinyFad< Num, T > &in)
Definition: tinyfad.h:233
void diff(const size_t ith, const size_t sz)
Definition: tinyfadsix.h:27
TinyFad< 6, typename NumericalTraits< L, R >::promote > operator*(const TinyFad< 6, L > &un, const TinyFad< 6, R > &deux)
Definition: tinyfadsix.h:359
Definition: test.py:1
TinyFad< 6, T > log(const TinyFad< 6, T > &in)
Definition: tinyfadsix.h:594
const T & d3() const
Definition: tinyfadsix.h:107
T & dx(int i)
Definition: tinyfadsix.h:116
AutoPointerMutexArrayInit tmp
TinyFad< 6, T > & operator++()
Definition: tinyfadsix.h:278
T val_
Definition: tinyfad.h:47
int N() const
Definition: tinyfadsix.h:93
TinyFad< 6, T > sqrt(const TinyFad< 6, T > &in)
Definition: tinyfadsix.h:609
void error(char *string)
Definition: testShape.cc:7
const T & d(int i) const
Definition: tinyfadsix.h:149
T & d(int i)
Definition: tinyfadsix.h:138
TinyFad< 6, T > sin(const TinyFad< 6, T > &in)
Definition: tinyfadsix.h:643
TinyFad(const TinyFad< 6, T > &in)
Definition: tinyfadsix.h:82
TinyFad(const T &in)
Definition: tinyfadsix.h:74
TinyFad< 6, T > operator++(int)
Definition: tinyfadsix.h:268
TinyFad< 6, T > operator+(const TinyFad< 6, T > &in)
Definition: tinyfadsix.h:287
const T & d5() const
Definition: tinyfadsix.h:113
TinyFad< 6, T > cos(const TinyFad< 6, T > &in)
Definition: tinyfadsix.h:657
TinyFad< Num, T > & operator=(const TinyFad< Num, T > &in)
Definition: tinyfad.h:189
const T & dx(int i) const
Definition: tinyfadsix.h:127
TinyFad< Num, T > & operator+=(const TinyFad< Num, T > &in)
Definition: tinyfad.h:219
TinyFad< 6, T > operator--(int)
Definition: tinyfadsix.h:273
TinyFad< 6, T > abs(const TinyFad< 6, T > &in)
Definition: tinyfadsix.h:736
T value_type
Definition: tinyfad.h:53
TinyFad< Num, T > & operator*=(const TinyFad< Num, T > &in)
Definition: tinyfad.h:247
TinyFad< 6, T > pow(const TinyFad< 6, T > &in, double e)
Definition: tinyfadsix.h:687
const T & d4() const
Definition: tinyfadsix.h:110
TinyFad(const No_Initialization &)
Definition: tinyfadsix.h:73
TinyFad< Num, T > & operator/=(const TinyFad< Num, T > &in)
Definition: tinyfad.h:261
TinyFad< 6, T > exp(const TinyFad< 6, T > &in)
Definition: tinyfadsix.h:580
const T & d2() const
Definition: tinyfadsix.h:104
const T & val() const
Definition: tinyfadsix.h:95
const T & d0() const
Definition: tinyfadsix.h:98
TinyFad< 6, T > operator-(const TinyFad< 6, T > &in)
Definition: tinyfadsix.h:292
TinyFad< 6, T > tan(const TinyFad< 6, T > &in)
Definition: tinyfadsix.h:671
const T & val() const
Definition: tinyfad.h:72
TinyFad< 6, T > & operator--()
Definition: tinyfadsix.h:281
TinyFad(const T &ind, const int ini)
Definition: tinyfadsix.h:47