Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JTOOLS::JHesseMatrix< N, JData_t > Struct Template Reference

Hessian matrix. More...

#include <JHesseMatrix.hh>

Inheritance diagram for JTOOLS::JHesseMatrix< N, JData_t >:
JTOOLS::JTable2D< N, N, double > JMATH::JMath< JFirst_t, JSecond_t >

Public Types

typedef double data_type
 

Public Member Functions

 JHesseMatrix ()
 Default constructor.
 
template<class JResult_t >
 JHesseMatrix (const JResultHesse< JResult_t > &result)
 Constructor.
 
template<class JResult_t >
void set (const JResultHesse< JResult_t > &result)
 Set matrix according given result.
 
const data_type * operator[] (int row) const
 Get row data.
 
data_type * operator[] (int row)
 Get row data.
 
JTable2D & negate ()
 Negate table.
 
JTable2D & add (const JTable2D &table)
 Add table.
 
JTable2D & sub (const JTable2D &table)
 Subtract table.
 
JTable2D & mul (const double factor)
 Scale table.
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object.
 
JTable2D & div (const double factor)
 Scale table.
 

Static Public Member Functions

static int getNX ()
 Get number of rows.
 
static int getNY ()
 Get number of columns.
 

Protected Attributes

data_type data [NX][NY]
 

Private Member Functions

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.
 
template<class JResult_t >
void set (unsigned int pivot, const JResultHesse< JResult_t > &result)
 Recursivaly set elements.
 
template<class JResult_t >
void set (unsigned int row, unsigned int col, const JResultHesse< JResult_t > &result)
 Recursivaly set elements.
 

Detailed Description

template<unsigned int N, class JData_t = double>
struct JTOOLS::JHesseMatrix< N, JData_t >

Hessian matrix.

Definition at line 22 of file JHesseMatrix.hh.

Member Typedef Documentation

◆ data_type

double JTOOLS::JTable2D< NX, NY, double >::data_type
inherited

Definition at line 30 of file JTable2D.hh.

Constructor & Destructor Documentation

◆ JHesseMatrix() [1/2]

template<unsigned int N, class JData_t = double>
JTOOLS::JHesseMatrix< N, JData_t >::JHesseMatrix ( )
inline

Default constructor.

Definition at line 28 of file JHesseMatrix.hh.

29 {}

◆ JHesseMatrix() [2/2]

template<unsigned int N, class JData_t = double>
template<class JResult_t >
JTOOLS::JHesseMatrix< N, JData_t >::JHesseMatrix ( const JResultHesse< JResult_t > & result)
inline

Constructor.

Parameters
resultHesse result

Definition at line 38 of file JHesseMatrix.hh.

39 {
40 set(result);
41 }
return result
Definition JPolint.hh:862
void set(const JResultHesse< JResult_t > &result)
Set matrix according given result.

Member Function Documentation

◆ set() [1/5]

template<unsigned int N, class JData_t = double>
template<class JResult_t >
void JTOOLS::JHesseMatrix< N, JData_t >::set ( const JResultHesse< JResult_t > & result)
inline

Set matrix according given result.

Parameters
resultHesse result

Definition at line 50 of file JHesseMatrix.hh.

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 }
int j
Definition JPolint.hh:801

◆ set() [2/5]

template<unsigned int N, class JData_t = double>
void JTOOLS::JHesseMatrix< N, JData_t >::set ( unsigned int pivot,
const JResultHesse< JData_t > & result )
inlineprivate

Set final element.

Parameters
pivotpivot
resultHesse result

Definition at line 68 of file JHesseMatrix.hh.

70 {
71 this->data[pivot][pivot] = result.fpp;
72 }

◆ set() [3/5]

template<unsigned int N, class JData_t = double>
void JTOOLS::JHesseMatrix< N, JData_t >::set ( unsigned int row,
unsigned int col,
const JResultHesse< JData_t > & result )
inlineprivate

Set final element.

Parameters
rowrow
colcol
resultHesse result

Definition at line 82 of file JHesseMatrix.hh.

85 {
86 this->data[row][col] = result.fp;
87 }

◆ set() [4/5]

template<unsigned int N, class JData_t = double>
template<class JResult_t >
void JTOOLS::JHesseMatrix< N, JData_t >::set ( unsigned int pivot,
const JResultHesse< JResult_t > & result )
inlineprivate

Recursivaly set elements.

Parameters
pivotpivot
resultHesse result

Definition at line 97 of file JHesseMatrix.hh.

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 }
JResultEvaluator< JResult_t >::result_type get_value(const JResult_t &value)
Helper method to recursively evaluate a to function value.
Definition JResult.hh:998

◆ set() [5/5]

template<unsigned int N, class JData_t = double>
template<class JResult_t >
void JTOOLS::JHesseMatrix< N, JData_t >::set ( unsigned int row,
unsigned int col,
const JResultHesse< JResult_t > & result )
inlineprivate

Recursivaly set elements.

Parameters
rowrow
colcol
resultHesse result

Definition at line 115 of file JHesseMatrix.hh.

118 {
119 this->data[row][col] = get_value(result.fp);
120
121 set(row, col + 1, result.f);
122 }

◆ getNX()

static int JTOOLS::JTable2D< NX, NY, double >::getNX ( )
inlinestaticinherited

Get number of rows.

Returns
number of rows

Definition at line 50 of file JTable2D.hh.

51 {
52 return NX;
53 }

◆ getNY()

static int JTOOLS::JTable2D< NX, NY, double >::getNY ( )
inlinestaticinherited

Get number of columns.

Returns
number of columns

Definition at line 61 of file JTable2D.hh.

62 {
63 return NY;
64 }

◆ operator[]() [1/2]

const data_type * JTOOLS::JTable2D< NX, NY, double >::operator[] ( int row) const
inlineinherited

Get row data.

Parameters
rowrow number
Returns
row data

Definition at line 73 of file JTable2D.hh.

74 {
75 return data[row];
76 };

◆ operator[]() [2/2]

data_type * JTOOLS::JTable2D< NX, NY, double >::operator[] ( int row)
inlineinherited

Get row data.

Parameters
rowrow number
Returns
row data

Definition at line 85 of file JTable2D.hh.

86 {
87 return data[row];
88 };

◆ negate()

JTable2D & JTOOLS::JTable2D< NX, NY, double >::negate ( )
inlineinherited

Negate table.

Returns
this table

Definition at line 96 of file JTable2D.hh.

97 {
98 for (int i = 0; i != NX; ++i) {
99 for (int j = 0; j != NY; ++j) {
100 data[i][j] = -data[i][j];
101 }
102 }
103
104 return *this;
105 }

◆ add()

JTable2D & JTOOLS::JTable2D< NX, NY, double >::add ( const JTable2D< N, N, double > & table)
inlineinherited

Add table.

Parameters
tabletable
Returns
this table

Definition at line 114 of file JTable2D.hh.

115 {
116 for (int i = 0; i != NX; ++i) {
117 for (int j = 0; j != NY; ++j) {
118 data[i][j] += table.data[i][j];
119 }
120 }
121
122 return *this;
123 }

◆ sub()

JTable2D & JTOOLS::JTable2D< NX, NY, double >::sub ( const JTable2D< N, N, double > & table)
inlineinherited

Subtract table.

Parameters
tabletable
Returns
this table

Definition at line 132 of file JTable2D.hh.

133 {
134 for (int i = 0; i != NX; ++i) {
135 for (int j = 0; j != NY; ++j) {
136 data[i][j] -= table.data[i][j];
137 }
138 }
139
140 return *this;
141 }

◆ mul() [1/2]

JTable2D & JTOOLS::JTable2D< NX, NY, double >::mul ( const double factor)
inlineinherited

Scale table.

Parameters
factormultiplication factor
Returns
this table

Definition at line 150 of file JTable2D.hh.

151 {
152 for (int i = 0; i != NX; ++i) {
153 for (int j = 0; j != NY; ++j) {
154 data[i][j] *= factor;
155 }
156 }
157
158 return *this;
159 }

◆ mul() [2/2]

template<class JFirst_t , class JSecond_t >
JFirst_t & JMATH::JMath< JFirst_t, JSecond_t >::mul ( const JSecond_t & object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 354 of file JMath.hh.

355 {
356 return static_cast<JFirst_t&>(*this) = JFirst_t().mul(static_cast<const JFirst_t&>(*this), object);
357 }

◆ div()

JTable2D & JTOOLS::JTable2D< NX, NY, double >::div ( const double factor)
inlineinherited

Scale table.

Parameters
factordivision factor
Returns
this table

Definition at line 168 of file JTable2D.hh.

169 {
170 for (int i = 0; i != NX; ++i) {
171 for (int j = 0; j != NY; ++j) {
172 data[i][j] /= factor;
173 }
174 }
175
176 return *this;
177 }

Member Data Documentation

◆ data

data_type JTOOLS::JTable2D< NX, NY, double >::data[NX][NY]
protectedinherited

Definition at line 219 of file JTable2D.hh.


The documentation for this struct was generated from the following file: