Debian Codegraph @

src/Algo/RosenBrock.hpp

raw symbols SCIP
1 #cxx . . $ `<file>/src/Algo/RosenBrock.hpp`/ifndef ROSENBROCK_HH
2 #define ROSENBROCK_HHcxx . . $ `src/Algo/RosenBrock.hpp:2:9`!
3
4 #include "NRJ.hpp"cxx . . $ `<file>/src/Algo/NRJ.hpp`/
5 #include "Param.hpp"cxx . . $ `<file>/src/Algo/Param.hpp`/
6 //#include "mvvtp.h"
7 //#include "mvblas.h"
8
9 template< class Real, class Mat >
10 class RosenBrockcxx . . $ RosenBrock# : public tNRJcxx . . $ tNRJ#< Paramcxx . . $ Param#< Real >, KNcxx . . $ KN#< Real >, Mat, Real > {
11 private:
12 protected:
13 public:
14 // Constructors and Destructors
15 explicit RosenBrockcxx . . $ RosenBrock#`RosenBrock<Real, Mat>`(d4f767463ce0a6b3).(int);
16 ~cxx . . $ RosenBrock#`~RosenBrock<Real, Mat>`(49f6e7a06ebc5aa8).RosenBrock( );
17
18 Real Valcxx . . $ RosenBrock#Val(a31e76cd47d1503e).(const Paramcxx . . $ Param#< Real >&);
19 KNcxx . . $ KN#< Real >* Gradientcxx . . $ RosenBrock#Gradient(724b5a7d28103175).(const Paramcxx . . $ Param#< Real >&);
20 Mat* Hessiancxx . . $ RosenBrock#Hessian(202c921a70c3646a).(const Paramcxx . . $ Param#< Real >&);
21 };
22
23 template< class Real, class Mat >
24 RosenBrockcxx . . $ RosenBrock#< Real, Mat >::RosenBrockcxx . . $ RosenBrock#`RosenBrock<Real, Mat>`(d4f767463ce0a6b3).(int n)
25 : tNRJcxx . . $ tNRJ#< Paramcxx . . $ Param#< Real >, KNcxx . . $ KN#< Real >, Mat, Real >(n) { // On initialise le gradient
26 this->gradcxx . . $ tNRJ#grad. = new KNcxx . . $ KN#< Real >(n);
27 // On initialise le hessien
28 // Si on utlise pas le hessien, il suffit qu'il existe un constructeur
29 // pour le type Mat qui prend un parametre entier. C'est vrai pour les
30 // doubles par exemple...
31 this->hesscxx . . $ tNRJ#hess. = new Mat(n);
32 (*cxx . . $ `operator*`(ca0d58f853b0940).this->hesscxx . . $ tNRJ#hess.) = 0;
33 }
34
35 template< class Real, class Mat >
36 RosenBrockcxx . . $ RosenBrock#< Real, Mat >::~cxx . . $ RosenBrock#`~RosenBrock<Real, Mat>`(49f6e7a06ebc5aa8).RosenBrock( ) {
37 ;
38 }
39
40 template< class Real, class Mat >
41 Real RosenBrockcxx . . $ RosenBrock#< Real, Mat >::Valcxx . . $ RosenBrock#Val(a31e76cd47d1503e).(const Paramcxx . . $ Param#< Real >& param) {
42 Real ti_1, ti, tt;
43 Real d = 0;
44
45 ti_1 = param[0];
46
47 for (int i = 1; i <cxx . . $ std/`operator<`(c2ad8cf295ccec45). this->nparamcxx . . $ tNRJ#nparam.; i++) {
48 ti = param[i];
49 tt = 1 -cxx . . $ operator-(4b6fd085471a9fb1). ti_1;
50 d +=cxx . . $ `operator+=`(d02e6a613fcf7dc7). tt *cxx . . $ `operator*`(ca0d58f853b0940). tt;
51 tt = ti -cxx . . $ operator-(4b6fd085471a9fb1). ti_1 *cxx . . $ `operator*`(ca0d58f853b0940). ti_1;
52 d +=cxx . . $ `operator+=`(d02e6a613fcf7dc7). 100 *cxx . . $ `operator*`(ca0d58f853b0940). tt *cxx . . $ `operator*`(ca0d58f853b0940). tt;
53
54 ti_1 = ti;
55 }
56
57 this->valcxx . . $ tNRJ#val. = d;
58
59 return d;
60 }
61
62 template< class Real, class Mat >
63 KNcxx . . $ KN#< Real >* RosenBrockcxx . . $ RosenBrock#< Real, Mat >::Gradientcxx . . $ RosenBrock#Gradient(724b5a7d28103175).(const Paramcxx . . $ Param#< Real >& param) {
64 Real ti_1, ti;
65 ti_1 = param[0];
66 ti = param[1];
67
68 (*cxx . . $ `operator*`(ca0d58f853b0940).this->gradcxx . . $ tNRJ#grad.)[0] = -200 * 2 *cxx . . $ `operator*`(ca0d58f853b0940). ti_1 *cxx . . $ `operator*`(ca0d58f853b0940). (ti -cxx . . $ operator-(4b6fd085471a9fb1). ti_1 *cxx . . $ `operator*`(ca0d58f853b0940). ti_1) -cxx . . $ operator-(4b6fd085471a9fb1). 2 *cxx . . $ `operator*`(ca0d58f853b0940). (1 -cxx . . $ operator-(4b6fd085471a9fb1). ti_1);
69
70 for (int i = 1; i <cxx . . $ std/`operator<`(c2ad8cf295ccec45). this->nparamcxx . . $ tNRJ#nparam. -cxx . . $ operator-(4b6fd085471a9fb1). 1; i++) {
71 (*cxx . . $ `operator*`(ca0d58f853b0940).this->gradcxx . . $ tNRJ#grad.)[i] = 200 *cxx . . $ `operator*`(ca0d58f853b0940). (ti -cxx . . $ operator-(4b6fd085471a9fb1). ti_1 *cxx . . $ `operator*`(ca0d58f853b0940). ti_1);
72 ti_1 = ti;
73 ti = param[i + 1];
74 (*cxx . . $ `operator*`(ca0d58f853b0940).this->gradcxx . . $ tNRJ#grad.)[i] +=cxx . . $ `operator+=`(d02e6a613fcf7dc7). -200 * 2 *cxx . . $ `operator*`(ca0d58f853b0940). ti_1 *cxx . . $ `operator*`(ca0d58f853b0940). (ti -cxx . . $ operator-(4b6fd085471a9fb1). ti_1 *cxx . . $ `operator*`(ca0d58f853b0940). ti_1) -cxx . . $ operator-(4b6fd085471a9fb1). 2 *cxx . . $ `operator*`(ca0d58f853b0940). (1 -cxx . . $ operator-(4b6fd085471a9fb1). ti_1);
75 }
76
77 (*cxx . . $ `operator*`(ca0d58f853b0940).this->gradcxx . . $ tNRJ#grad.)[this->nparamcxx . . $ tNRJ#nparam. -cxx . . $ operator-(4b6fd085471a9fb1). 1] = 200 *cxx . . $ `operator*`(ca0d58f853b0940). (ti -cxx . . $ operator-(4b6fd085471a9fb1). ti_1 *cxx . . $ `operator*`(ca0d58f853b0940). ti_1);
78
79 return this->gradcxx . . $ tNRJ#grad.;
80 }
81
82 template< class Real, class Mat >
83 Mat* RosenBrockcxx . . $ RosenBrock#< Real, Mat >::Hessiancxx . . $ RosenBrock#Hessian(202c921a70c3646a).(const Paramcxx . . $ Param#< Real >& param) {
84 Real ti_1, ti;
85 ti_1 = param[0];
86 ti = param[1];
87
88 (*cxx . . $ `operator*`(ca0d58f853b0940).this->hesscxx . . $ tNRJ#hess.)(0, 0) = -200 * 2 *cxx . . $ `operator*`(ca0d58f853b0940). (ti -cxx . . $ operator-(4b6fd085471a9fb1). ti_1 *cxx . . $ `operator*`(ca0d58f853b0940). ti_1) +cxx . . $ operator+(1f62e43363bf5779). 200 * 2 * 2 *cxx . . $ `operator*`(ca0d58f853b0940). ti_1 *cxx . . $ `operator*`(ca0d58f853b0940). ti_1 +cxx . . $ operator+(1f62e43363bf5779). 2;
89 (*cxx . . $ `operator*`(ca0d58f853b0940).this->hesscxx . . $ tNRJ#hess.)(0, 1) = -200 * 2 *cxx . . $ `operator*`(ca0d58f853b0940). ti_1;
90
91 for (int i = 1; i <cxx . . $ std/`operator<`(c2ad8cf295ccec45). this->nparamcxx . . $ tNRJ#nparam. -cxx . . $ operator-(4b6fd085471a9fb1). 1; i++) {
92 (*cxx . . $ `operator*`(ca0d58f853b0940).this->hesscxx . . $ tNRJ#hess.)(i, i) = 200;
93 (*cxx . . $ `operator*`(ca0d58f853b0940).this->hesscxx . . $ tNRJ#hess.)(i, i - 1) = -200 * 2 *cxx . . $ `operator*`(ca0d58f853b0940). ti_1;
94 ti_1 = ti;
95 ti = param[i + 1];
96 (*cxx . . $ `operator*`(ca0d58f853b0940).this->hesscxx . . $ tNRJ#hess.)(i, i) +=cxx . . $ `operator+=`(d02e6a613fcf7dc7). -200 * 2 *cxx . . $ `operator*`(ca0d58f853b0940). (ti -cxx . . $ operator-(4b6fd085471a9fb1). ti_1 *cxx . . $ `operator*`(ca0d58f853b0940). ti_1) +cxx . . $ operator+(1f62e43363bf5779). 200 * 2 * 2 *cxx . . $ `operator*`(ca0d58f853b0940). ti_1 *cxx . . $ `operator*`(ca0d58f853b0940). ti_1 +cxx . . $ operator+(1f62e43363bf5779). 2;
97 (*cxx . . $ `operator*`(ca0d58f853b0940).this->hesscxx . . $ tNRJ#hess.)(i, i + 1) = -200 * 2 *cxx . . $ `operator*`(ca0d58f853b0940). ti_1;
98 }
99
100 (*cxx . . $ `operator*`(ca0d58f853b0940).this->hesscxx . . $ tNRJ#hess.)(this->nparamcxx . . $ tNRJ#nparam. -cxx . . $ operator-(4b6fd085471a9fb1). 1, this->nparamcxx . . $ tNRJ#nparam. -cxx . . $ operator-(4b6fd085471a9fb1). 1) = 200;
101 (*cxx . . $ `operator*`(ca0d58f853b0940).this->hesscxx . . $ tNRJ#hess.)(this->nparamcxx . . $ tNRJ#nparam. -cxx . . $ operator-(4b6fd085471a9fb1). 1, this->nparamcxx . . $ tNRJ#nparam. -cxx . . $ operator-(4b6fd085471a9fb1). 2) = -200 * 2 *cxx . . $ `operator*`(ca0d58f853b0940). ti_1;
102
103 return this->hesscxx . . $ tNRJ#hess.;
104 }
105
106 #endif