On 10/8/20 7:16 AM, Nikki Holtzer wrote:

error: no match for ‘operator+’ (operand types are ‘const dealii::SparseMatrix<double>’ and ‘dealii::SparseMatrix<double>’)

SparseMatrix has no operator+, so this will not work.


error: no matching function for call to ‘dealii::SparseMatrix<double>::add(double, dealii::SparseMatrix<double>&) const’

The usual case where this happens is if you are in a member function that is marked 'const' and the object to which you try to 'add' something is a member variable. For example in

  class X {
    SparseMatrix<double> A,B;

    void my_function() const       // <--- note the 'const'
    {
       A.add (1.0, B);
    }
  };

The 'const' on the member function is a promise that you will not change the values of the members of this class, but A.add(...) will change the member variable A. The compiler is telling you that this is not allowed.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/c7460487-bba8-10ad-47c1-18be5e0704d8%40colostate.edu.

Reply via email to