Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JHesseMatrix.hh
Go to the documentation of this file.
1#ifndef __JTOOLS__JHESSEMATRIX__
2#define __JTOOLS__JHESSEMATRIX__
3
4#include "JTools/JTable2D.hh"
5#include "JTools/JResult.hh"
6
7
8/**
9 * \author mdejong
10 */
11
12namespace JTOOLS {}
13namespace JPP { using namespace JTOOLS; }
14
15namespace JTOOLS {
16
17
18 /**
19 * Hessian matrix.
20 */
21 template<unsigned int N, class JData_t = double>
22 struct JHesseMatrix :
23 public JTable2D<N, N, JData_t>
24 {
25 /**
26 * Default constructor.
27 */
29 {}
30
31
32 /**
33 * Constructor.
34 *
35 * \param result Hesse result
36 */
37 template<class JResult_t>
42
43
44 /**
45 * Set matrix according given result.
46 *
47 * \param result Hesse result
48 */
49 template<class JResult_t>
51 {
52 set(0, result);
53
54 for (unsigned int i = 1; i != N; ++i) {
55 for (unsigned int j = 0; j != i; ++j) {
56 this->data[i][j] = this->data[j][i];
57 }
58 }
59 }
60
61 private:
62 /**
63 * Set final element.
64 *
65 * \param pivot pivot
66 * \param result Hesse result
67 */
68 void set(unsigned int pivot,
70 {
71 this->data[pivot][pivot] = result.fpp;
72 }
73
74
75 /**
76 * Set final element.
77 *
78 * \param row row
79 * \param col col
80 * \param result Hesse result
81 */
82 void set(unsigned int row,
83 unsigned int col,
85 {
86 this->data[row][col] = result.fp;
87 }
88
89
90 /**
91 * Recursivaly set elements.
92 *
93 * \param pivot pivot
94 * \param result Hesse result
95 */
96 template<class JResult_t>
97 void set(unsigned int pivot,
99 {
100 this->data[pivot][pivot] = get_value(result.fpp);
101
102 set(pivot, pivot + 1, result.fp);
103 set(pivot + 1, result.f);
104 }
105
106
107 /**
108 * Recursivaly set elements.
109 *
110 * \param row row
111 * \param col col
112 * \param result Hesse result
113 */
114 template<class JResult_t>
115 void set(unsigned int row,
116 unsigned int col,
118 {
119 this->data[row][col] = get_value(result.fp);
120
121 set(row, col + 1, result.f);
122 }
123 };
124}
125
126#endif
This include file containes various data structures that can be used as specific return types for the...
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary classes and methods for multi-dimensional interpolations and histograms.
return result
Definition JPolint.hh:862
int j
Definition JPolint.hh:801
JResultEvaluator< JResult_t >::result_type get_value(const JResult_t &value)
Helper method to recursively evaluate a to function value.
Definition JResult.hh:998
Hessian matrix.
void set(unsigned int pivot, const JResultHesse< JResult_t > &result)
Recursivaly set elements.
void set(unsigned int pivot, const JResultHesse< JData_t > &result)
Set final element.
void set(unsigned int row, unsigned int col, const JResultHesse< JData_t > &result)
Set final element.
JHesseMatrix(const JResultHesse< JResult_t > &result)
Constructor.
JHesseMatrix()
Default constructor.
void set(const JResultHesse< JResult_t > &result)
Set matrix according given result.
void set(unsigned int row, unsigned int col, const JResultHesse< JResult_t > &result)
Recursivaly set elements.
Data structure for result including value and first derivative of function.
Definition JResult.hh:215
2D table with arithmetic capabilities.
Definition JTable2D.hh:29