89 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
125 std::cout <<
"\nAnalyzed Singleton Problem:\n";
126 std::cout <<
"---------------------------\n";
130 std::cout <<
"Singletons Detected!" << std::endl;;
131 std::cout <<
"Num Singletons: " <<
NumSingletons() << std::endl;
136 std::cout <<
"No Singletons Detected!" << std::endl;
151 std::cout <<
"---------------------------\n\n";
176 std::cout <<
"\nConstructedSingleton Problem:\n";
177 std::cout <<
"---------------------------\n";
180 std::cout <<
"---------------------------\n\n";
190 if( ierr ) std::cout <<
"EDT_LinearProblem_CrsSingletonFilter::UpdateReducedProblem FAILED!\n";
199 if( ierr ) std::cout <<
"EDT_LinearProblem_CrsSingletonFilter::ComputeFullSolution FAILED!\n";
247 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
291 for (
int i=0; i<NumMyRows; i++) {
294 for (
int j=0; j<NumIndices; j++) {
295 int ColumnIndex = Indices[j];
296 ColProfiles[ColumnIndex]++;
299 RowIDs[ColumnIndex] = i;
304 ColHasRowWithSingleton[j2]++;
306 colMapColors[j2] = 1;
339 if (ColHasRowWithSingleton.
MaxValue()>1) {
348 for (
int j=0; j<NumMyCols; j++) {
351 if (ColProfiles[j]==1 ) {
355 if (rowMapColors[i2]!=1) {
356 RowHasColWithSingleton[i2]++;
357 rowMapColors[i2] = 2;
364 for (
int jj=0; jj<NumIndices; jj++) {
365 NewColProfiles[Indices[jj]]--;
370 else if (ColHasRowWithSingleton[j]==1 && rowMapColors[i2]!=1) {
374 if (RowHasColWithSingleton.MaxValue()>1) {
380 ColHasRowWithSingleton));
382 for (
int i=0; i<NumMyRows; i++) {
383 if (rowMapColors[i]==2) rowMapColors[i] = 1;
392 template<
typename int_type>
452 int NumVectors = FullLHS->NumVectors();
467 int ColSingletonCounter = 0;
468 for (i=0; i<NumMyRows; i++) {
486 double pivot = Values[0];
488 int indX = Indices[0];
489 for (j=0; j<NumVectors; j++)
496 for (j=0; j<NumEntries; j++) {
497 if (Indices[j]==targetCol) {
498 double pivot = Values[j];
502 ColSingletonCounter++;
520 FullLHS->PutScalar(0.0);
570 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
572 return TConstructReducedProblem<int>(Problem);
576 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
578 return TConstructReducedProblem<long long>(Problem);
582 throw "LinearProblem_CrsSingletonFilter::ConstructReducedProblem: ERROR, GlobalIndices type unknown.";
586 template<
typename int_type>
606 int NumVectors = FullLHS->NumVectors();
612 int ColSingletonCounter = 0;
613 for (i=0; i<NumMyRows; i++) {
631 double pivot = Values[0];
633 int indX = Indices[0];
634 for (j=0; j<NumVectors; j++)
641 double pivot = Values[j];
644 ColSingletonCounter++;
655 FullLHS->PutScalar(0.0);
693 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
695 return TUpdateReducedProblem<int>(Problem);
699 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
701 return TUpdateReducedProblem<long long>(Problem);
705 throw "LinearProblem_CrsSingletonFilter::UpdateReducedProblem: ERROR, GlobalIndices type unknown.";
708 template<
typename int_type>
713 int_type IndexBase = (int_type) SourceMap->
IndexBase64();
722 Epetra_Map ContiguousTargetMap((int_type) -1, TargetNumMyElements, IndexBase,Comm);
725 Epetra_Map ContiguousSourceMap((int_type) -1, SourceNumMyElements, IndexBase, Comm);
730 int_type* SourceMapMyGlobalElements = 0;
735 Epetra_Export Exporter(ContiguousSourceMap, ContiguousTargetMap);
739 TargetIndices.Export(SourceIndices, Exporter,
Insert);
743 RedistributeMap =
new Epetra_Map((int_type) -1, TargetNumMyElements, TargetIndices.Values(), IndexBase, Comm);
746 RedistributeExporter =
new Epetra_Export(*SourceMap, *RedistributeMap);
753 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
755 return TConstructRedistributeExporter<int>(SourceMap, TargetMap, RedistributeExporter, RedistributeMap);
759 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
761 return TConstructRedistributeExporter<long long>(SourceMap, TargetMap, RedistributeExporter, RedistributeMap);
765 throw "LinearProblem_CrsSingletonFilter::ConstructRedistributeExporter: ERROR, GlobalIndices type unknown.";
780 FullLHS->Update(1.0, *
tempX_, 1.0);
791 int NumVectors =
tempB_->NumVectors();
796 for (jj=0; jj<NumVectors; jj++)
797 (*
tempExportX_)[jj][j]= ((*FullRHS)[jj][i] - (*tempB_)[jj][i])/pivot;
809 FullLHS->Update(1.0, *
tempX_, 1.0);
823 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
846 double * & Values,
int * & Indices) {
860 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
862 double * & Values,
int * & GlobalIndices) {
873 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
875 double * & Values,
long long * & GlobalIndices) {
907 int NumMyColSingletonstmp = 0;
908 for (j=0; j<NumMyCols; j++) {
910 if ( ColProfiles[j]==1 && rowMapColors[i]!=1 ) {
913 NumMyColSingletonstmp++;
917 else if (NewColProfiles[j]==0 && ColHasRowWithSingleton[j]!=1 && rowMapColors[i]==0) {
virtual const Epetra_Map & RowMatrixRowMap() const =0
long long NumGlobalRows64() const
Epetra_MultiVector * GetLHS() const
Epetra_MultiVector * GetRHS() const
bool GlobalIndicesLongLong() const
bool SameAs(const Epetra_BlockMap &Map) const
long long IndexBase64() const
long long NumGlobalElements64() const
virtual int InsertGlobalValues(int GlobalRow, int NumEntries, const double *Values, const int *Indices)
#define EPETRA_CHK_ERR(a)
bool GlobalIndicesInt() const
virtual int MyPID() const =0
virtual int NumMyCols() const =0
int ExtractMyRowView(int MyRow, int &NumEntries, double *&Values, int *&Indices) const
long long NumGlobalNonzeros64() const
virtual int SumAll(double *PartialSums, double *GlobalSums, int Count) const =0
int NumMyElements() const
virtual int MaxNumEntries() const =0
long long GID64(int LID) const
virtual const Epetra_Comm & Comm() const =0
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
virtual const Epetra_Import * RowMatrixImporter() const =0
virtual const Epetra_BlockMap & Map() const =0
virtual int NumMyRows() const =0
int MyGlobalElementsPtr(int *&MyGlobalElementList) const
const Epetra_Comm & Comm() const
virtual long long NumGlobalNonzeros64() const =0
Epetra_Map * GenerateMap(int Color) const
Epetra_RowMatrix * GetMatrix() const
void Sort(bool SortAscending, int NumKeys, T *Keys, int NumDoubleCompanions, double **DoubleCompanions, int NumIntCompanions, int **IntCompanions, int NumLongLongCompanions, long long **LongLongCompanions)
virtual int ReplaceGlobalValues(int GlobalRow, int NumEntries, const double *Values, const int *Indices)
virtual long long NumGlobalRows64() const =0