<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">It seems that MatGetSubMatrix() only get the local matrix for the processor If U is global(PETSC_COMM_WORLD), the local matrix may not store the column or row I wanted. For example, if U is 4*4, and there are 4 processors, processors one has local matrix 2*2, but i need the third row, Then,MatGetSubmatrix() may not work<br><br>--- <b>09年12月1日,周二, Barry Smith <i><bsmith@mcs.anl.gov></i></b> 写道:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>发件人: Barry Smith <bsmith@mcs.anl.gov><br>主题: Re: How to copy global data to local ?<br>收件人: "PETSc users list" <petsc-users@mcs.anl.gov><br>日期: 2009年12月1日,周二,下午10:23<br><br><div class="plainMail"><br>On Nov 30, 2009, at 11:21 PM, ming zhu wrote:<br><br>> Hi<br>> 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. I was trying to use a vector filter (like, 00000010000). However, if the vector is PETSC_COMM_WORLD, it will be changed by different processor. So, how to make it ?<br>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br><br> I do not understand what this means. To do the multiply you can and should use a vector of PETSC_COMM_WORLD.<br><br> Also multiplying by a vector will not give you back "rows" of a matrix. Do you truly want the entire row of nonzeros of the matrix or something else. If you want the entire row or part of a row then you can use MatGetSubMatrix().<br><br> Barry<br><br>> Thank you<br>> <br>> My original code is<br>> <br>> Vec filter<br>> VecCreate(PETSC_COMM_WORLD,&filter);<br>> VecSetsizes(filter,PETSC_DECIDE,m);<br>> VecSetFromOptions(filter);<br>> <br>> Vecset(filter,0);<br>> VecSetValue(filter,i,1,INSERT_VALUES);<br>> <br>> ...<br>> MatMult(U, filter,ui);<br>> <br>> If I create filter with PETSC_COMM_SELF, it is impossible for U and filter to multiply.<br>> <br>> <br>>
<br>> <br>> <br>> 好玩贺卡等你发,邮箱贺卡全新上线!<br><br></div></blockquote></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>