#include "petscmat.h" PetscErrorCode MatSetOption(Mat mat,MatOption op,PetscBool flg)Logically Collective on Mat

mat | - the matrix | |

option | - the option, one of those listed below (and possibly others), | |

flg | - turn the option on (PETSC_TRUE) or off (PETSC_FALSE) |

MAT_SPD | - symmetric positive definite | |

MAT_SYMMETRIC | - symmetric in terms of both structure and value |

Note these options reflect the data you pass in with MatSetValues(); it has nothing to do with how the data is stored internally in the matrix data structure.

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

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

MAT_NEW_NONZERO_LOCATIONS set to PETSC_FALSE indicates that any add or insertion that would generate a new entry in the nonzero structure is instead ignored. Thus, if memory has not alredy been allocated for this particular data, then the insertion is ignored. For dense matrices, in which the entire array is allocated, no entries are ever ignored. Set after the first MatAssemblyEnd()

MAT_NEW_NONZERO_LOCATION_ERR indicates that any add or insertion that would generate a new entry in the nonzero structure instead produces an error. (Currently supported for AIJ and BAIJ formats only.) This is a useful flag when using SAME_NONZERO_PATTERN in calling KSPSetOperators() to ensure that the nonzero pattern truely does remain unchanged. Set after the first MatAssemblyEnd()

MAT_NEW_NONZERO_ALLOCATION_ERR indicates that any add or insertion that would generate a new entry that has not been preallocated will instead produce an error. (Currently supported for AIJ and BAIJ formats only.) This is a useful flag when debugging matrix memory preallocation.

MAT_IGNORE_OFF_PROC_ENTRIES indicates entries destined for other processors should be dropped, rather than stashed. This is useful if you know that the "owning" processor is also always generating the correct matrix entries, so that PETSc need not transfer duplicate entries generated on another processor.

MAT_USE_HASH_TABLE indicates that a hash table be used to improve the searches during matrix assembly. When this flag is set, the hash table is created during the first Matrix Assembly. This hash table is used the next time through, during MatSetVaules()/MatSetVaulesBlocked() to improve the searching of indices. MAT_NEW_NONZERO_LOCATIONS flag should be used with MAT_USE_HASH_TABLE flag. This option is currently supported by MATMPIBAIJ format only.

MAT_KEEP_NONZERO_PATTERN indicates when MatZeroRows() is called the zeroed entries are kept in the nonzero structure

MAT_IGNORE_ZERO_ENTRIES - for AIJ/IS matrices this will stop zero values from creating a zero location in the matrix

MAT_USE_INODES - indicates using inode version of the code - works with AIJ and ROWBS matrix types

MAT_NO_OFF_PROC_ZERO_ROWS - you know each process will only zero its own rows. This avoids all reductions in the zero row routines and thus improves performance for very large process counts.

MAT_IGNORE_LOWER_TRIANGULAR - For SBAIJ matrices will ignore any insertions you make in the lower triangular part of the matrix (since they should match the upper triangular part).

Notes: Can only be called after MatSetSizes() and MatSetType() have been set.

** Level:intermediate
Location:**src/mat/interface/matrix.c

Index of all Mat routines

Table of Contents for all manual pages

Index of all manual pages

src/ksp/ksp/examples/tutorials/ex2.c.html

src/ksp/ksp/examples/tutorials/ex5.c.html

src/ksp/ksp/examples/tutorials/ex9.c.html

src/ksp/ksp/examples/tutorials/ex10.c.html

src/ksp/ksp/examples/tutorials/ex31.c.html

src/ksp/ksp/examples/tutorials/ex52.c.html

src/snes/examples/tutorials/ex4.c.html

src/snes/examples/tutorials/ex5.c.html

src/snes/examples/tutorials/ex7.c.html

src/snes/examples/tutorials/ex8.c.html

MAT_NEW_NONZERO_LOCATIONS | - additional insertions will be allowed if they generate a new nonzero | |

MAT_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_ERR | - generates an error for new matrix entry | |

MAT_USE_HASH_TABLE | - uses a hash table to speed up matrix assembly + MAT_NO_OFF_PROC_ENTRIES - you know each process will only set values for its own rows, will generate an error if any process sets values for another process. This avoids all reductions in the MatAssembly routines and thus improves performance for very large process counts. |