On 07/14/2016 05:07 AM, Michał Wichrowski wrote:
Dear all,
Matrix multiplication requires resulting matrix to be initialized. Even if
rebuild_sparsity_C = true .

template <typename number>
template <typename numberB, typename numberC>
void
SparseMatrix<number>::mmult (SparseMatrix<numberC>       &C,
                              const SparseMatrix<numberB> &B,
                              const Vector<number>        &V,
                              const bool                   rebuild_sparsity_C)
const
{
   const bool use_vector = V.size() == n() ? true : false;
   Assert (n() == B.m(), ExcDimensionMismatch(n(), B.m()));
   Assert (cols != 0, ExcNotInitialized());
   Assert (B.cols != 0, ExcNotInitialized());
   Assert (C.cols != 0, ExcNotInitialized()); //HERE!!

Michal,
I think this is actually working as intended. All it checks is that the matrix C has a sparsity pattern object attached to it. This is necessary since, otherwise, we would not know which sparsity pattern object to rebuild.

(The alternative would be to just create a new sparsity pattern and then let matrix C use it. But there is no way to return this object somehow to make sure someone takes over ownership of the object.)

Best
 W.


--
------------------------------------------------------------------------
Wolfgang Bangerth               email:            bange...@math.tamu.edu
                                www: http://www.math.tamu.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