[Trilinos-Users] MatrixMatrix::Add and scalarB

Williams, Alan B william at sandia.gov
Fri Oct 7 10:23:00 MDT 2005


This issue and some other issues were corrected yesterday. The changes
will be included in the Trilinos 6.0.4 minor release (I'm not sure
exactly when that will be).

I entered a bug report in our bugzilla system yesterday, but I was
unable to CC you on it.

Here's the cvs commit message from yesterday's changes:

Modified Files:
      Tag: trilinos-release-6-0-branch
	EpetraExt_MatrixMatrix.cpp EpetraExt_MatrixMatrix.h Log Message:

Address the following problems, described in bug 1732:

The function EpetraExt::MatrixMatrix::Add currently calls FillComplete
on the result B matrix, if B is not already Filled.
Instead, B.FillComplete should be called at the discretion of the user.

The solution will be to put an optional argument at the end of the Add
function's argument list. The argument will be a bool which will specify
whether B.FillComplete should be called or not. The argument will have a
default value of true, so that behavior will not change for existing
user code.

Additionally, the Add function is calling B.FillComplete without
specifying domain and range maps, which is an error if B is rectangular.

Finally, if B is not already filled before calling Add, the scalar
'scalarB' is not being correctly accounted for.


The test program test/MatrixMatrix/cxx_main.cpp was expanded to verify
that the above deficiencies are now fixed.

Alan


> -----Original Message-----
> From: trilinos-users-bounces at software.sandia.gov 
> [mailto:trilinos-users-bounces at software.sandia.gov] On Behalf 
> Of Simone Deparis
> Sent: Friday, October 07, 2005 9:54 AM
> To: trilinos-users at software.sandia.gov
> Subject: Re: [Trilinos-Users] MatrixMatrix::Add and scalarB
> 
> 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
> 
> _______________________________________________
> Trilinos-Users mailing list
> Trilinos-Users at software.sandia.gov
> http://software.sandia.gov/mailman/listinfo/trilinos-users
> 



More information about the Trilinos-Users mailing list