[Trilinos-Users] Epetra_CrsMatrix Basics

Timothy M. Shead tshead at sandia.gov
Mon Nov 16 09:16:56 MST 2009


Folks:

I'm working on the integration between Trilinos and VTK, and running 
into an area where I'm not sure what I'm doing wrong.  I have a toy 
example where I'm converting a VTK sparse matrix to Epetra_CrsMatrix, 
then multiplying it with an Epetra_MultiVector.  At this point, all I'm 
trying to do is serial, local computation:

   Epetra_LocalMap row_map(vtk_matrix->RowCount, 0, communicator);
   Epetra_LocalMap column_map(vtk_matrix->ColumnCount, 0, communicator);

   Epetra_CrsMatrix* const epetra_matrix = new Epetra_CrsMatrix(Copy, 
row_map, column_map, 0, false);

   for(vtkIdType n = 0; n != vtk_matrix->NonZeroCount; ++n)
     {
     int row = vtk_matrix->GetRowN(n);
     int column = vtk_matrix->GetColumnN(n);
     double value = vtk_matrix->GetValueN(n);
     epetra_matrix->InsertGlobalValues(row, 1, &value, &column);
     }

   epetra_matrix->FillComplete();

However, when I try to perform the multiplication, I'm getting some 
errors that I don't understand:

   epetra_matrix->Multiply(false, epetra_input_multivec, 
epetra_output_multivec);

   Epetra ERROR -3, 
/Users/tshead/src/trilinos/packages/epetra/src/Epetra_DistObject.cpp, 
line 110
   Epetra ERROR -3, 
/Users/tshead/src/trilinos/packages/epetra/src/Epetra_CrsMatrix.cpp, 
line 2461

These errors have something to do with an "importer", which leads me to 
believe that I'm not setting-up my matrix correctly for the serial, 
undistributed use-case ... any thoughts?

Thanks in advance ...
Tim


More information about the Trilinos-Users mailing list