[Dune] build a BCRSMatix C = A + B

abdeladhim tahimi abdeladhim.tahimi at gmail.com
Mon Aug 3 03:54:05 CEST 2015


Hi Markus,

thank you for the prompt reply, I was just thinking about some thing like
matMultMat() in <dune/istl/matrixmatrix.hh>, example below,

example:
   typedef Dune::BCRSMatrix<Dune::FieldMatrix<double,1,1> > ScalarMatrix;

   ScalarMatrix A(2,2,ScalarMatrix::random);
   A.setrowsize(0,1);
   A.endrowsizes();
   A.addindex(0,0);
   A.endindices();
   Dune::printmatrix(std::cout, A, "A", "row");

   ScalarMatrix B(2,2,ScalarMatrix::random);
   B.setrowsize(0,1);
   B.endrowsizes();
   B.addindex(0,1);
   B.endindices();
   Dune::printmatrix(std::cout, B, "B", "row");

   ScalarMatrix C(2,2,ScalarMatrix::random);
   // C = A * B;
   matMultMat(C,A,B);
   Dune::printmatrix(std::cout, C, "C", "row");

and the output,

A [n=2,m=2,rowdim=2,coldim=2]
row    0   0.00e+00          .
row    1          .          .
B [n=2,m=2,rowdim=2,coldim=2]
row    0          .   0.00e+00
row    1          .          .
C [n=2,m=2,rowdim=2,coldim=2]
row    0          .   0.00e+00
row    1          .          .

Adim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20150802/10e36cc2/attachment.htm>


More information about the Dune mailing list