hessian.h File Reference

Introduction

Definition of the THessian type and the associated functions.

See also
THessian, hessian.c.

Definition in file hessian.h.

Data Structures

struct  THessian
 Hessian of a set of equations. More...
 

Functions

void InitHessian (TJacobian *j, THessian *h)
 Constructor. More...
 
unsigned int GetHessianNVars (THessian *h)
 Number of variables. More...
 
unsigned int GetHessianNEqs (THessian *h)
 Number of equations. More...
 
void AllocateHessianEvaluation (double ****m, THessian *h)
 Allocate space for the Hessian evaluation. More...
 
void AllocateHessianEvaluationAsVectors (unsigned int nie, double ***m, THessian *h)
 Allocates space for the Hessian evaluation. More...
 
void EvaluateHessian (double *v, double ***m, THessian *h)
 Evaluates the Hessian. More...
 
unsigned int EvaluateScalarHessian (double *v, boolean *independentEq, unsigned int neq, double **m, THessian *h)
 Evaluates an scalar Hessian. More...
 
void EvaluateHessianVector (double *x, double *v, unsigned int nie, boolean *independentEq, double **m, double *mf, THessian *h)
 Evaluates the product of the Hessian with a vector. More...
 
void EvaluateHessianVector2 (double *x, double *v, unsigned int nie, boolean *independentEq, double **m, double *mf, double *o, THessian *h)
 Evaluates the double product of the Hessian with a vector. More...
 
void FreeHessianEvaluation (double ***m, THessian *h)
 Release space for the Hessian evaluation. More...
 
void FreeHessianEvaluationAsVectors (double **m, THessian *h)
 Release space for the Hessian evaluation. More...
 
void DeleteHessian (THessian *h)
 Destructor. More...
 

Function Documentation

◆ InitHessian()

void InitHessian ( TJacobian j,
THessian h 
)

Initializes the Hessian deriving the Jacobian of a set of equations.

Parameters
jThe Jacobian
hThe resulting Hessian.

Definition at line 21 of file hessian.c.

References CacheScalarEQUInfo(), DeriveEqualityEquations(), GetJacobianColumn(), GetJacobianSize(), and NEW.

Referenced by InitDynamicSpace(), InitNHessian(), and RefineSingularPoint().

◆ GetHessianNVars()

unsigned int GetHessianNVars ( THessian h)

Number of variables in the Hessian.

Returns
Number of variables.

Definition at line 41 of file hessian.c.

◆ GetHessianNEqs()

unsigned int GetHessianNEqs ( THessian h)

Number of equations in the Hessian.

Returns
Number of equations.

Definition at line 46 of file hessian.c.

◆ AllocateHessianEvaluation()

void AllocateHessianEvaluation ( double ****  m,
THessian h 
)

Allocate space for the Hessian evaluation.

Parameters
mThe allocated space.
hThe Hessian.

Definition at line 52 of file hessian.c.

References NEW.

Referenced by RefineSingularPoint().

◆ AllocateHessianEvaluationAsVectors()

void AllocateHessianEvaluationAsVectors ( unsigned int  nie,
double ***  m,
THessian h 
)

This is allocates the space in sub-matrices, one for each equation where each submatrix (of size nvars x nvars) is stored as a vector. This format is specific to speed up the execution of EvaluateHessianVector

Parameters
nieNumber of independent equations. NO_UINT if all equations are independent.
mThe allocated space.
hThe Hessian.

Definition at line 65 of file hessian.c.

References Error(), NEW, and NO_UINT.

Referenced by EvaluateHessianVector(), EvaluateHessianVector2(), and InitDynamicSpace().

◆ EvaluateHessian()

void EvaluateHessian ( double *  v,
double ***  m,
THessian h 
)

Evaluates the Hessian for a given value of the variables.

Parameters
vThe value for the variables.
mThe matrix where to store the result (see AllocateHessianEvaluation).
hThe Hessian to evalute.

Definition at line 79 of file hessian.c.

References EvaluateEqualityEquations(), FALSE, and NEW.

Referenced by RefineSingularPoint().

◆ EvaluateScalarHessian()

unsigned int EvaluateScalarHessian ( double *  v,
boolean independentEq,
unsigned int  neq,
double **  m,
THessian h 
)

Evaluates the Hessian for a given value of the variables.

Here the Hessian is supossed to include only the scalar part of a larger system and we implicitly assume that the scalar part is always the first part of the larger system.

A Hessian with only the position scalar equations is obtained from a Jacobian including only these equations (see InitScalarPositionJacobian).

This is the similar to EvaluateHessian but the output matrix m is organized in a different way. Instead of being numEqs x numVars x numVars it is numVars x numEqs x numVars and the (numEqs x numVars) matrices are stored as vectors.

So, the matrix m IS NOT allocated with AllocateHessianEvaluationAsVectors but must be allocated by the caller

Parameters
vThe value for the variables.
independentEqThe independent equations. NULL if all equations are independent. This is a vector over all the equations in the system and we are only interested in the scalar ones (the first part).
neqRows of each matrix m[i]. This is the number of equations including both the scalar and the matrix ones.
mThe matrices where to store the result.
hThe Hessian to evalute.
Returns
The number of independent scalar equations. The size of the top part of each matrix m[] filled in this function.

Definition at line 97 of file hessian.c.

References EvaluateSubSetEqualitySparseEquations(), NEW, and RC2INDEX.

Referenced by EvaluateNHessianVector2().

◆ EvaluateHessianVector()

void EvaluateHessianVector ( double *  x,
double *  v,
unsigned int  nie,
boolean independentEq,
double **  m,
double *  mf,
THessian h 
)

Evaluates H*v. This has to be interpreted as

  • [ H[1][]*v H[2][]*v ... H[n][]*v]

were H[i][j] is the derivative of the whole set of equation with respect to variables i and j. That is, H[i][j] is a vector with as many elements as equations in the system. Then, H[i][] is a matrix of neqs x nvars elements and H[i][]*v is a vector of neqs elements. Such vectors for all variables i for a matrix of neqs x nvars elements.

Parameters
xThe point where to evaluate the Hessian.
vThe vector to use in the products. The size of this vector is the number of variables in the system.
nieNumber of independent equations. NO_UINT if all equations are independent.
independentEqThe independent equations. NULL if all equations are independent.
mThe space where to evaluate the hessian. See AllocateHessianEvaluationAsVectors. If NULL the space is allocated internally.
mfSpace for the matrix resulting from the Hessian-vector product. The size of this is neqs x nvars. If NULL, the space is allocated internally
hThe Hessian to evaluate.

Definition at line 131 of file hessian.c.

References AllocateHessianEvaluationAsVectors(), EvaluateEqualitySparseEquations(), EvaluateSubSetEqualitySparseEquations(), FreeHessianEvaluationAsVectors(), MatrixVectorProduct(), NEW, NO_UINT, and SetColumn().

Referenced by EvaluateHessianVector2().

◆ EvaluateHessianVector2()

void EvaluateHessianVector2 ( double *  x,
double *  v,
unsigned int  nie,
boolean independentEq,
double **  m,
double *  mf,
double *  o,
THessian h 
)

Evaluates H*v*v. This has to be interpreted as

  • [ H[1][]*v H[2][]*v ... H[n][]*v] *v

were H[i][j] is the derivative of the whole set of equation with respect to variables i and j. That is, H[i][j] is a vector with as many elements as equations in the system. Then, H[i][] is a matrix of neqs x nvars elements and H[i][]*v is a vector of neqs elements. Such vectors for all variables i form a matrix of neqs x nvars elements. This matrix, when multiplied by 'v' generate a vector (the output 'o') of neqs elements.

Parameters
xThe point where to evaluate the Hessian.
vThe vector to use in the products. The size of this vector is the number of variables in the system.
nieNumber of independent equations. NO_UINT if all equations are independent.
independentEqThe independent equations. NULL if all equations are independent.
mThe space where to evaluate the hessian. See AllocateHessianEvaluationAsVectors. If null the space is allocated internally.
mfSpace for the matrix resulting from the first Hessian-vector product. The size of this is neqs x nvars. If null, the space is allocated internally
oThe output vector. Must be allocated/deallocated externally. The size of this vector is number of equations in the system.
hThe Hessian to evaluate.

Definition at line 178 of file hessian.c.

References AllocateHessianEvaluationAsVectors(), EvaluateHessianVector(), FreeHessianEvaluationAsVectors(), MatrixVectorProduct(), NEW, and NO_UINT.

Referenced by ComputeAcceleration().

◆ FreeHessianEvaluation()

void FreeHessianEvaluation ( double ***  m,
THessian h 
)

Release space for the Hessian evaluation typically allocated using AllocateHessianEvaluation.

Parameters
mThe space to release.
hThe corresponding Hessian.

Definition at line 209 of file hessian.c.

Referenced by RefineSingularPoint().

◆ FreeHessianEvaluationAsVectors()

void FreeHessianEvaluationAsVectors ( double **  m,
THessian h 
)

Release space for the Hessian evaluation typically allocated using AllocateHessianEvaluationAsVectors.

Parameters
mThe space to release.
hThe corresponding Hessian.

Definition at line 222 of file hessian.c.

Referenced by DeleteDynamicSpace(), EvaluateHessianVector(), and EvaluateHessianVector2().

◆ DeleteHessian()

void DeleteHessian ( THessian h)

Release a Hessian structure.

Parameters
hThe Hessian structure to release.

Definition at line 231 of file hessian.c.

References DeleteEquations().

Referenced by DeleteAtlas(), DeleteDynamicSpace(), and DeleteNHessian().