1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML3.2 EN">
<HTML>
<HEAD> <link rel="canonical" href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatSetOption.html" />
<META NAME="GENERATOR" CONTENT="DOCTEXT">
<TITLE>MatSetOption</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
<div id="version" align=right><b>petsc-3.7.5 2017-01-01</b></div>
<div id="bugreport" align=right><a href="mailto:petsc-maint@mcs.anl.gov?subject=Typo or Error in Documentation &body=Please describe the typo or error in the documentation: petsc-3.7.5 v3.7.5 docs/manualpages/Mat/MatSetOption.html "><small>Report Typos and Errors</small></a></div>
<A NAME="MatSetOption"><H1>MatSetOption</H1></A>
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.
<H3><FONT COLOR="#CC3333">Synopsis</FONT></H3>
<PRE>
#include "petscmat.h"
PetscErrorCode MatSetOption(Mat mat,MatOption op,PetscBool flg)
</PRE>
Logically Collective on <A HREF="../Mat/Mat.html#Mat">Mat</A> for certain operations, such as MAT_SPD, not collective for MAT_ROW_ORIENTED, see <A HREF="../Mat/MatOption.html#MatOption">MatOption</A>
<P>
<H3><FONT COLOR="#CC3333">Input Parameters</FONT></H3>
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>mat </B></TD><TD>- the matrix
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>option </B></TD><TD>- the option, one of those listed below (and possibly others),
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>flg </B></TD><TD>- turn the option on (<A HREF="../Sys/PETSC_TRUE.html#PETSC_TRUE">PETSC_TRUE</A>) or off (<A HREF="../Sys/PETSC_FALSE.html#PETSC_FALSE">PETSC_FALSE</A>)
</TD></TR></TABLE>
<P>
<H3><FONT COLOR="#CC3333">Options Describing Matrix Structure</FONT></H3>
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>MAT_SPD </B></TD><TD>- symmetric positive definite
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>MAT_SYMMETRIC </B></TD><TD>- symmetric in terms of both structure and value
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>MAT_HERMITIAN </B></TD><TD>- transpose is the complex conjugation
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>MAT_STRUCTURALLY_SYMMETRIC </B></TD><TD>- symmetric nonzero structure
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>MAT_SYMMETRY_ETERNAL </B></TD><TD>- if you would like the symmetry/Hermitian flag
you set to be kept with all future use of the matrix
including after <A HREF="../Mat/MatAssemblyBegin.html#MatAssemblyBegin">MatAssemblyBegin</A>/End() which could
potentially change the symmetry structure, i.e. you
KNOW the matrix will ALWAYS have the property you set.
</TD></TR></TABLE>
<P>
<P>
<H3><FONT COLOR="#CC3333">Options For Use with MatSetValues()</FONT></H3>
Insert a logically dense subblock, which can be
<DT><B>MAT_ROW_ORIENTED </B> -row-oriented (default)
<br>
<P>
Note these options reflect the data you pass in with <A HREF="../Mat/MatSetValues.html#MatSetValues">MatSetValues</A>(); it has
nothing to do with how the data is stored internally in the matrix
data structure.
<P>
When (re)assembling a matrix, we can restrict the input for
<H3><FONT COLOR="#CC3333">efficiency/debugging purposes. These options include</FONT></H3>
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>MAT_NEW_NONZERO_LOCATIONS </B></TD><TD>- additional insertions will be allowed if they generate a new nonzero (slow)
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>MAT_NEW_DIAGONALS </B></TD><TD>- new diagonals will be allowed (for block diagonal format only)
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>MAT_IGNORE_OFF_PROC_ENTRIES </B></TD><TD>- drops off-processor entries
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>MAT_NEW_NONZERO_LOCATION_ERR </B></TD><TD>- generates an error for new matrix entry
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>MAT_USE_HASH_TABLE </B></TD><TD>- uses a hash table to speed up matrix assembly
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>MAT_NO_OFF_PROC_ENTRIES </B></TD><TD>- 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.
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>MAT_SUBSET_OFF_PROC_ENTRIES </B></TD><TD>- you know that the first assembly after setting this flag will set a superset
of the off-process entries required for all subsequent assemblies. This avoids a rendezvous step in the MatAssembly
functions, instead sending only neighbor messages.
</TD></TR></TABLE>
<P>
<H3><FONT COLOR="#CC3333">Notes</FONT></H3>
Except for MAT_UNUSED_NONZERO_LOCATION_ERR and MAT_ROW_ORIENTED all processes that share the matrix must pass the same value in flg!
<P>
Some options are relevant only for particular matrix types and
are thus ignored by others. Other options are not supported by
certain matrix types and will generate an error message if set.
<P>
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).
<P>
MAT_NEW_NONZERO_LOCATIONS set to <A HREF="../Sys/PETSC_FALSE.html#PETSC_FALSE">PETSC_FALSE</A> 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 <A HREF="../Mat/MatAssemblyEnd.html#MatAssemblyEnd">MatAssemblyEnd</A>(). If this option is set then the <A HREF="../Mat/MatAssemblyBegin.html#MatAssemblyBegin">MatAssemblyBegin</A>/End() processes has one less global reduction
<P>
MAT_NEW_NONZERO_LOCATION_ERR set to <A HREF="../Sys/PETSC_TRUE.html#PETSC_TRUE">PETSC_TRUE</A> 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.) If this option is set then the <A HREF="../Mat/MatAssemblyBegin.html#MatAssemblyBegin">MatAssemblyBegin</A>/End() processes has one less global reduction
<P>
MAT_NEW_NONZERO_ALLOCATION_ERR set to <A HREF="../Sys/PETSC_TRUE.html#PETSC_TRUE">PETSC_TRUE</A> 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.
If this option is set then the <A HREF="../Mat/MatAssemblyBegin.html#MatAssemblyBegin">MatAssemblyBegin</A>/End() processes has one less global reduction
<P>
MAT_IGNORE_OFF_PROC_ENTRIES set to <A HREF="../Sys/PETSC_TRUE.html#PETSC_TRUE">PETSC_TRUE</A> 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.
<P>
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 <A HREF="../Mat/MATMPIBAIJ.html#MATMPIBAIJ">MATMPIBAIJ</A> format only.
<P>
MAT_KEEP_NONZERO_PATTERN indicates when <A HREF="../Mat/MatZeroRows.html#MatZeroRows">MatZeroRows</A>() is called the zeroed entries
are kept in the nonzero structure
<P>
MAT_IGNORE_ZERO_ENTRIES - for AIJ/<A HREF="../IS/IS.html#IS">IS</A> matrices this will stop zero values from creating
a zero location in the matrix
<P>
MAT_USE_INODES - indicates using inode version of the code - works with AIJ matrix types
<P>
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.
<P>
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).
<P>
Notes: Can only be called after <A HREF="../Mat/MatSetSizes.html#MatSetSizes">MatSetSizes</A>() and <A HREF="../Mat/MatSetType.html#MatSetType">MatSetType</A>() have been set.
<P>
<P>
<P>
<H3><FONT COLOR="#CC3333">See Also</FONT></H3>
<A HREF="../Mat/MatOption.html#MatOption">MatOption</A>, <A HREF="../Mat/Mat.html#Mat">Mat</A>
<BR>
<P>
<P><B><P><B><FONT COLOR="#CC3333">Level:</FONT></B>intermediate
<BR><FONT COLOR="#CC3333">Location:</FONT></B><A HREF="../../../src/mat/interface/matrix.c.html#MatSetOption">src/mat/interface/matrix.c</A>
<BR><A HREF="./index.html">Index of all Mat routines</A>
<BR><A HREF="../../index.html">Table of Contents for all manual pages</A>
<BR><A HREF="../singleindex.html">Index of all manual pages</A>
<P><H3><FONT COLOR="#CC3333">Examples</FONT></H3>
<A HREF="../../../src/mat/examples/tutorials/ex12.c.html">src/mat/examples/tutorials/ex12.c.html</A><BR>
<A HREF="../../../src/mat/examples/tutorials/ex16.c.html">src/mat/examples/tutorials/ex16.c.html</A><BR>
<A HREF="../../../src/ksp/ksp/examples/tutorials/ex2.c.html">src/ksp/ksp/examples/tutorials/ex2.c.html</A><BR>
<A HREF="../../../src/ksp/ksp/examples/tutorials/ex5.c.html">src/ksp/ksp/examples/tutorials/ex5.c.html</A><BR>
<A HREF="../../../src/ksp/ksp/examples/tutorials/ex9.c.html">src/ksp/ksp/examples/tutorials/ex9.c.html</A><BR>
<A HREF="../../../src/ksp/ksp/examples/tutorials/ex10.c.html">src/ksp/ksp/examples/tutorials/ex10.c.html</A><BR>
<A HREF="../../../src/ksp/ksp/examples/tutorials/ex18.c.html">src/ksp/ksp/examples/tutorials/ex18.c.html</A><BR>
<A HREF="../../../src/ksp/ksp/examples/tutorials/ex31.c.html">src/ksp/ksp/examples/tutorials/ex31.c.html</A><BR>
<A HREF="../../../src/ksp/ksp/examples/tutorials/ex52.c.html">src/ksp/ksp/examples/tutorials/ex52.c.html</A><BR>
<A HREF="../../../src/snes/examples/tutorials/ex5.c.html">src/snes/examples/tutorials/ex5.c.html</A><BR>
<A HREF="../../../src/snes/examples/tutorials/ex7.c.html">src/snes/examples/tutorials/ex7.c.html</A><BR>
</BODY></HTML>
|