49 #include "Epetra_Comm.h" 56 int iam = In->Comm().MyPID() ;
58 long long numentries = In->NumGlobalNonzeros64();
59 int NumRowEntries = 0;
60 double *RowValues = 0;
63 long long numrows = In->NumGlobalRows64();
64 long long numcols = In->NumGlobalCols64();
66 std::vector <int> Ap( numcols+1 );
67 std::vector <int> nextAp( numcols+1 );
68 #ifdef EPETRA_NO_32BIT_GLOBAL_INDICES 69 std::vector <long long> Ai( EPETRA_MAX( numcols, numentries) ) ;
71 std::vector <int> Ai( EPETRA_MAX( numcols, numentries) ) ;
73 std::vector <double> Aval( EPETRA_MAX( numcols, numentries) ) ;
77 assert( In->NumMyRows() == In->NumGlobalRows64() ) ;
81 std::vector <int>RowsPerCol( numcols ) ;
82 for (
int i = 0 ; i < numcols ; i++ ) RowsPerCol[i] = 0 ;
83 for (
int MyRow = 0; MyRow <numrows; MyRow++ ) {
87 In->ExtractMyRowView( MyRow, NumRowEntries, RowValues, ColIndices );
89 for (
int j = 0; j < NumRowEntries; j++ ) {
90 RowsPerCol[ ColIndices[j] ] ++ ;
97 for (
int i = 0 ; i < numcols ; i++ ) {
98 Ap[i+1]= Ap[i] + RowsPerCol[i] ;
104 for (
int MyRow = 0; MyRow <numrows; MyRow++ ) {
108 In->ExtractMyRowView( MyRow, NumRowEntries, RowValues, ColIndices );
109 assert( ierr == 0 ) ;
110 for (
int j = 0; j < NumRowEntries; j++ ) {
111 Ai[ nextAp[ ColIndices[j] ] ] = MyRow ;
112 Aval[ nextAp[ ColIndices[j] ] ] = RowValues[j] ;
113 nextAp[ ColIndices[j] ] ++ ;
120 for (
int MyRow = 0; MyRow <numrows; MyRow++ ) {
121 int NumInCol = Ap[MyRow+1] - Ap[MyRow] ;
122 #if !defined(EPETRA_NO_32BIT_GLOBAL_INDICES) || !defined(EPETRA_NO_64BIT_GLOBAL_INDICES) 123 Out->InsertGlobalValues( MyRow, NumInCol, &Aval[Ap[MyRow]],
126 assert( Out->IndicesAreGlobal() ) ;
129 assert( In->NumMyRows() == 0 ) ;
int CrsMatrixTranspose(Epetra_CrsMatrix *In, Epetra_CrsMatrix *Out)