File: MatCreate.html

package info (click to toggle)
petsc 2.2.0-4
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 64,404 kB
  • ctags: 284,528
  • sloc: ansic: 223,999; python: 11,758; makefile: 7,707; fortran: 6,327; cpp: 4,104; sh: 3,387; csh: 41; asm: 6
file content (102 lines) | stat: -rw-r--r-- 8,038 bytes parent folder | download
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML3.2 EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="DOCTEXT">
<TITLE>MatCreate</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
<A NAME="MatCreate"><H1>MatCreate</H1></A>
Creates a matrix where the type is determined from either a call to <A HREF="../Mat/MatSetType.html#MatSetType">MatSetType</A>() or from the options database with a call to <A HREF="../Mat/MatSetFromOptions.html#MatSetFromOptions">MatSetFromOptions</A>(). The default matrix type is AIJ, using the routines <A HREF="../Mat/MatCreateSeqAIJ.html#MatCreateSeqAIJ">MatCreateSeqAIJ</A>() or <A HREF="../Mat/MatCreateMPIAIJ.html#MatCreateMPIAIJ">MatCreateMPIAIJ</A>() if you do not set a type in the options database. If you never call <A HREF="../Mat/MatSetType.html#MatSetType">MatSetType</A>() or <A HREF="../Mat/MatSetFromOptions.html#MatSetFromOptions">MatSetFromOptions</A>() it will generate an  error when you try to use the matrix. 
<H3><FONT COLOR="#CC3333">Synopsis</FONT></H3>
<PRE>
#include "petscmat.h"  
int MatCreate(MPI_Comm comm,int m,int n,int M,int N,Mat *A)
</PRE>
Collective on <A HREF="../Sys/MPI_Comm.html#MPI_Comm">MPI_Comm</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>m </B></TD><TD>- number of local rows (or <A HREF="../Sys/PETSC_DECIDE.html#PETSC_DECIDE">PETSC_DECIDE</A>)
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>n </B></TD><TD>- number of local columns (or <A HREF="../Sys/PETSC_DECIDE.html#PETSC_DECIDE">PETSC_DECIDE</A>)
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>M </B></TD><TD>- number of global rows (or <A HREF="../Sys/PETSC_DETERMINE.html#PETSC_DETERMINE">PETSC_DETERMINE</A>)
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>N </B></TD><TD>- number of global columns (or <A HREF="../Sys/PETSC_DETERMINE.html#PETSC_DETERMINE">PETSC_DETERMINE</A>)
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B><A HREF="../Sys/comm.html#comm">comm</A> </B></TD><TD>- MPI communicator
</TD></TR></TABLE>
<H3><FONT COLOR="#CC3333">Output Parameter</FONT></H3>
<DT><B>A </B> -the matrix
<br>
<P>
<H3><FONT COLOR="#CC3333">Options Database Keys</FONT></H3>
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-mat_type seqaij   </B></TD><TD>- AIJ type, uses <A HREF="../Mat/MatCreateSeqAIJ.html#MatCreateSeqAIJ">MatCreateSeqAIJ</A>()
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-mat_type mpiaij   </B></TD><TD>- AIJ type, uses <A HREF="../Mat/MatCreateMPIAIJ.html#MatCreateMPIAIJ">MatCreateMPIAIJ</A>()
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-mat_type seqbdiag </B></TD><TD>- block diagonal type, uses <A HREF="../Mat/MatCreateSeqBDiag.html#MatCreateSeqBDiag">MatCreateSeqBDiag</A>()
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-mat_type mpibdiag </B></TD><TD>- block diagonal type, uses <A HREF="../Mat/MatCreateMPIBDiag.html#MatCreateMPIBDiag">MatCreateMPIBDiag</A>()
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-mat_type mpirowbs </B></TD><TD>- rowbs type, uses <A HREF="../Mat/MatCreateMPIRowbs.html#MatCreateMPIRowbs">MatCreateMPIRowbs</A>()
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-mat_type seqdense </B></TD><TD>- dense type, uses <A HREF="../Mat/MatCreateSeqDense.html#MatCreateSeqDense">MatCreateSeqDense</A>()
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-mat_type mpidense </B></TD><TD>- dense type, uses <A HREF="../Mat/MatCreateMPIDense.html#MatCreateMPIDense">MatCreateMPIDense</A>()
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-mat_type seqbaij  </B></TD><TD>- block AIJ type, uses <A HREF="../Mat/MatCreateSeqBAIJ.html#MatCreateSeqBAIJ">MatCreateSeqBAIJ</A>()
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-mat_type mpibaij  </B></TD><TD>- block AIJ type, uses <A HREF="../Mat/MatCreateMPIBAIJ.html#MatCreateMPIBAIJ">MatCreateMPIBAIJ</A>()
</TD></TR></TABLE>
<P>
<H3><FONT COLOR="#CC3333">Even More Options Database Keys</FONT></H3>
See the manpages for particular formats (e.g., <A HREF="../Mat/MatCreateSeqAIJ.html#MatCreateSeqAIJ">MatCreateSeqAIJ</A>())
for additional format-specific options.
<P>
<H3><FONT COLOR="#CC3333">Notes</FONT></H3>
If <A HREF="../Sys/PETSC_DECIDE.html#PETSC_DECIDE">PETSC_DECIDE</A> is not used for the arguments 'm' and 'n', then the
user must ensure that they are chosen to be compatible with the
vectors. To do this, one first considers the matrix-vector product
'y = A x'. The 'm' that is used in the above routine must match the
local <A HREF="../Sys/size.html#size">size</A> used in the vector creation routine <A HREF="../Vec/VecCreateMPI.html#VecCreateMPI">VecCreateMPI</A>() for 'y'.
Likewise, the 'n' used must match that used as the local <A HREF="../Sys/size.html#size">size</A> in
<A HREF="../Vec/VecCreateMPI.html#VecCreateMPI">VecCreateMPI</A>() for 'x'.
<P>

<P>
<H3><FONT COLOR="#CC3333">User manual sections</FONT></H3>
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B><A HREF="../../manual.pdf#section.3.1">Section 3.1 Creating and Assembling Matrices</A></B></TD><TD>- -   <A HREF="../../manual.pdf#chapter.3">Chapter 3 Matrices</A>
</TD></TR>
<P>
<H3><FONT COLOR="#CC3333">Keywords</FONT></H3>
 matrix, create
<BR>
<P>
<H3><FONT COLOR="#CC3333">See Also</FONT></H3>
 <A HREF="../Mat/MatCreateSeqAIJ.html#MatCreateSeqAIJ">MatCreateSeqAIJ</A>((), <A HREF="../Mat/MatCreateMPIAIJ.html#MatCreateMPIAIJ">MatCreateMPIAIJ</A>(), 
<BR><A HREF="../Mat/MatCreateSeqBDiag.html#MatCreateSeqBDiag">MatCreateSeqBDiag</A>(),<A HREF="../Mat/MatCreateMPIBDiag.html#MatCreateMPIBDiag">MatCreateMPIBDiag</A>(),
<A HREF="../Mat/MatCreateSeqDense.html#MatCreateSeqDense">MatCreateSeqDense</A>(), <A HREF="../Mat/MatCreateMPIDense.html#MatCreateMPIDense">MatCreateMPIDense</A>(),
<A HREF="../Mat/MatCreateMPIRowbs.html#MatCreateMPIRowbs">MatCreateMPIRowbs</A>(), <A HREF="../Mat/MatCreateSeqBAIJ.html#MatCreateSeqBAIJ">MatCreateSeqBAIJ</A>(), <A HREF="../Mat/MatCreateMPIBAIJ.html#MatCreateMPIBAIJ">MatCreateMPIBAIJ</A>(),
<A HREF="../Mat/MatCreateSeqSBAIJ.html#MatCreateSeqSBAIJ">MatCreateSeqSBAIJ</A>(), <A HREF="../Mat/MatCreateMPISBAIJ.html#MatCreateMPISBAIJ">MatCreateMPISBAIJ</A>(),
<A HREF="../Mat/MatConvert.html#MatConvert">MatConvert</A>()
<P><B><P><B><FONT COLOR="#CC3333">Level:</FONT></B>beginner
<BR><FONT COLOR="#CC3333">Location:</FONT></B><A HREF="../../../src/mat/utils/gcreate.c.html#MatCreate">src/mat/utils/gcreate.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/ex2.c.html">src/mat/examples/tutorials/ex2.c.html</A><BR>
<A HREF="../../../src/mat/examples/tutorials/ex3.c.html">src/mat/examples/tutorials/ex3.c.html</A><BR>
<A HREF="../../../src/ksp/examples/tutorials/ex1.c.html">src/ksp/examples/tutorials/ex1.c.html</A><BR>
<A HREF="../../../src/ksp/examples/tutorials/ex2.c.html">src/ksp/examples/tutorials/ex2.c.html</A><BR>
<A HREF="../../../src/ksp/examples/tutorials/ex3.c.html">src/ksp/examples/tutorials/ex3.c.html</A><BR>
<A HREF="../../../src/ksp/examples/tutorials/ex4.c.html">src/ksp/examples/tutorials/ex4.c.html</A><BR>
<A HREF="../../../src/ksp/examples/tutorials/ex5.c.html">src/ksp/examples/tutorials/ex5.c.html</A><BR>
<A HREF="../../../src/ksp/examples/tutorials/ex7.c.html">src/ksp/examples/tutorials/ex7.c.html</A><BR>
<A HREF="../../../src/ksp/examples/tutorials/ex8.c.html">src/ksp/examples/tutorials/ex8.c.html</A><BR>
<A HREF="../../../src/ksp/examples/tutorials/ex9.c.html">src/ksp/examples/tutorials/ex9.c.html</A><BR>
<A HREF="../../../src/ksp/examples/tutorials/ex11.c.html">src/ksp/examples/tutorials/ex11.c.html</A><BR>
</BODY></HTML>