Jpp
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | List of all members
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, JData_t > JMATH::JMath< JTable2D< NX, NY, JData_t > >

Public Types

typedef JData_t data_type
 

Public Member Functions

 JHesseMatrix ()
 Default constructor. More...
 
template<class JResult_t >
 JHesseMatrix (const JResultHesse< JResult_t > &result)
 Constructor. More...
 
template<class JResult_t >
void set (const JResultHesse< JResult_t > &result)
 Set matrix according given result. More...
 
const data_typeoperator[] (int row) const
 Get row data. More...
 
data_typeoperator[] (int row)
 Get row data. More...
 
JTable2Dnegate ()
 Negate table. More...
 
JTable2Dadd (const JTable2D &table)
 Add table. More...
 
JTable2Dsub (const JTable2D &table)
 Subtract table. More...
 
JTable2Dmul (const double factor)
 Scale table. More...
 
JTable2D< NX, NY, JData_t > & mul (const JSecond_t &object)
 Multiply with object. More...
 
JTable2Ddiv (const double factor)
 Scale table. More...
 

Static Public Member Functions

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

Protected Attributes

data_type data [NX][NY]
 

Private Member Functions

void set (unsigned int pivot, const JResultHesse< JData_t > &result)
 Set final element. More...
 
void set (unsigned int row, unsigned int col, const JResultHesse< JData_t > &result)
 Set final element. More...
 
template<class JResult_t >
void set (unsigned int pivot, const JResultHesse< JResult_t > &result)
 Recursivaly set elements. More...
 
template<class JResult_t >
void set (unsigned int row, unsigned int col, const JResultHesse< JResult_t > &result)
 Recursivaly set elements. More...
 

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

typedef JData_t JTOOLS::JTable2D< NX, NY, JData_t >::data_type
inherited

Definition at line 29 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  }

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  }

◆ 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  }

◆ 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, JData_t >::getNX ( )
inlinestaticinherited

Get number of rows.

Returns
number of rows

Definition at line 49 of file JTable2D.hh.

50  {
51  return NX;
52  }

◆ getNY()

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

Get number of columns.

Returns
number of columns

Definition at line 60 of file JTable2D.hh.

61  {
62  return NY;
63  }

◆ operator[]() [1/2]

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

Get row data.

Parameters
rowrow number
Returns
row data

Definition at line 72 of file JTable2D.hh.

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

◆ operator[]() [2/2]

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

Get row data.

Parameters
rowrow number
Returns
row data

Definition at line 84 of file JTable2D.hh.

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

◆ negate()

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

Negate table.

Returns
this table

Definition at line 95 of file JTable2D.hh.

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

◆ add()

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

Add table.

Parameters
tabletable
Returns
this table

Definition at line 113 of file JTable2D.hh.

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

◆ sub()

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

Subtract table.

Parameters
tabletable
Returns
this table

Definition at line 131 of file JTable2D.hh.

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

◆ mul() [1/2]

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

Scale table.

Parameters
factormultiplication factor
Returns
this table

Definition at line 149 of file JTable2D.hh.

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

◆ mul() [2/2]

JTable2D< NX, NY, JData_t > & JMATH::JMath< JTable2D< NX, NY, JData_t > , JSecond_t >::mul ( const JSecond_t &  object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 273 of file JMath.hh.

274  {
275  return static_cast<JFirst_t&>(*this) = JCalculator<JFirst_t>::calculator.mul(static_cast<const JFirst_t&>(*this), object);
276  }

◆ div()

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

Scale table.

Parameters
factordivision factor
Returns
this table

Definition at line 167 of file JTable2D.hh.

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

Member Data Documentation

◆ data

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

Definition at line 218 of file JTable2D.hh.


The documentation for this struct was generated from the following file:
JTOOLS::JTable2D< N, N, JData_t >::data
data_type data[NX][NY]
Definition: JTable2D.hh:218
JTOOLS::j
int j
Definition: JPolint.hh:634
JTOOLS::get_value
JResultEvaluator< JResult_t >::result_type get_value(const JResult_t &value)
Helper method to recursively evaluate a to function value.
Definition: JResult.hh:936
JTOOLS::result
return result
Definition: JPolint.hh:695
JTOOLS::JHesseMatrix::set
void set(const JResultHesse< JResult_t > &result)
Set matrix according given result.
Definition: JHesseMatrix.hh:50
JMATH::JCalculator
Auxiliary class for arithmetic operations on objects.
Definition: JCalculator.hh:18