If the rows you want on each processor are local to this processor, why not try using MatGetRow().<br><br><a href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatGetRow.html">http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatGetRow.html</a><br>
<br><br><br><br><div class="gmail_quote">On Tue, Dec 1, 2009 at 6:21 AM, ming zhu <span dir="ltr">&lt;<a href="mailto:foolishzhu@yahoo.com.cn">foolishzhu@yahoo.com.cn</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top">
Hi<div>I have a huge matrix U for all processors (PETSC_COMM_WORLD). I only want to copy only two rows (i,j) for each local processor. i,j is different for each processor and not related to rank. &nbsp;I was trying to use a vector filter (like, 00000010000). However, if the vector is&nbsp;PETSC_COMM_WORLD, it will be changed by different processor. So, how to make it ?<span style="font-family: &#39;Times New Roman&#39;; font-size: medium;"></span></div>
<div>Thank you</div><div><br></div><div>My original code is&nbsp;</div><div><br></div><div>Vec
 filter</div><div>VecCreate(PETSC_COMM_WORLD,&amp;filter);</div><div>VecSetsizes(filter,PETSC_DECIDE,m);</div><div>VecSetFromOptions(filter);</div><div><br></div><div>Vecset(filter,0);</div><div>VecSetValue(filter,i,1,INSERT_VALUES);</div>
<div><br></div><div>...</div><div>MatMult(U, filter,ui);</div><div><br></div><div>If I create filter with&nbsp;PETSC_COMM_SELF, it is impossible for U and filter to multiply.</div><div><br></div><div><br></div><div><br></div><div>
<br></div></td></tr></tbody></table><br>


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