[Trilinos-Users] run time changing matrix

Williams, Alan B william at sandia.gov
Mon May 4 12:17:14 MDT 2009


Lucia,
Chris baker points out the following:

Chris Baker <cgbaker at sandia.gov> wrote:

I believe that you can add entries to a matrix after FillComplete(), as long as you do not call OptimizeStorage(). FillComplete() needs to be called after adding entries, before the matrix should be used again. I wrote a simple serial test demonstrating this, output is below.

Removing entries is more difficult. The easiest way that I can think of is to ReplaceMyValues() the entry-to-be-removed with an existing column index (the diagonal, perhaps) and the value zero; it will be eliminated on the call to MergeRedundantEntries() in the next FillComplete(). 

Chris

[s903186:~/EPETRA_SERIAL] cgbaker% ./Lucia_test.exe


****** Created matrix


****** Added entries to main diagonal: 

Number of Global Rows        = 4
Number of Global Cols        = 4
Number of Global Diagonals   = 4
Number of Global Nonzeros    = 4
Global Maximum Num Entries   = 1
 ** Matrix is Lower Triangular **
 ** Matrix is Upper Triangular **



Number of My Rows        = 4
Number of My Cols        = 4
Number of My Diagonals   = 4
Number of My Nonzeros    = 4
My Maximum Num Entries   = 1

   Processor    Row Index    Col Index           Value     
       0             0             0                       0    
       0             1             1                       0    
       0             2             2                       0    
       0             3             3                       0    


****** Added entries to first super-diagonal: 

Number of Global Rows        = 4
Number of Global Cols        = 4
Number of Global Diagonals   = 4
Number of Global Nonzeros    = 7
Global Maximum Num Entries   = 2
 ** Matrix is Lower Triangular **
 ** Matrix is Upper Triangular **



Number of My Rows        = 4
Number of My Cols        = 4
Number of My Diagonals   = 4
Number of My Nonzeros    = 7
My Maximum Num Entries   = 2

   Processor    Row Index    Col Index           Value     
       0             0             0                       0    
       0             0             1                       1    
       0             1             1                       0    
       0             1             2                       1    
       0             2             2                       0    
       0             2             3                       1    
       0             3             3                       0    


****** Added entries to first sub-diagonal: 

Number of Global Rows        = 4
Number of Global Cols        = 4
Number of Global Diagonals   = 4
Number of Global Nonzeros    = 10
Global Maximum Num Entries   = 3
 ** Matrix is Lower Triangular **
 ** Matrix is Upper Triangular **



Number of My Rows        = 4
Number of My Cols        = 4
Number of My Diagonals   = 4
Number of My Nonzeros    = 10
My Maximum Num Entries   = 3

   Processor    Row Index    Col Index           Value     
       0             0             0                       0    
       0             0             1                       1    
       0             1             0                      -1    
       0             1             1                       0    
       0             1             2                       1    
       0             2             1                      -1    
       0             2             2                       0    
       0             2             3                       1    
       0             3             2                      -1    
       0             3             3                       0    
 

> -----Original Message-----
> From: trilinos-users-bounces at software.sandia.gov 
> [mailto:trilinos-users-bounces at software.sandia.gov] On Behalf 
> Of Williams, Alan B
> Sent: Monday, May 04, 2009 11:49 AM
> To: Lucia Mirabella; trilinos-users at software.sandia.gov
> Subject: Re: [Trilinos-Users] run time changing matrix
> 
> Lucia,
> 
> The structure of an Epetra matrix can't change after 
> FillComplete has been called.
> 
> We have some applications which require changing the 
> structure of the matrix, and we destroy and recreate the 
> matrix when that is necessary.
> 
> If your structural changes are minor, and the number of rows 
> stays constant, it may be possible to pad your matrix a 
> little bit and store zeros for elements that are not in use.
> 
> Alan
> 
> 
> > -----Original Message-----
> > From: trilinos-users-bounces at software.sandia.gov 
> > [mailto:trilinos-users-bounces at software.sandia.gov] On Behalf 
> > Of Lucia Mirabella
> > Sent: Thursday, April 30, 2009 5:35 PM
> > To: trilinos-users at software.sandia.gov
> > Subject: [Trilinos-Users] run time changing matrix
> > 
> > Hello,
> > 
> > I need to use in my code an Epetra_FECrsMatrix that changes 
> > during the 
> > execution of the code. In particular the pattern of the 
> > matrix may vary 
> > at different time steps, increasing or decreasing the number 
> > of non-zero 
> > elements. In general this number is quite small.
> > 
> > Could you please suggest me the most efficient way (in terms 
> > of memory 
> > usage and CPU time to solve the linear system) to implement 
> > this feature?
> > 
> > Thank you,
> > 
> > Lucia
> > 
> > _______________________________________________
> > Trilinos-Users mailing list
> > Trilinos-Users at software.sandia.gov
> > http://software.sandia.gov/mailman/listinfo/trilinos-users
> > 
> _______________________________________________
> 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