petsc-3.3-p7 2013-05-11

MatGetColoring

Gets a coloring for a matrix, from its sparsity structure, to reduce the number of function evaluations needed to compute a sparse Jacobian via differencing.

Synopsis

PetscErrorCode  MatGetColoring(Mat mat,const MatColoringType type,ISColoring *iscoloring)
Collective on Mat

Input Parameters

mat -the matrix
type -type of coloring, one of the following:
     MATCOLORINGNATURAL - natural (one color for each column, very slow)
     MATCOLORINGSL - smallest-last
     MATCOLORINGLF - largest-first
     MATCOLORINGID - incidence-degree

Output Parameters

iscoloring -the coloring

Options Database Keys

To specify the coloring through the options database, use one of the following
   -mat_coloring_type natural, -mat_coloring_type sl, -mat_coloring_type lf,
   -mat_coloring_type id
To see the coloring use
   -mat_coloring_view

Notes

   A graph coloring C(A)  is a division of vertices  so that two vertices of the same color do not share any common edges.
   A suitable coloring for a  smoother  is simply C(A).
   A suitable coloring for efficient Jacobian computation is a division of the columns so that two columns of the same color do not share any common rows. 
        This corresponds to C(A^{T} A).  This is what MatGetColoring() computes.

The user can define additional colorings; see MatColoringRegisterDynamic().

For parallel matrices currently converts to sequential matrix and uses the sequential coloring on that.

The colorings SL, LF, and ID are obtained via the Minpack software that was converted to C using f2c.

For BAIJ matrices this colors the blocks. The true number of colors would be block size times the number of colors returned here.

References

    Thomas F. Coleman and Jorge J. More, Estimation of Sparse {J}acobian Matrices and Graph Coloring Problems,
        SIAM Journal on Numerical Analysis, 1983, pages 187-209, volume 20
    Jorge J. Mor\'{e} and Danny C. Sorenson and  Burton S. Garbow and Kenneth E. Hillstrom, The {MINPACK} Project,
        Sources and Development of Mathematical Software, Wayne R. Cowell editor, 1984, pages 88-111

Keywords

matrix, get, coloring

See Also

MatGetColoringTypeFromOptions(), MatColoringRegisterDynamic(), MatFDColoringCreate(),
SNESDefaultComputeJacobianColor()

Level:intermediate
Location:
src/mat/color/color.c
Index of all MatOrderings routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/mat/examples/tutorials/ex16.c.html
src/snes/examples/tutorials/ex45.c.html