On 12/4/18 6:19 AM, 'Maxi Miller' via deal.II User Group wrote: > For the implementation of the Quasi-Newton-method according to Schubert, > which > is defined as > > C_1 = C_0 - sum(u_i u_i^T(C_0p_j - y/t)(p_i^T/(p_i^Tp_i))) > > with p_i the vector p with all elements set to zero where column vector i of > matrix C_0 has zero-value entries, > I need the position of zero- and non-zero-entries in the system matrix, in > order to create the "sparse" vector p_i. I know that there is a method called > "exists(i, j)", but I assume looping over that function will be rather > time-consuming. Thus, is there another method for faster access of the > position of the non-zero elements in a sparsity pattern, or is there a better > approach for creating such a "sparse" vector?
Yes -- the sparse matrix (and sparsity pattern) classes have iterators that only iterate over the nonzero entries. You can ask these iterators for row/column indices. Best W. -- ------------------------------------------------------------------------ Wolfgang Bangerth email: bange...@colostate.edu www: http://www.math.colostate.edu/~bangerth/ -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to dealii+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.