[Trilinos-Users] run time changing matrix
Lucia Mirabella
lucia at mathcs.emory.edu
Mon May 4 15:24:34 MDT 2009
Thanks Chris and Alan for your suggestions.
Actually I have realized that the cpu time required for the solution of
the linear system doesn't improve if I eliminate some zero elements from
the pattern, so, as Alan pointed out, it is not really convenient to
modify the matrix pattern at each time step. I think I will pad the
matrix, as Alan suggested.
Thanks,
Lucia
Williams, Alan B wrote:
> 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