# MatGetOrdering

Gets a reordering for a matrix to reduce fill or to improve numerical stability of LU factorization.

### Synopsis

    #include "petscmat.h"
    PetscErrorCode PETSCMAT_DLLEXPORT MatGetOrdering(Mat mat,const MatOrderingType type,IS *rperm,IS *cperm)

Collective on Mat

### Input Parameters

| mat | - the matrix
| type | - type of reordering, one of the following:

         MATORDERING_NATURAL - Natural

         MATORDERING_ND - Nested Dissection

         MATORDERING_1WD - One-way Dissection

         MATORDERING_RCM - Reverse Cuthill-McKee

         MATORDERING_QMD - Quotient Minimum Degree

### Output Parameters

| rperm | - row permutation indices
| cperm | - column permutation indices

### Options Database Key

-mat_view_ordering_draw -plots matrix nonzero structure in new ordering

### Notes

This DOES NOT actually reorder the matrix; it merely returns two index sets that define a reordering. This is usually not used directly, rather use the options PCFactorSetMatOrderingType()

The user can define additional orderings; see MatOrderingRegisterDynamic().

### Keywords

matrix, set, ordering, factorization, direct, ILU, LU,
fill, reordering, natural, Nested Dissection, One-way Dissection, Cholesky, Reverse Cuthill-McKee, Quotient Minimum Degree

### See Also

MatOrderingRegisterDynamic(), PCFactorSetMatOrderingType()

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

### Examples

src/mat/examples/tutorials/ex1.c.html