CppAD: A C++ Algorithmic Differentiation Package  20171217
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
template<class VectorSet >
void CppAD::local::color_symmetric_colpack ( const VectorSet &  pattern,
CppAD::vector< size_t > &  row,
CppAD::vector< size_t > &  col,
CppAD::vector< size_t > &  color 

Colpack algorithm for determining which rows of a symmetric sparse matrix can be computed together.

Template Parameters
VectorSizeis a simple vector class with elements of type size_t.
VectorSetis a vector_of_sets class.
pattern[in] Is a representation of the sparsity pattern for the matrix.
row[in/out] is a vector specifying which row indices to compute.
col[in/out] is a vector, with the same size as row, that specifies which column indices to compute.

Input: For each valid index k, the index pair (row[k], col[k]) must be present in the sparsity pattern. It may be that some entries in the sparsity pattern do not need to be computed; i.e, do not appear in the set of (row[k], col[k]) entries.

Output: On output, some of row and column indices may have been swapped
std::swap( row[k], col[k] )
So the the the color for row[k] can be used to compute entry (row[k], col[k]).
color[out] is a vector with size m. The input value of its elements does not matter. Upon return, it is a coloring for the rows of the sparse matrix. Note that if color[i] == m, then there is no index k for which row[k] == i (for the return value of row).

Fix any (i, j) in the sparsity pattern. Suppose that there is a row index i1 with i1 != i, color[i1] == color[i] and (i1, j) is in the sparsity pattern. If follows that for all j1 with j1 != j and color[j1] == color[j], (j1, i ) is not in the sparsity pattern.

This routine tries to minimize, with respect to the choice of colors, the maximum, with respect to k, of color[ row[k] ].

Definition at line 225 of file color_symmetric.hpp.

Referenced by CppAD::ADFun< Base >::sparse_hes(), and CppAD::ADFun< Base >::SparseHessianCompute().