43 #ifdef HAVE_EXPERIMENTAL
44 #ifdef HAVE_GRAPH_REORDERINGS
74 int n = orig.NumMyRows();
75 int nnz = orig.NumMyNonzeros();
78 std::vector<int> ia(n+1,0);
79 std::vector<int> ja(nnz);
81 for(
int i = 0; i < n; ++i )
83 int * tmpP = &ja[ia[i]];
84 orig.ExtractMyRowCopy( i, nnz-ia[i], cnt, tmpP );
85 ia[i+1] = ia[i] + cnt;
89 std::vector<int> iat(n+1);
90 std::vector<int> jat(nnz);
92 for(
int i = 0; i < n; ++i )
95 for(
int j = ia[i]; j < ia[i+1]; ++j )
108 std::cout <<
"Orig Graph\n";
109 std::cout << orig << std::endl;
110 std::cout <<
"-----------------------------------------\n";
111 std::cout <<
"CRS Format Graph\n";
112 std::cout <<
"-----------------------------------------\n";
113 for(
int i = 0; i < n; ++i )
115 std::cout << i <<
": " << iat[i+1] <<
": ";
116 for(
int j = iat[i]; j<iat[i+1]; ++j )
117 std::cout <<
" " << jat[j];
118 std::cout << std::endl;
120 std::cout <<
"-----------------------------------------\n";
123 std::vector<int> perm(n);
124 std::vector<double> info(AMD_INFO);
126 amd_order( n, &iat[0], &jat[0], &perm[0], NULL, &info[0] );
128 if( info[AMD_STATUS] == AMD_INVALID )
129 std::cout <<
"AMD ORDERING: Invalid!!!!\n";
133 std::cout <<
"-----------------------------------------\n";
134 std::cout <<
"AMD Output\n";
135 std::cout <<
"-----------------------------------------\n";
136 std::cout <<
"STATUS: " << info[AMD_STATUS] << std::endl;
137 std::cout <<
"SYMM: " << info[AMD_SYMMETRY] << std::endl;
138 std::cout <<
"N: " << info[AMD_N] << std::endl;
139 std::cout <<
"NZ: " << info[AMD_NZ] << std::endl;
140 std::cout <<
"SYMM: " << info[AMD_SYMMETRY] << std::endl;
141 std::cout <<
"NZDIAG: " << info[AMD_NZDIAG] << std::endl;
142 std::cout <<
"NZ A+At: " << info[AMD_NZ_A_PLUS_AT] << std::endl;
143 std::cout <<
"NDENSE: " << info[AMD_SYMMETRY] << std::endl;
144 std::cout <<
"Perm\n";
145 for(
int i = 0; i<n; ++i )
146 std::cout << perm[i] << std::endl;
147 std::cout <<
"-----------------------------------------\n";
153 int nG = orig.NumGlobalRows();
155 std::vector<int> newElements( n );
156 for(
int i = 0; i < n; ++i )
157 newElements[i] = OldMap.
GID( perm[i] );
163 std::cout <<
"Old Map\n";
164 std::cout << OldMap << std::endl;
165 std::cout <<
"New Map\n";
166 std::cout << *
NewMap_ << std::endl;
177 std::cout <<
"New CrsGraph\n";
188 #endif //HAVE_GRAPH_REORDERINGS
189 #endif //HAVE_EXPERIMENTAL
~CrsGraph_AMD()
EpetraExt::CrsGraph_AMD Destructor.
Epetra_CrsGraph * NewGraph_
const Epetra_Comm & Comm() const
NewTypeRef operator()(OriginalTypeRef orig)
EpetraExt::CrsGraph_AMD Transform Operator.
int Import(const Epetra_SrcDistObject &A, const Epetra_Import &Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor=0)