50 RCP<Epetra_CrsMatrix> getEpetraMatrix(
int numRows,
int numCols,
double shift=0.0)
53 const RCP<const Epetra_Comm> comm = getEpetraComm();
55 const Epetra_Map rowMap(numRows, 0, *comm);
56 const Epetra_Map domainMap(numCols, numCols, 0, *comm);
58 const RCP<Epetra_CrsMatrix> epetraCrsM =
59 rcp(
new Epetra_CrsMatrix(Copy, rowMap, numCols));
61 Array<double> rowEntries(numCols);
62 Array<int> columnIndices(numCols);
63 for (
int j = 0; j < numCols; ++j) {
67 const int numLocalRows = rowMap.NumMyElements();
69 for (
int i = 0; i < numLocalRows; ++i) {
71 for (
int j = 0; j < numCols; ++j) {
72 rowEntries[j] = as<double>(i+1) + as<double>(j+1) / 10 + shift;
75 epetraCrsM->InsertMyValues( i, numCols, &rowEntries[0], &columnIndices[0] );
79 epetraCrsM->FillComplete(domainMap, rowMap);
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)