44 #include <Epetra_Export.h>
45 #include <Epetra_CrsGraph.h>
46 #include <Epetra_Map.h>
64 int nRows = orig.NumMyRows();
65 int nCols = orig.NumMyCols();
74 if( !ignoreNonLocalCols_ && orig.DistributedGlobal() )
76 std::vector<int> TransNumNZ( nCols, 0 );
77 for(
int i = 0; i < nRows; ++i )
79 orig.ExtractMyRowView( i, numIndices, Indices );
80 for(
int j = 0; j < numIndices; ++j ) ++TransNumNZ[ Indices[j] ];
83 std::vector< std::vector<int> > TransIndices( nCols );
84 for(
int i = 0; i < nCols; ++i )
87 TransIndices[i].resize( TransNumNZ[i] );
91 for(
int i = 0; i < nRows; ++i )
93 orig.ExtractMyRowView( i, numIndices, Indices );
94 for(
int j = 0; j < numIndices; ++j )
95 TransIndices[ Indices[j] ][ TransNumNZ[ Indices[j] ]++ ] = i;
99 for(
int i = 0; i < nCols; ++i )
100 if( TransNumNZ[i] ) SharedTransGraph.
InsertMyIndices( i, TransNumNZ[i], &TransIndices[i][0] );
101 SharedTransGraph.FillComplete();
105 TransposeGraph->
Export( SharedTransGraph, Exporter,
Add );
110 std::vector<int> TransNumNZ( nRows, 0 );
111 for(
int i = 0; i < nRows; ++i )
113 orig.ExtractMyRowView( i, numIndices, Indices );
114 for(
int j = 0; j < numIndices; ++j )
115 if( Indices[j] < nRows ) ++TransNumNZ[ Indices[j] ];
118 std::vector< std::vector<int> > TransIndices( nRows );
119 for(
int i = 0; i < nRows; ++i )
122 TransIndices[i].resize( TransNumNZ[i] );
126 for(
int i = 0; i < nRows; ++i )
128 orig.ExtractMyRowView( i, numIndices, Indices );
129 for(
int j = 0; j < numIndices; ++j )
130 if( Indices[j] < nRows ) TransIndices[ Indices[j] ][ TransNumNZ[ Indices[j] ]++ ] = i;
135 for(
int i = 0; i < nRows; ++i )
136 if( TransNumNZ[i] ) TransposeGraph->
InsertMyIndices( i, TransNumNZ[i], &TransIndices[i][0] );
143 return *TransposeGraph;
int InsertMyIndices(int LocalRow, int NumIndices, int *Indices)
int Export(const Epetra_SrcDistObject &A, const Epetra_Import &Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor=0)
~CrsGraph_Transpose()
Destructor.
NewTypeRef operator()(OriginalTypeRef orig)
Transpose Transform Operator.