Public Member Functions

ColPack::HessianRecovery Class Reference
[Recovery Classes]

class HessianRecovery in group5. More...

#include <HessianRecovery.h>

Inherits ColPack::RecoveryCore.

Collaboration diagram for ColPack::HessianRecovery:
Collaboration graph
[legend]

List of all members.

Public Member Functions

int DirectRecover_RowCompressedFormat (GraphColoringInterface *g, double **dp2_CompressedMatrix, unsigned int **uip2_HessianSparsityPattern, double ***dp3_HessianValue)
 A routine for recovering a Hessian from a star-coloring based compressed representation.
int DirectRecover_CoordinateFormat (GraphColoringInterface *g, double **dp2_CompressedMatrix, unsigned int **uip2_HessianSparsityPattern, unsigned int **ip2_RowIndex, unsigned int **ip2_ColumnIndex, double **dp2_HessianValue)
 A routine for recovering a Hessian from a star-coloring based compressed representation.
int DirectRecover_SparseSolversFormat (GraphColoringInterface *g, double **dp2_CompressedMatrix, unsigned int **uip2_HessianSparsityPattern, unsigned int **ip2_RowIndex, unsigned int **ip2_ColumnIndex, double **dp2_HessianValue)
 A routine for recovering a Hessian from a star-coloring based compressed representation.
int IndirectRecover_RowCompressedFormat (GraphColoringInterface *g, double **dp2_CompressedMatrix, unsigned int **uip2_HessianSparsityPattern, double ***dp3_HessianValue)
 A routine for recovering a Hessian from a acyclic-coloring based compressed representation.
int IndirectRecover_CoordinateFormat (GraphColoringInterface *g, double **dp2_CompressedMatrix, unsigned int **uip2_HessianSparsityPattern, unsigned int **ip2_RowIndex, unsigned int **ip2_ColumnIndex, double **dp2_HessianValue)
 A routine for recovering a Hessian from a acyclic-coloring based compressed representation.
int IndirectRecover_SparseSolversFormat (GraphColoringInterface *g, double **dp2_CompressedMatrix, unsigned int **uip2_HessianSparsityPattern, unsigned int **ip2_RowIndex, unsigned int **ip2_ColumnIndex, double **dp2_HessianValue)
 A routine for recovering a Hessian from a acyclic-coloring based compressed representation.

Detailed Description

class HessianRecovery in group5.

Definition at line 31 of file HessianRecovery.h.


Member Function Documentation

int ColPack::HessianRecovery::DirectRecover_CoordinateFormat ( GraphColoringInterface g,
double **  dp2_CompressedMatrix,
unsigned int **  uip2_HessianSparsityPattern,
unsigned int **  ip2_RowIndex,
unsigned int **  ip2_ColumnIndex,
double **  dp2_HessianValue 
)

A routine for recovering a Hessian from a star-coloring based compressed representation.

Return by recovery routine: three vectors in "Coordinate Format" (zero-based indexing) http://www.intel.com/software/products/mkl/docs/webhelp/appendices/mkl_appA_SMSF.html#mkl_appA_SMSF_5

  • unsigned int** ip2_RowIndex
  • unsigned int** ip2_ColumnIndex
  • double** dp2_JacobianValue // corresponding non-zero values

Definition at line 199 of file HessianRecovery.cpp.

References ColPack::RecoveryCore::CF_available, ColPack::RecoveryCore::dp_CF_Value, free_2DMatrix(), ColPack::GraphColoring::GetVertexColorCount(), ColPack::GraphColoring::GetVertexColors(), ColPack::GraphCore::GetVertexCount(), ColPack::RecoveryCore::i_CF_rowCount, ColPack::RecoveryCore::ip_CF_ColumnIndex, ColPack::RecoveryCore::ip_CF_RowIndex, and ColPack::RecoveryCore::reset().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

int ColPack::HessianRecovery::DirectRecover_RowCompressedFormat ( GraphColoringInterface g,
double **  dp2_CompressedMatrix,
unsigned int **  uip2_HessianSparsityPattern,
double ***  dp3_HessianValue 
)

A routine for recovering a Hessian from a star-coloring based compressed representation.

Parameter:

  • Input:
    • *g: GraphColoringInterface object, providing the coloring information
    • dp2_CompressedMatrix: The compressed matrix that contains all computed values
    • uip2_HessianSparsityPattern.
  • Output:
    • dp3_HessianValue

Precondition:

  • Star coloring routine has been called.
  • uip2_HessianSparsityPattern: The Hessian matrix must be stored in compressed sparse rows format
  • dp3_HessianValue is just a pointer pointing to a 2D matrix (no memory allocated yet). This matrix will be created (memory will be allocated) by this routine and the pointer will be assigned to dp3_HessianValue

Postcondition:

  • dp3_HessianValue points to a 2d matrix contains the numerical values of the Hessian. Row Compressed Format is used

Return value:

  • _TRUE upon successful

About input parameters:

  • This routine doesn't need to take (star) coloring result m_vi_VertexColors of the Hessian as another paramenter because that information is known already (because of the 1st precondition). The cologin result can be retrieved from the first parameter "GraphColoringInterface* g"

Row Compressed Format for dp3_HessianValue:

  • This is a 2D matrix of doubles.
  • The first element of each row will specify the number of non-zeros in the Hessian => Value of the first element + 1 will be the length of that row.
  • The value of each element after the 1st element is the value of the non-zero in the Hessian. The value of dp3_HessianValue[col][row] is the value of element [col][uip2_HessianSparsityPattern[col][row]] in the real (uncompressed) Hessian
  • An example of compressed sparse rows format:
    • Uncompressed matrix:
      1 .5 0
      .5 2 3
      0 3 -.5
    • Corresponding uip2_HessianSparsityPattern:
      2 0 1
      3 0 1 2
      2 1 2
    • Corresponding dp3_HessianValue:
      2 1 .5
      3 .5 2 3
      2 3 -.5

Algorithm: optimized version of the algorithm in Figure 2, pg 8, "Efficient Computation of Sparse Hessians using Coloring and Automatic Differentiation" paper. The complexity of this routine is O(|E|) versus O(|E|*average distance-1 neighbour) for DirectRecover1

  • Do (column-)color statistic for each row, i.e., see how many elements in that row has color 0, color 1 ... Results are stored in map<int,int>* colorStatistic. colorStatistic[0] is (column-)color statistic for row 0 If row 0 has 5 columns with color 3 => colorStatistic[0][3] = 5;
  • Allocate memory for *dp3_HessianValue
  • (Main part) Recover the values of non-zero entries in the Hessian: For each row, for each entry, see how many entries in that row have the same color by checking colorStatistic[row][column-color of the entry]. If colorStatistic[#][#] == 1 => This entry has unique color (in this row). H[j,i] = B[j,color[hi]] else H[j,i] = B[i,color[hj]] Each non-zero value of the Hessian will be recovered from left to right, top to bottom Note: column-color of entry [row 5][column 3] is m_vi_VertexColors[column 3]

Definition at line 28 of file HessianRecovery.cpp.

References _TRUE, ColPack::RecoveryCore::AF_available, ColPack::RecoveryCore::dp2_AF_Value, free_2DMatrix(), ColPack::GraphColoring::GetVertexColorCount(), ColPack::GraphColoring::GetVertexColors(), ColPack::GraphCore::GetVertexCount(), ColPack::RecoveryCore::i_AF_rowCount, and ColPack::RecoveryCore::reset().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

int ColPack::HessianRecovery::DirectRecover_SparseSolversFormat ( GraphColoringInterface g,
double **  dp2_CompressedMatrix,
unsigned int **  uip2_HessianSparsityPattern,
unsigned int **  ip2_RowIndex,
unsigned int **  ip2_ColumnIndex,
double **  dp2_HessianValue 
)

A routine for recovering a Hessian from a star-coloring based compressed representation.

Return by recovery routine: three vectors in "Storage Formats for the Direct Sparse Solvers" (zero-based indexing) http://www.intel.com/software/products/mkl/docs/webhelp/appendices/mkl_appA_SMSF.html#mkl_appA_SMSF_1

  • unsigned int** ip2_RowIndex
  • unsigned int** ip2_ColumnIndex
  • double** dp2_JacobianValue // corresponding non-zero values

NOTE: Since we are returning a symmetric matrix, according to format, only the upper triangle are stored.

Definition at line 102 of file HessianRecovery.cpp.

References _TRUE, ColPack::RecoveryCore::dp_SSF_Value, free_2DMatrix(), ColPack::GraphColoring::GetVertexColorCount(), ColPack::GraphColoring::GetVertexColors(), ColPack::GraphCore::GetVertexCount(), ColPack::RecoveryCore::i_SSF_rowCount, ColPack::RecoveryCore::ip_SSF_ColumnIndex, ColPack::RecoveryCore::ip_SSF_RowIndex, Pause(), ColPack::RecoveryCore::reset(), RowCompressedFormat_2_SparseSolversFormat_StructureOnly(), and ColPack::RecoveryCore::SSF_available.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

int ColPack::HessianRecovery::IndirectRecover_CoordinateFormat ( GraphColoringInterface g,
double **  dp2_CompressedMatrix,
unsigned int **  uip2_HessianSparsityPattern,
unsigned int **  ip2_RowIndex,
unsigned int **  ip2_ColumnIndex,
double **  dp2_HessianValue 
)

A routine for recovering a Hessian from a acyclic-coloring based compressed representation.

Return by recovery routine: three vectors in "Coordinate Format" (zero-based indexing) http://www.intel.com/software/products/mkl/docs/webhelp/appendices/mkl_appA_SMSF.html#mkl_appA_SMSF_5

  • unsigned int** ip2_RowIndex
  • unsigned int** ip2_ColumnIndex
  • double** dp2_JacobianValue // corresponding non-zero values

Definition at line 982 of file HessianRecovery.cpp.

References _FALSE, _TRUE, _UNKNOWN, ColPack::RecoveryCore::CF_available, ColPack::RecoveryCore::dp_CF_Value, ColPack::DisjointSets::FindAndCompress(), ColPack::GraphCore::GetDisjointSets(), ColPack::GraphCore::GetEdges(), ColPack::GraphCore::GetMaximumVertexDegree(), ColPack::GraphColoring::GetVertexColors(), ColPack::GraphCore::GetVertexCount(), ColPack::GraphCore::GetVertexEdgeMap(), ColPack::GraphCore::GetVertices(), ColPack::RecoveryCore::i_CF_rowCount, ColPack::RecoveryCore::ip_CF_ColumnIndex, ColPack::RecoveryCore::ip_CF_RowIndex, ColPack::RecoveryCore::reset(), STEP_DOWN, and STEP_UP.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

int ColPack::HessianRecovery::IndirectRecover_RowCompressedFormat ( GraphColoringInterface g,
double **  dp2_CompressedMatrix,
unsigned int **  uip2_HessianSparsityPattern,
double ***  dp3_HessianValue 
)

A routine for recovering a Hessian from a acyclic-coloring based compressed representation.

Parameter:

  • Input:
    • *g: GraphColoringInterface object, providing the coloring information
    • dp2_CompressedMatrix: The compressed matrix that contains all computed values
    • uip2_HessianSparsityPattern.
  • Output:
    • dp3_HessianValue

Precondition:

  • Acyclic coloring routine has been called.
  • uip2_HessianSparsityPattern: The Hessian matrix must be stored in compressed sparse rows format
  • dp3_HessianValue is just a pointer pointing to a 2D matrix (no memory allocated yet). This matrix will be created (memory will be allocated) by IndirectRecover2() and the pointer will be assigned to dp3_HessianValue

Postcondition:

  • dp3_HessianValue points to a 2d matrix contains the numerical values of the Hessian. Row Compressed Format is used

Return value:

  • _TRUE upon successful

About input parameters:

  • This routine doesn't need to take (acyclic) coloring result m_vi_VertexColors of the Hessian as another paramenter because that information is known already (because of the 1st precondition).

Row Compressed Format for dp3_HessianValue: see DirectRecover2()

Algorithm: created by Assefaw, 1st implemented by Arijit Tarafdar. This function is just a modification of Arijit's implementation

Definition at line 282 of file HessianRecovery.cpp.

References _FALSE, _TRUE, _UNKNOWN, ColPack::RecoveryCore::AF_available, ColPack::RecoveryCore::dp2_AF_Value, ColPack::DisjointSets::FindAndCompress(), ColPack::GraphCore::GetDisjointSets(), ColPack::GraphCore::GetEdges(), ColPack::GraphCore::GetMaximumVertexDegree(), ColPack::GraphColoring::GetVertexColors(), ColPack::GraphCore::GetVertexCount(), ColPack::GraphCore::GetVertexEdgeMap(), ColPack::GraphCore::GetVertices(), ColPack::RecoveryCore::i_AF_rowCount, ColPack::RecoveryCore::reset(), STEP_DOWN, and STEP_UP.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

int ColPack::HessianRecovery::IndirectRecover_SparseSolversFormat ( GraphColoringInterface g,
double **  dp2_CompressedMatrix,
unsigned int **  uip2_HessianSparsityPattern,
unsigned int **  ip2_RowIndex,
unsigned int **  ip2_ColumnIndex,
double **  dp2_HessianValue 
)

A routine for recovering a Hessian from a acyclic-coloring based compressed representation.

Return by recovery routine: three vectors in "Storage Formats for the Direct Sparse Solvers" (zero-based indexing) http://www.intel.com/software/products/mkl/docs/webhelp/appendices/mkl_appA_SMSF.html#mkl_appA_SMSF_1

  • unsigned int** ip2_RowIndex
  • unsigned int** ip2_ColumnIndex
  • double** dp2_JacobianValue // corresponding non-zero values

NOTE: Since we are returning a symmetric matrix, according to format, only the upper triangle are stored.

Definition at line 625 of file HessianRecovery.cpp.

References _FALSE, _TRUE, _UNKNOWN, ColPack::RecoveryCore::dp_SSF_Value, ColPack::DisjointSets::FindAndCompress(), ColPack::GraphCore::GetDisjointSets(), ColPack::GraphCore::GetEdges(), ColPack::GraphCore::GetMaximumVertexDegree(), ColPack::GraphColoring::GetVertexColors(), ColPack::GraphCore::GetVertexCount(), ColPack::GraphCore::GetVertexEdgeMap(), ColPack::GraphCore::GetVertices(), ColPack::RecoveryCore::i_SSF_rowCount, ColPack::RecoveryCore::ip_SSF_ColumnIndex, ColPack::RecoveryCore::ip_SSF_RowIndex, Pause(), ColPack::RecoveryCore::reset(), RowCompressedFormat_2_SparseSolversFormat_StructureOnly(), ColPack::RecoveryCore::SSF_available, STEP_DOWN, and STEP_UP.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function: