[Trilinos-Users] MatrixMatrix::Add and scalarB

Simone Deparis deparis at MIT.EDU
Fri Oct 7 09:54:14 MDT 2005


Also an extra remark: in

// Epetra_CrsMatrix objects A and B, form the sum B = a*A + b*B
static int Add(const Epetra_CrsMatrix& A,
                   bool transposeA,
                   double scalarA,
                   Epetra_CrsMatrix& B,
                   double scalarB);

if the matrix B is not filled, then B is _not_ multiplied by the user
provided scalarB :-(

Simone

Williams, Alan B wrote:
> A quick follow-up to my previous reply:
> 
> Note that if B is not already Filled on entry to the Add function, then
> coefficients are added to B using the InsertGlobalValues method, but if
> B is already Filled, then coefficients are added using the
> SumIntoGlobalValues method. SumIntoGlobalValues adds values to
> already-existing entries in the matrix, whereas InsertGlobalValues adds
> new entries to the matrix (i.e., adds new vertices to the graph, etc.)
> even if the values being inserted are already present.
> 
> So if your matrices are large and you wish to add several matrices to B,
> then there is a memory and performance advantage if B is already Filled.
> 
> Alan



More information about the Trilinos-Users mailing list