On 11/20/18 2:27 PM, 'Maxi Miller' via deal.II User Group wrote:
> how exactly can I understand that? I have to generate a second matrix, which 
> then will be added to the sparse matrix, but (due to the vector 
> multiplication) will be a full matrix, something I would like to avoid.

No, you don't generate a matrix. You just store the vectors. Let's say these 
vectors are x_k and y_k and that the second matrix has the form
   \sum_k  y_k x_k^T
Then you implement the vmult function of your "matrix-like" class as

   void BroydenOperator::vmult (Vector<double> &dst,
                                const Vector<double> &src) const
   {
      dst = 0;
      for (unsigned int k=0; k<n_vectors; ++k)
        {
           const double xk_dot_src = x[k] * src;
           dst.add (xk_dot_src, y[k]);
        }
   }

This implements the *action* of the matrix without ever storing the elements 
of the matrix.

Take a look at step-20 or step-22 to say more examples of operators for which 
we don't know the matrix entries.

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.

Reply via email to