MatSetOption

Sets a parameter option for a matrix. Some options may be specific to certain storage formats. Some options determine how values will be inserted (or added). Sorted, row-oriented input will generally assemble the fastest. The default is row-oriented, nonsorted input.

Synopsis

int MatSetOption(Mat mat,MatOption op)
Collective on Mat

Input Parameters

mat - the matrix
option - the option, one of those listed below (and possibly others), e.g., MAT_ROWS_SORTED, MAT_NEW_NONZERO_LOCATION_ERROR

Options Describing Matrix Structure

MAT_SYMMETRIC - symmetric in terms of both structure and value
MAT_STRUCTURALLY_SYMMETRIC - symmetric nonzero structure

Options For Use with MatSetValues()

Insert a logically dense subblock, which can be
MAT_ROW_ORIENTED - row-oriented
MAT_COLUMN_ORIENTED - column-oriented
MAT_ROWS_SORTED - sorted by row
MAT_ROWS_UNSORTED - not sorted by row
MAT_COLUMNS_SORTED - sorted by column
MAT_COLUMNS_UNSORTED - not sorted by column

Not these options reflect the data you pass in with MatSetValues(); it hasnothing to do with how the data is stored internally in the matrixdata structure.

When (re)assembling a matrix, we can restrict the input forefficiency/debugging purposes. These options include

MAT_NO_NEW_NONZERO_LOCATIONS - additional insertions will not be allowed if they generate a new nonzero
MAT_YES_NEW_NONZERO_LOCATIONS - additional insertions will be allowed
MAT_NO_NEW_DIAGONALS - additional insertions will not be allowed if they generate a nonzero in a new diagonal (for block diagonal format only)
MAT_YES_NEW_DIAGONALS - new diagonals will be allowed (for block diagonal format only)
MAT_IGNORE_OFF_PROC_ENTRIES - drops off-processor entries
MAT_NEW_NONZERO_LOCATION_ERROR - generates an error for new matrix entry
MAT_USE_HASH_TABLE - uses a hash table to speed up matrix assembly

Notes

Some options are relevant only for particular matrix types andare thus ignored by others. Other options are not supported bycertain matrix types and will generate an error message if set.

If using a Fortran 77 module to compute a matrix, one may need touse the column-oriented option (or convert to the row- orientedformat).

MAT_NO_NEW_NONZERO_LOCATIONS indicates that any add or insertionthat would generate a new entry in the nonzero structure is insteadignored. Thus, if memory has not alredy been allocated for this particulardata, then the insertion is ignored. For dense matrices, in whichthe entire array is allocated, no entries are ever ignored.

MAT_NEW_NONZERO_LOCATION_ERROR indicates that any add or insertionthat would generate a new entry in the nonzero structure instead producesan error. (Currently supported for AIJ and BAIJ formats only.) This is a useful flag when using SAME_NONZERO_PATTERN in callingSLESSetOperators() to ensure that the nonzero pattern truely doesremain unchanged.

MAT_NEW_NONZERO_ALLOCATION_ERROR indicates that any add or insertionthat would generate a new entry that has not been preallocated willinstead produce an error. (Currently supported for AIJ and BAIJ formatsonly.) This is a useful flag when debugging matrix memory preallocation.

MAT_IGNORE_OFF_PROC_ENTRIES indicates entries destined forother processors should be dropped, rather than stashed. This is useful if you know that the "owning" processor is alsoalways generating the correct matrix entries, so that PETSc neednot transfer duplicate entries generated on another processor. MAT_USE_HASH_TABLE indicates that a hash table be used to improve thesearches during matrix assembly. When this flag is set, the hash tableis created during the first Matrix Assembly. This hash table isused the next time through, during MatSetVaules()/MatSetVaulesBlocked() to improve the searching of indices. MAT_NO_NEW_NONZERO_LOCATIONS flagshould be used with MAT_USE_HASH_TABLE flag. This option is currentlysupported by MATMPIBAIJ format only.

Keywords

matrix, option, row-oriented, column-oriented, sorted, nonzero

Examples

src/sles/examples/tutorials/ex5.c

Examples

src/sles/examples/tutorials/ex9.c

Location: src/mat/interface/matrix.c
Matrix Index
Table of Contents