[Trilinos-Users] Repeated InsertGlobalValues calls - intended behavior

Michael A Heroux maherou at sandia.gov
Fri Jun 8 09:25:58 MDT 2007


Maxsim,

It is certainly intended that multiple Inserts into the same matrix entry
will be summed, as you have observed.  I agree that the documentation
doesn't make this clear.  We will fix it.

Depending on the overall cost of constructing the matrix vs using it for
later computations, the importance of optimizing the insertion process may
or may not be important.  For many users, this is not a relatively costly
phase, even if it's not efficiently done.  For others it is.

Regarding refilling the matrix, if you first zero out all values using
PutScalar(0.0), you can use SumIntoGlobalValues in the same way as you use
InsertGlobalValues for the initial filling.  Remember to call FillComplete
after you are done Summing, in order to recompute some of the matrix
attributes. 

Mike

On 6/8/07 9:59 AM, "Maxsim Gibiansky" <maxsim.gibiansky at nist.gov> wrote:

> I had a question about the behavior of InsertGlobalValues when it gets called
> multiple times on the same indices in a CrsMatrix.
> 
> I tried and it didn't give an error, and the multiple values inserted into the
> same position got added together when FillComplete() was called - this
> behavior
> made sense. However, I haven't been able to find any documentation that would
> say what the intended behavior is - whether this a feature or just "undefined
> behavior" which happened to to work reasonably in that particular case. I
> realize that it probably should be avoided for efficiency and because it
> breaks
> subsequent calls to ReplaceGlobalValues, but was wondering whether anyone
> could
> point me to somewhere that describes the intended functionality in that case.
> 
> -Maxsim Gibiansky
> 
> 
> _______________________________________________
> 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