And here is a short document describing the major interface functions.
Sparse
derivative computation and coloring
The computation of an m-by-n sparse derivative matrix A using automatic differentiation (AD) can be made efficient by using the following four-step procedure.
The set of criteria used to define the seed matrix S in the second step, the partitioning problem on the matrix A, depends on three mutually orthogonal factors:
Table 1 below provides a summary of the most accurate coloring models for the various computational scenarios. In each case, the structure of a Jacobian matrix A is represented by the bipartite graph Gb(A) = (V1, V2, E), where the vertex sets V1 and V2 represent the rows and columns of A, respectively, and each nonzero matrix entry Aij is represented by the edge (ri , cj) in E. Analogously, the structure of a Hessian matrix A is represented by the adjacency graph G(A) = (V, E), where the vertex set V represents the columns (or, by symmetry, the rows) of A and each off-diagonal nonzero matrix entry Aij (and its symmetric counterpart Aji) is represented by the single edge (ci, cj) in E.
|
|
1d partition |
2d partition |
|
|
Jacobian |
Partial
distance-2 coloring |
Star
bicoloring |
Direct |
|
Hessian |
Star coloring |
|
Direct |
|
Jacobian |
|
Acyclic
bicoloring |
Substitution |
|
Hessian |
Acyclic
coloring |
|
Substitution |
Table 1: Overview of
coloring models in derivative computation.
In a graph G = (V, E), two distinct vertices are distance-k neighbors if a shortest path connecting them consists of at most k edges. A distance-k coloring of the graph is an assignment of positive integers (called colors) to the vertices such that every two distance-k neighboring vertices get different colors. A star coloring is a distance-1 coloring where, in addition, every path on four vertices uses at least three colors. An acyclic coloring is a distance-1 coloring in which every cycle uses at least three colors. The names star and acyclic coloring are due to the structures of two-colored induced subgraphs: a collection of stars in the case of star coloring and a collection of trees in the case of acyclic coloring.
In a bipartite graph Gb = (V1, V2, E), a partial distance-2 coloring on the vertex set Vi, i = 1,2, is an assignment of colors to the vertices in Vi such that any two vertices connected by a path of length exactly two edges receive different colors. Star and acyclic bicoloring in a bipartite graph are defined in a manner analogous to star and acyclic coloring in a general graph, but with the additional stipulation that the set of colors assigned to row vertices (V1) is disjoint from the set of colors used for column vertices (V2).
ColPack is a package comprising of implementations of
algorithms for the specialized vertex coloring problems discussed in
the previous section as well as algorithms for a variety of related
supporting tasks in derivative computation.
Table 2 below gives a quick summary of all the coloring
problems (on general and bipartite graphs) supported by ColPack.
|
General
Graph G = (V, E) |
Bipartite Graph Gb = (V1, V2, E): One-sided
Coloring |
Bipartite Graph Gb = (V1, V2, E): Bicoloring |
|
Distance-1 coloring |
Partial
distance-2 coloring on V2
|
Star
bicoloring
|
|
Distance-2 coloring |
|
|
|
Star coloring |
|
|
|
Acyclic
coloring
|
|
|
|
Restricted
star coloring
|
||
|
Triangular
coloring
|
|
|
Table
2: List of coloring problems for which implementations of algorithms
are available in ColPack. The star coloring and star bicoloring problems
have more than one algorithm implemented in ColPack.
The order in which vertices are processed in a greedy coloring algorithm determines the number of colors used by the algorithm. ColPack has implementations of various effective ordering techniques for each of the supported coloring problems. These are summarized in Table 3 below.
|
General
Graph |
Bipartite
Graph: One-sided Coloring |
Bipartite
Graph: Bicoloring |
|
Natural |
Column Natural |
Natural |
|
Largest First |
Column Largest
First |
Largest First |
|
Smallest Last |
Column
Smallest Last |
Smallest Last |
|
Incidence
Degree |
Column
Incidence Degree |
Incidence
Degree |
|
Dynamic
Largest First |
Row Natural |
Dynamic
Largest First |
|
Distance-2
Largest First |
Row Largest
First |
Selective
Largest First |
|
Distance-2 Smallest
Last |
Row Smallest
Last |
Selective
Smallest Last |
|
Distance-2
Incidence Degree |
Row Incidence
Degree |
Selective
Incidence Degree |
|
Distance-2
Dynamic Largest First |
|
|
Besides coloring and ordering capabilities, ColPack also has routines for recovering the numerical values of the entries of a derivative matrix from a compressed representation. In particular the following reconstruction routines are currently available:
Finally, as a supporting functionality, ColPack has routines for constructing bipartite graphs (for Jacobians) and adjacency graphs (for Hessians) from files specifying matrix sparsity structures in various formats, including Matrix Market, Harwell-Boeing and MeTis.
ColPack is written in an object-oriented fashion in
C++ heavily using the Standard Template Library (
Figure 1: Overview of the structure of the major classes in ColPack. A solid arrow indicates an inheritance-relationship, and a broken arrow indicates a uses-relationship.
ColPack functions that a user needs to call directly are made available via the appropriate Interface classes.
Complete Doxygen documentation of ColPack