File: MatLoad.html

package info (click to toggle)
petsc 3.7.5%2Bdfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 163,864 kB
  • ctags: 618,438
  • sloc: ansic: 515,133; python: 29,793; makefile: 20,458; fortran: 18,998; cpp: 6,515; f90: 3,914; sh: 1,012; xml: 621; objc: 445; csh: 240; java: 13
file content (114 lines) | stat: -rw-r--r-- 6,668 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
103
104
105
106
107
108
109
110
111
112
113
114
<!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/MatLoad.html" />
<META NAME="GENERATOR" CONTENT="DOCTEXT">
<TITLE>MatLoad</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/MatLoad.html "><small>Report Typos and Errors</small></a></div>
<A NAME="MatLoad"><H1>MatLoad</H1></A>
Loads a matrix that has been stored in binary format with <A HREF="../Mat/MatView.html#MatView">MatView</A>().  The matrix format is determined from the options database. Generates a parallel MPI matrix if the communicator has more than one processor.  The default matrix type is AIJ. 
<H3><FONT COLOR="#CC3333">Synopsis</FONT></H3>
<PRE>
#include "petscmat.h" 
PetscErrorCode MatLoad(Mat newmat,PetscViewer viewer)
</PRE>
Collective on <A HREF="../Viewer/PetscViewer.html#PetscViewer">PetscViewer</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>newmat </B></TD><TD>- the newly loaded matrix, this needs to have been created with <A HREF="../Mat/MatCreate.html#MatCreate">MatCreate</A>()
or some related function before a call to <A HREF="../Mat/MatLoad.html#MatLoad">MatLoad</A>()
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>viewer </B></TD><TD>- binary file viewer, created with <A HREF="../Viewer/PetscViewerBinaryOpen.html#PetscViewerBinaryOpen">PetscViewerBinaryOpen</A>()
</TD></TR></TABLE>
<P>
<H3><FONT COLOR="#CC3333">Options Database Keys</FONT></H3>
Used with block matrix formats (<A HREF="../Mat/MATSEQBAIJ.html#MATSEQBAIJ">MATSEQBAIJ</A>,  ...) to specify
block size
<DT><B>-matload_block_size &lt;bs&gt;</B> -

<br>
<P>
<H3><FONT COLOR="#CC3333">Notes</FONT></H3>
If the <A HREF="../Mat/Mat.html#Mat">Mat</A> type has not yet been given then <A HREF="../Mat/MATAIJ.html#MATAIJ">MATAIJ</A> is used, call <A HREF="../Mat/MatSetFromOptions.html#MatSetFromOptions">MatSetFromOptions</A>() on the
<A HREF="../Mat/Mat.html#Mat">Mat</A> before calling this routine if you wish to set it from the options database.
<P>
<A HREF="../Mat/MatLoad.html#MatLoad">MatLoad</A>() automatically loads into the options database any options
given in the file filename.info where filename is the name of the file
that was passed to the <A HREF="../Viewer/PetscViewerBinaryOpen.html#PetscViewerBinaryOpen">PetscViewerBinaryOpen</A>(). The options in the info
file will be ignored if you use the -viewer_binary_skip_info option.
<P>
If the type or size of newmat is not set before a call to <A HREF="../Mat/MatLoad.html#MatLoad">MatLoad</A>, PETSc
sets the default matrix type AIJ and sets the local and global sizes.
If type and/or size is already set, then the same are used.
<P>
In parallel, each processor can load a subset of rows (or the
entire matrix).  This routine is especially useful when a large
matrix is stored on disk and only part of it is desired on each
processor.  For example, a parallel solver may access only some of
the rows from each processor.  The algorithm used here reads
relatively small blocks of data rather than reading the entire
matrix and then subsetting it.
<P>
<H3><FONT COLOR="#CC3333">Notes for advanced users</FONT></H3>
Most users should not need to know the details of the binary storage
format, since <A HREF="../Mat/MatLoad.html#MatLoad">MatLoad</A>() and <A HREF="../Mat/MatView.html#MatView">MatView</A>() completely hide these details.
But for anyone who's interested, the standard binary matrix storage
format is
<P>
<pre>
   int    MAT_FILE_CLASSID
</pre>
<pre>
   int    number of rows
</pre>
<pre>
   int    number of columns
</pre>
<pre>
   int    total number of nonzeros
</pre>
<pre>
   int    *number nonzeros in each row
</pre>
<pre>
   int    *column indices of all nonzeros (starting index is zero)
</pre>
<pre>
   <A HREF="../Sys/PetscScalar.html#PetscScalar">PetscScalar</A> *values of all nonzeros
</pre>
<P>
PETSc automatically does the byte swapping for
machines that store the bytes reversed, e.g.  DEC alpha, freebsd,
linux, Windows and the paragon; thus if you write your own binary
read/write routines you have to swap the bytes; see <A HREF="../Sys/PetscBinaryRead.html#PetscBinaryRead">PetscBinaryRead</A>()
and <A HREF="../Sys/PetscBinaryWrite.html#PetscBinaryWrite">PetscBinaryWrite</A>() to see how this may be done.
<P>
<H3><FONT COLOR="#CC3333">Keywords</FONT></H3>
 matrix, load, binary, input
<BR>
<P>
<H3><FONT COLOR="#CC3333">See Also</FONT></H3>
 <A HREF="../Viewer/PetscViewerBinaryOpen.html#PetscViewerBinaryOpen">PetscViewerBinaryOpen</A>(), <A HREF="../Mat/MatView.html#MatView">MatView</A>(), <A HREF="../Vec/VecLoad.html#VecLoad">VecLoad</A>()
<BR>
<P>
<P><B><P><B><FONT COLOR="#CC3333">Level:</FONT></B>beginner
<BR><FONT COLOR="#CC3333">Location:</FONT></B><A HREF="../../../src/mat/interface/matrix.c.html#MatLoad">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/vec/vec/examples/tutorials/ex6.c.html">src/vec/vec/examples/tutorials/ex6.c.html</A><BR>
<A HREF="../../../src/mat/examples/tutorials/ex1.c.html">src/mat/examples/tutorials/ex1.c.html</A><BR>
<A HREF="../../../src/mat/examples/tutorials/ex4.c.html">src/mat/examples/tutorials/ex4.c.html</A><BR>
<A HREF="../../../src/mat/examples/tutorials/ex9.c.html">src/mat/examples/tutorials/ex9.c.html</A><BR>
<A HREF="../../../src/mat/examples/tutorials/ex10.c.html">src/mat/examples/tutorials/ex10.c.html</A><BR>
<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/ex10.c.html">src/ksp/ksp/examples/tutorials/ex10.c.html</A><BR>
<A HREF="../../../src/ksp/ksp/examples/tutorials/ex27.c.html">src/ksp/ksp/examples/tutorials/ex27.c.html</A><BR>
<A HREF="../../../src/ksp/ksp/examples/tutorials/ex41.c.html">src/ksp/ksp/examples/tutorials/ex41.c.html</A><BR>
<A HREF="../../../src/ksp/ksp/examples/tutorials/ex63.cxx.html">src/ksp/ksp/examples/tutorials/ex63.cxx.html</A><BR>
</BODY></HTML>