matrix multiply matrix

29 views
Skip to first unread message

Lance Zhang

unread,
Jun 22, 2023, 12:00:55 PM6/22/23
to deal.II User Group
Hello ,

When I use vmult to multiply matrix with vector,I found error information:
Error information:
 BOOST_HEADER_DEPRECATED("<boost/core/no_exceptions_support.hpp>")
      | ^~~~~~~~~~~~~~~~~~~~~~~
/usr/share/doc/libdeal.ii-doc/examples/cook_membrane3/cook_membrane.cc: In function ‘int main(int, char**)’:
/usr/share/doc/libdeal.ii-doc/examples/cook_membrane3/cook_membrane.cc:2510:24: error: no matching function for call to ‘dealii::SparseDirectUMFPACK::vmult(dealii::BlockSparseMatrix<double>&, dealii::BlockVector<double>&)’
 2510 |          A_direct.vmult(output_vector,solid_3d.system_rhs);
      |          ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
code:
  
         BlockSparseMatrix<double> output_vector;
         SparseDirectUMFPACK A_direct;
         A_direct.initialize(solid_3d.tangent_matrix);
         A_direct.vmult(output_vector,solid_3d.system_rhs);

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

BlockSparseMatrix<double> is the  data type of solid_3d.tangent_matrix
The data type of system_rhs is BlockSparseMatrix<double> .

Could anyone provide any hint or sugesstion?

Thanks in advance!
Best regards
Lance

Lance Zhang

unread,
Jun 22, 2023, 12:01:44 PM6/22/23
to deal.II User Group
the code is related to cook_membrane.cc.

Lance Zhang

unread,
Jun 22, 2023, 12:31:14 PM6/22/23
to deal.II User Group
Hello ,

I changed the code into :

  BlockSparseMatrix<double> output_vector;
         SparseDirectUMFPACK A_direct;
         A_direct.initialize(solid_3d.tangent_matrix.block(solid_3d.u_dof,solid_3d.u_dof));
         A_direct.vmult(output_vector.block(solid_3d.u_dof), solid_3d.system_rhs.block(solid_3d.u_dof));

But I got error information:

      | ^~~~~~~~~~~~~~~~~~~~~~~
/usr/share/doc/libdeal.ii-doc/examples/cook_membrane3/cook_membrane.cc: In function ‘int main(int, char**)’:
/usr/share/doc/libdeal.ii-doc/examples/cook_membrane3/cook_membrane.cc:2510:44: error: no matching function for call to ‘dealii::BlockSparseMatrix<double>::block(Cook_Membrane::Solid<3, double>::<unnamed enum>)’
 2510 |          A_direct.vmult(output_vector.block(solid_3d.u_dof), solid_3d.system_rhs.block(solid_3d.u_dof));
      |                         ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/deal.II/lac/block_sparse_matrix.h:22,
                 from /usr/include/deal.II/lac/sparse_direct.h:25,
                 from /usr/share/doc/libdeal.ii-doc/examples/cook_membrane3/cook_membrane.cc:38:
/usr/include/deal.II/lac/block_matrix_base.h:1567:1: note: candidate: ‘dealii::BlockMatrixBase<MatrixType>::BlockType& dealii::BlockMatrixBase<MatrixType>::block(unsigned int, unsigned int) [with MatrixType = dealii::SparseMatrix<double>; dealii::BlockMatrixBase<MatrixType>::BlockType = dealii::SparseMatrix<double>


I don't understand why the error comes out,the similar code comes out in line of 2180 in cook_membrane.cc.

BlockVector<double> &newton_update
     SparseDirectUMFPACK A_direct;
          A_direct.initialize(tangent_matrix.block(u_dof, u_dof));
          A_direct.vmult(newton_update.block(u_dof), system_rhs.block(u_dof));

solid3d.u_dof=0 which I got by writing in main function.

Could anyone provide any hint or suggestions?

Thanks in advance!
Best regards
Lance

Wolfgang Bangerth

unread,
Jun 22, 2023, 1:27:11 PM6/22/23
to dea...@googlegroups.com
On 6/22/23 10:31, Lance Zhang wrote:
>   BlockSparseMatrix<double> output_vector;

Lance: The function you are trying to call wants a vector as first argument.
You name that variable 'output_vector', but it is not in fact a vector: it is
a block sparse matrix. That can't work.

Best
W.
--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/


Reply all
Reply to author
Forward
0 new messages