You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
psblas3/docs/html/userhtmlsu83.html

157 lines
6.5 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html >
<head><title>mm_array_write &#8212; Write a dense array from a file in the MatrixMarket
format</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="TeX4ht (https://tug.org/tex4ht/)">
<meta name="originator" content="TeX4ht (https://tug.org/tex4ht/)">
<!-- html,3 -->
<meta name="src" content="userhtml.tex">
<link rel="stylesheet" type="text/css" href="userhtml.css">
</head><body
>
<!--l. 259--><div class="crosslinks"><p class="noindent">[<a
href="userhtmlsu82.html" >prev</a>] [<a
href="userhtmlsu82.html#tailuserhtmlsu82.html" >prev-tail</a>] [<a
href="userhtmlsu80.html#tailuserhtmlsu83.html">tail</a>] [<a
href="userhtmlsu80.html#userhtmlsu85.html" >up</a>] </p></div>
<h4 class="subsectionHead"><span class="titlemark">9.6 </span> <a
id="x97-1340009.6"></a>mm_array_write &#8212; Write a dense array from a file in the MatrixMarket
format</h4>
<!--l. 261-->
<div class="lstlisting" id="listing-15"><span class="label"><a
id="x97-134001r1"></a></span><span
class="cmtt-10">call</span><span
class="cmtt-10">&#x00A0;</span><span
class="cmtt-10">mm_array_write</span><span
class="cmtt-10">(</span><span
class="cmtt-10">b</span><span
class="cmtt-10">,</span><span
class="cmtt-10">&#x00A0;</span><span
class="cmtt-10">vtitle</span><span
class="cmtt-10">,</span><span
class="cmtt-10">&#x00A0;</span><span
class="cmtt-10">iret</span><span
class="cmtt-10">,</span><span
class="cmtt-10">&#x00A0;</span><span
class="cmtt-10">iunit</span><span
class="cmtt-10">,</span><span
class="cmtt-10">&#x00A0;</span><span
class="cmtt-10">filename</span><span
class="cmtt-10">)</span>
</div>
<!--l. 265--><p class="indent" >
<dl class="description"><dt class="description">
<span
class="cmbx-10">Type:</span> </dt><dd
class="description">Asynchronous.
</dd><dt class="description">
<span
class="cmbx-10">On Entry</span> </dt><dd
class="description">
</dd><dt class="description">
<span
class="cmbx-10">b</span> </dt><dd
class="description">Rigth hand side(s).<br
class="newline" />Type: <span
class="cmbx-10">required </span><br
class="newline" />An array of type real or complex, rank 1 or 2, or an object of type
<a
href="userhtmlsu7.html#vdata"><span
class="cmtt-10">psb</span><span
class="cmtt-10">_T</span><span
class="cmtt-10">_vect</span><span
class="cmtt-10">_type</span></a>, of type real or complex; its contents will be written to
disk.<br
class="newline" />
</dd><dt class="description">
<span
class="cmbx-10">filename</span> </dt><dd
class="description">The name of the file to be written.<br
class="newline" />
</dd><dt class="description">
<span
class="cmbx-10">vtitle</span> </dt><dd
class="description">Matrix title.<br
class="newline" />Type: <span
class="cmbx-10">required </span><br
class="newline" />A charachter variable holding a descriptive title for the vector to be written
to file. Type:<span
class="cmbx-10">optional</span>.<br
class="newline" />Specified as: a character variable containing a valid file name, or <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">-</span></span></span>, in
which case the default input unit 5 (i.e. standard input in Unix jargon) is
used. Default: <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">-</span></span></span>.
</dd><dt class="description">
<span
class="cmbx-10">iunit</span> </dt><dd
class="description">The Fortran file unit number.<br
class="newline" />Type:<span
class="cmbx-10">optional</span>.<br
class="newline" />Specified as: an integer value. Only meaningful if filename is not <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">-</span></span></span>.</dd></dl>
<!--l. 287--><p class="indent" >
<dl class="description"><dt class="description">
<span
class="cmbx-10">On Return</span> </dt><dd
class="description">
</dd><dt class="description">
<span
class="cmbx-10">iret</span> </dt><dd
class="description">Error code.<br
class="newline" />Type: <span
class="cmbx-10">required </span><br
class="newline" />An integer value; 0 means no error has been detected.</dd></dl>
<!--l. 294--><p class="noindent" ><span
class="cmbx-12">Notes</span>
<!--l. 296--><p class="indent" > If this function is called on a vector <span class="lstinline"></span><span
class="cmtt-10">v</span> on a distributed communicator only the
local part is written in output. To get a single MatrixMarket file with the whole
vector when appropriate, e.g. for debugging purposes, one could <span
class="cmti-10">gather </span>the whole
vector on a single rank and then write it. Consider the following example for a <span
class="cmti-10">double</span>
precision vector
<div class="center"
>
<!--l. 312--><p class="noindent" >
<div class="minipage"><pre class="verbatim" id="verbatim-95">
real(psb_dpk_),&#x00A0;allocatable&#x00A0;::&#x00A0;vglobal(:)
call&#x00A0;psb_gather(vglobal,v,desc,info)
if&#x00A0;(iam&#x00A0;==&#x00A0;psb_root_)&#x00A0;then
call&#x00A0;mm_array_write(vglobal,vtitle,info,filename)
end&#x00A0;if
call&#x00A0;deallocate(vglobal,&#x00A0;stat=info)
</pre>
<!--l. 322--><p class="nopar" ></div></div>
<!--l. 326--><p class="noindent" >To simplify this procedure in <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">C</span></span></span>, there is a utility function
<div class="center"
>
<!--l. 332--><p class="noindent" >
<div class="minipage"><pre class="verbatim" id="verbatim-96">
psb_i_t&#x00A0;psb_c_&#x003C;s,d,c,z&#x003E;global_vec_write(vh,cdh);
</pre>
<!--l. 336--><p class="nopar" ></div></div>
<!--l. 340--><p class="noindent" >that produces exactly this result.
<!--l. 1--><div class="crosslinks"><p class="noindent">[<a
href="userhtmlsu82.html" >prev</a>] [<a
href="userhtmlsu82.html#tailuserhtmlsu82.html" >prev-tail</a>] [<a
href="userhtmlsu83.html" >front</a>] [<a
href="userhtmlsu80.html#userhtmlsu85.html" >up</a>] </p></div>
<!--l. 1--><p class="indent" > <a
id="tailuserhtmlsu83.html"></a>
</body></html>