What are you trying to do by removing the rows/columns of the matrix? Are there 
any variables that you want to treat as constants and hence eliminating the 
rows and columns?

Shri

On May 14, 2012, at 10:51 PM, Andrew Spott wrote:

> Is there a computational cost to using a sparse matrix that is much bigger 
> than it should be?
> 
> for example, say you have a matrix that is n x n, but you only store anything 
> in the first m rows and columns (m < n).  
> 
> Also, would you then have to redo the matrix distribution among nodes by 
> hand, or will PETSC do it for you?
> 
> Thanks for the quick reply
> 
> -Andrew
> 
> On May 14, 2012, at 9:38 PM, Jed Brown wrote:
> 
>> On Mon, May 14, 2012 at 9:33 PM, Andrew Spott <andrew.spott at gmail.com> 
>> wrote:
>> What is the best way to selectively add/remove columns/rows of a Mat?
>> 
>> Is there a way to do it in place, or does it require essentially moving the 
>> values to a new matrix?
>> 
>> If you only need to add/remove a small number of values, it's best to 
>> allocate for all that might be present and just store explicit zeros.
>> 
>> To add or remove rows, you are also changing the vector size that can be 
>> multiplied against, and the data structure must be rebuilt. This is why it's 
>> frequently preferable to use MatZeroRows (or a variant) instead of removing 
>> them from the data structure.
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120514/ab63e191/attachment.htm>

Reply via email to