[Trilinos-Users] Adding sparse matrices

Williams, Alan B william at sandia.gov
Mon Jun 11 13:29:06 MDT 2007


Maxsim,

The function MatrixMatrix::Add(A, transA, scalA, B, scalB)
Forms the result B = scalA * A + scalB * B

As the function's comments state, it doesn't matter whether the result
has already been 'Filled()' or not, on entry to the function.

In your scenario, A is the result matrix which makes the above somewhat
confusing, but the bottom line is, you shouldn't get an error if the
result matrix is already 'Filled()' on entry to the second Add.

Alan


> -----Original Message-----
> From: trilinos-users-bounces at software.sandia.gov 
> [mailto:trilinos-users-bounces at software.sandia.gov] On Behalf 
> Of Maxsim Gibiansky
> Sent: Monday, June 11, 2007 1:02 PM
> To: trilinos-users at software.sandia.gov
> Subject: [Trilinos-Users] Adding sparse matrices
> 
> I've been using Trilinos (via PyTrilinos), and I have some 
> other questions. 
> 
> I'm in a situation where I have sparse matrices 
> (Epetra.FECrsMatrix) for several terms in an equation; I'd 
> like to be able to add them. I've tried using the Add 
> function in EpetraExt::MatrixMatrix, but I've had problems - 
> at the end of the operation, the destination matrix has 
> FillComplete() called on it. So if I wanted to use it to do 
> something like
> 
> Add(B, False, 1, A, 1) // A += B
> Add(C, False, 1, A, 1) // A += C
> 
> I might get an error, because A will already be Filled() 
> after the first call. 
> 
> Am I missing something? I can't seem to figure out how to add 
> a group of matrices together, and it seems like there should 
> be some way of doing this. 
> 
> -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