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

Determine which rows of a general sparse matrix can be computed together; i.e., do not have non-zero entries with the same column index.

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

If for some i, color[i] == m, then the i-th row does not appear in the vector row. Otherwise, color[i] < m.

Suppose two differen rows, i != r have the same color and column index j is such that both of the pairs (i, j) and (r, j) appear in the sparsity pattern. It follows that neither of these pairs appear in the set of (row[k], col[k]) entries.

This routine tries to minimize, with respect to the choice of colors, the maximum, with respct to k, of color[ row[k] ] (not counting the indices k for which row[k] == m).

Definition at line 72 of file color_general.hpp.

Referenced by CppAD::ADFun< Base >::sparse_hes(), CppAD::ADFun< Base >::sparse_jac_for(), CppAD::ADFun< Base >::sparse_jac_rev(), CppAD::ADFun< Base >::SparseHessianCompute(), CppAD::ADFun< Base >::SparseJacobianFor(), and CppAD::ADFun< Base >::SparseJacobianRev().