[Trilinos-Users] Epetra_CrsMatrix Basics

Timothy M. Shead tshead at sandia.gov
Mon Nov 16 10:41:44 MST 2009


Baker, Christopher G. wrote:

> In general, you do not want to specify a column map for the sparse
matrix; this will be constructed for you based on the non-zeros entries
of the matrix, and is not necessary or desired in the local,
non-distributed case.
> 
> If you remove the declaration of column_map and call the
Epetra_CrsMatrix constructor that accepts row map and NNZ information,
that should address the problem.
> 
> Note, if your matrix is rectangular, you will need to pass maps for
the domain and range space into FillComplete(); otherwise, don't worry
about this.
> 
> Lastly, if your VTK matrix can easily give you information regarding
the number of non-zeros per row, it would good to pass that info to the
CrsMatrix constructor so that it can more efficiently allocate the data.
The first step would be to generate a guess at the number of non-zeros
per row and use that, along with a dynamic allocation
(StaticProfile==false). The second would be to specify the number of
non-zeros the rows and use a static allocation (StaticProfile==0).

Chris:

That did the trick, many thanks!  Now that I'm getting the expected 
results, I do plan to make the implementation more efficient ...

Cheers,
Tim


More information about the Trilinos-Users mailing list