<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">OK.<div>may I ask , I think Petsc matrix is row -based. That means,&nbsp;</div><div><span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: medium; "><pre>MatGetArray(Mat mat,PetscScalar *v[])</pre><pre>v[0] is the pointer to the first row. v[0][0] is the value of mat[0][0].</pre><pre>Am I right?</pre><pre>And do you mean that, each time I got a vector, I create a sub matrix to store it.</pre><pre>Later on, the merging will be a problem.</pre></span><br>--- <b>09年11月30日,周一, Barry Smith <i>&lt;bsmith@mcs.anl.gov&gt;</i></b> 写道:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>发件人: Barry Smith &lt;bsmith@mcs.anl.gov&gt;<br>主题: Re: How to fill a matrix with a vector parallelly<br>收件人: "PETSc users list" &lt;petsc-users@mcs.anl.gov&gt;<br>日期:
 2009年11月30日,周一,上午11:12<br><br><div class="plainMail"><br>On Nov 29, 2009, at 9:09 PM, ming zhu wrote:<br><br>&gt; Thank you for your quick reply.<br>&gt; Two questions:<br>&gt; one,&nbsp; &nbsp;&nbsp;&nbsp;how do I know which part belongs to the present processor?<br><br>&nbsp; Call VecGetOwnershipRange() to know what rows of the vector belong to the process. Then create the MPIDense matrix with the same number of local rows.<br><br>&gt; second, is there any examples for this kind of question?<br>&gt; <br>&gt; Thank you<br>&gt; <br>&gt; --- 09年11月30日,周一, Barry Smith &lt;<a ymailto="mailto:bsmith@mcs.anl.gov" href="/mc/compose?to=bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>&gt; 写道:<br>&gt; <br>&gt; 发件人: Barry Smith &lt;<a ymailto="mailto:bsmith@mcs.anl.gov" href="/mc/compose?to=bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>&gt;<br>&gt; 主题: Re: How to fill a matrix with a vector parallelly<br>&gt; 收件人: "PETSc
 users list" &lt;<a ymailto="mailto:petsc-users@mcs.anl.gov" href="/mc/compose?to=petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>&gt;<br>&gt; 日期: 2009年11月30日,周一,上午9:53<br>&gt; <br>&gt; <br>&gt;&nbsp;&nbsp;&nbsp;Since evenvectors will (almost always) be dense vectors you will want to use a MPIDENSE matrix to store them. So create a MPIDENSE matrix with the same row layout as the eigenvector then on each process use VecGetArray() to access that processes part of the vector and MatGetArray() to access that part of the matrix and copy the values over from the vector array to the matrix array.<br>&gt; <br>&gt;&nbsp; &nbsp; Barry<br>&gt; <br>&gt; On Nov 29, 2009, at 7:41 PM, ming zhu wrote:<br>&gt; <br>&gt; &gt; HI<br>&gt; &gt; I am trying to solve an eigenvalue problem. A = U * LAMBDA*U'.&nbsp; While SLEPC proivdes a solver to get an eigenvector and the related eigenvalue, I have to fill the eigenvector to form the eigen matrix.
 However, there seems no such function to do this directly. I was trying to use VecGetValues and filled the matrix one by one. Howevevr, it can not do that in parallel.<br>&gt; &gt;<br>&gt; &gt;&nbsp; &nbsp; Is there anyone can help me ?<br>&gt; &gt;<br>&gt; &gt; Thank you<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; 好玩贺卡等你发,邮箱贺卡全新上线!<br>&gt; <br>&gt; <br>&gt; 好玩贺卡等你发,邮箱贺卡全新上线!<br><br></div></blockquote></div></td></tr></table><br>


      <hr size=1><a href="http://cn.rd.yahoo.com/mail_cn/tagline/card/*http://card.mail.cn.yahoo.com/">  好玩贺卡等你发,邮箱贺卡全新上线!</a>