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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML3.2 EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="DOCTEXT">
<TITLE>MatGetSubMatrix</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
<A NAME="MatGetSubMatrix"><H1>MatGetSubMatrix</H1></A>
Gets a single submatrix on the same number of processors as the original matrix.
<H3><FONT COLOR="#CC3333">Synopsis</FONT></H3>
<PRE>
#include "petscmat.h"
PetscErrorCode MatGetSubMatrix(Mat mat,IS isrow,IS iscol,PetscInt csize,MatReuse cll,Mat *newmat)
</PRE>
Collective on <A HREF="../Mat/Mat.html#Mat">Mat</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 original matrix
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>isrow </B></TD><TD>- rows this processor should obtain
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>iscol </B></TD><TD>- columns for all processors you wish to keep
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>csize </B></TD><TD>- number of columns "local" to this processor (does nothing for sequential
matrices). This should match the result from <A HREF="../Vec/VecGetLocalSize.html#VecGetLocalSize">VecGetLocalSize</A>(x,...) if you
plan to use the matrix in a A*x; alternatively, you can use <A HREF="../Sys/PETSC_DECIDE.html#PETSC_DECIDE">PETSC_DECIDE</A>
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>cll </B></TD><TD>- either MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX
</TD></TR></TABLE>
<P>
<H3><FONT COLOR="#CC3333">Output Parameter</FONT></H3>
<DT><B>newmat </B> -the new submatrix, of the same type as the old
<br>
<P>
<P>
Notes: the iscol argument MUST be the same on each processor. You might be
able to create the iscol argument with <A HREF="../IS/ISAllGather.html#ISAllGather">ISAllGather</A>().
<P>
The first time this is called you should use a cll of MAT_INITIAL_MATRIX,
the <A HREF="../Mat/MatGetSubMatrix.html#MatGetSubMatrix">MatGetSubMatrix</A>() routine will create the newmat for you. Any additional calls
to this routine with a mat of the same nonzero structure and with a cll of MAT_REUSE_MATRIX
will reuse the matrix generated the first time.
<P>
<P>
<H3><FONT COLOR="#CC3333">See Also</FONT></H3>
<A HREF="../Mat/MatGetSubMatrices.html#MatGetSubMatrices">MatGetSubMatrices</A>(), <A HREF="../IS/ISAllGather.html#ISAllGather">ISAllGather</A>()
<BR><P><B><P><B><FONT COLOR="#CC3333">Level:</FONT></B>advanced
<BR><FONT COLOR="#CC3333">Location:</FONT></B><A HREF="../../../src/mat/interface/matrix.c.html#MatGetSubMatrix">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/ksp/ksp/examples/tutorials/ex10.c.html">src/ksp/ksp/examples/tutorials/ex10.c.html</A><BR>
</BODY></HTML>
|