61 double *tmp =
new double[nnew];
62 for(
int i=0; i<nold; i++)
85 #ifdef ENABLE_TRANSPOSE_TIMINGS 89 mtime=MM.
getNewTimer(
"Transpose: CreateTransposeLocal 1");
95 if(OrigCrsMatrix) OrigMatrixIsCrsMatrix_ =
true;
96 else OrigMatrixIsCrsMatrix_ =
false;
98 const Epetra_Map & TransMap = orig.RowMatrixColMap();
99 int TransNnz = orig.NumMyNonzeros();
106 NumMyRows_ = orig.NumMyRows();
107 NumMyCols_ = orig.NumMyCols();
109 TransRowptr.Resize(NumMyCols_+1);
110 TransColind.
Resize(TransNnz);
112 std::vector<int> CurrentStart(NumMyCols_,0);
115 if (OrigMatrixIsCrsMatrix_)
119 for (i=0; i<NumMyRows_; i++)
122 if (err != 0)
throw OrigGraph.
ReportError(
"ExtractMyRowView failed",err);
123 for (j=0; j<NumIndices; j++) ++CurrentStart[Indices_[j]];
129 MaxNumEntries_ = orig.MaxNumEntries();
130 delete [] Indices_;
delete [] Values_;
131 Indices_ =
new int[MaxNumEntries_];
132 Values_ =
new double[MaxNumEntries_];
134 for (i=0; i<NumMyRows_; i++)
136 err = orig.ExtractMyRowCopy(i, MaxNumEntries_, NumIndices, Values_, Indices_);
138 std::cerr <<
"ExtractMyRowCopy failed."<<std::endl;
141 for (j=0; j<NumIndices; j++) ++CurrentStart[Indices_[j]];
147 for (i=1;i<NumMyCols_+1; i++) TransRowptr[i] = CurrentStart[i-1] + TransRowptr[i-1];
148 for (i=0;i<NumMyCols_; i++) CurrentStart[i] = TransRowptr[i];
151 for (i=0; i<NumMyRows_; i++)
153 if (OrigMatrixIsCrsMatrix_)
156 err = orig.ExtractMyRowCopy(i, MaxNumEntries_, NumIndices, Values_, Indices_);
158 std::cerr <<
"ExtractMyRowCopy failed."<<std::endl;
162 for (j=0; j<NumIndices; j++)
164 int idx = CurrentStart[Indices_[j]];
165 TransColind[idx] = i;
166 TransVals[idx] = Values_[j];
167 ++CurrentStart[Indices_[j]];
171 #ifdef ENABLE_TRANSPOSE_TIMINGS 173 mtime=MM.
getNewTimer(
"Transpose: CreateTransposeLocal 2");
181 if(OrigMatrixIsCrsMatrix_ && OrigCrsMatrix->
Importer())
183 if(OrigMatrixIsCrsMatrix_ && OrigCrsMatrix->
Exporter())
186 #ifdef ENABLE_TRANSPOSE_TIMINGS 188 mtime=MM.
getNewTimer(
"Transpose: CreateTransposeLocal 3");
195 throw TempTransA1->
ReportError(
"ExpertStaticFillComplete failed.",err);
198 #ifdef ENABLE_TRANSPOSE_TIMINGS 237 #ifdef ENABLE_TRANSPOSE_TIMINGS 241 mtime=MM.
getNewTimer(
"Transpose: Final FusedExport");
249 #ifdef ENABLE_TRANSPOSE_TIMINGS 263 bool DeleteExporter =
false;
268 TransposeExporter =
new Epetra_Export(TransposeMatrix_->DomainMap(),TransposeMatrix_->RowMap());
271 TransposeMatrix_->PutScalar(0.0);
275 if(DeleteExporter)
delete TransposeExporter;
bool OrigMatrixIsCrsMatrix_
Epetra_CrsMatrix * TransposeMatrix_
const Epetra_CrsGraph & Graph() const
int Resize(int Length_in)
#define EPETRA_CHK_ERR(a)
virtual int ReportError(const std::string Message, int ErrorCode) const
int ExtractMyRowView(int MyRow, int &NumEntries, double *&Values, int *&Indices) const
EpetraExt::BlockCrsMatrix: A class for constructing a distributed block matrix.
const Epetra_Export * Exporter() const
static RCP< Time > getNewTimer(const std::string &name)
~RowMatrix_Transpose()
Destructor.
void resize_doubles(int nold, int nnew, double *&d)
void start(bool reset=false)
NewTypeRef operator()(OriginalTypeRef orig)
Transpose Transform Operator.
Epetra_IntSerialDenseVector & ExpertExtractIndices()
Epetra_Map * TransposeRowMap_
Epetra_IntSerialDenseVector & ExpertExtractIndexOffset()
bool fwd()
Foward Data Migration.
int ExtractMyRowView(int LocalRow, int &NumIndices, int *&Indices) const
Epetra_CrsMatrix * CreateTransposeLocal(OriginalTypeRef orig)
Local-only transpose operator. Don't use this unless you're sure you know what you're doing...
const Epetra_Import * Importer() const
int ExpertStaticFillComplete(const Epetra_Map &DomainMap, const Epetra_Map &RangeMap, const Epetra_Import *Importer=0, const Epetra_Export *Exporter=0, int NumMyDiagonals=-1)
double *& ExpertExtractValues()
bool rvs()
Reverse Data Migration.