On May 14, 2012, at 11:07 PM, Andrew Spott wrote: > I'm attempting to do a convergence study on my basis, see how large my basis > need to be to make my results accurate, does that help?
You could use create a matrix with the set of all basis vectors and then zero out the rows & columns of the matrix using MatZeroRowsColumns. http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatZeroRowsColumns.html I think this should be better than each time creating a new matrix when the basis changes. > > -Andrew > > On May 14, 2012, at 9:55 PM, Shri wrote: > >> 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/b3548b79/attachment-0001.htm>
