Epetra_CrsSingletonFilter: A class for explicitly eliminating matrix rows and columns. More...
#include <Epetra_CrsSingletonFilter.h>
Public Member Functions  
Constructors/Destructor  
Epetra_CrsSingletonFilter ()  
Epetra_CrsSingletonFilter default constructor.  
virtual  ~Epetra_CrsSingletonFilter () 
Epetra_CrsSingletonFilter Destructor.  
Analyze methods  
int  Analyze (Epetra_RowMatrix *FullMatrix) 
Analyze the input matrix, removing row/column pairs that have singletons. More...  
bool  SingletonsDetected () const 
Returns true if singletons were detected in this matrix (must be called after Analyze() to be effective).  
Reduce methods  
int  ConstructReducedProblem (Epetra_LinearProblem *Problem) 
Return a reduced linear problem based on results of Analyze(). More...  
int  UpdateReducedProblem (Epetra_LinearProblem *Problem) 
Update a reduced linear problem using new values. More...  
Methods to construct Full System Solution  
int  ComputeFullSolution () 
Compute a solution for the full problem using the solution of the reduced problem, put in LHS of FullProblem(). More...  
Filter Statistics  
int  NumRowSingletons () const 
Return number of rows that contain a single entry, returns 1 if Analysis not performed yet.  
int  NumColSingletons () const 
Return number of columns that contain a single entry that are not associated with singleton row, returns 1 if Analysis not performed yet.  
int  NumSingletons () const 
Return total number of singletons detected, returns 1 if Analysis not performed yet. More...  
double  RatioOfDimensions () const 
Returns ratio of reduced system to full system dimensions, returns 1.0 if reduced problem not constructed.  
double  RatioOfNonzeros () const 
Returns ratio of reduced system to full system nonzero count, returns 1.0 if reduced problem not constructed.  
Attribute Access Methods  
Epetra_LinearProblem *  FullProblem () const 
Returns pointer to the original unreduced Epetra_LinearProblem.  
Epetra_LinearProblem *  ReducedProblem () const 
Returns pointer to the derived reduced Epetra_LinearProblem.  
Epetra_RowMatrix *  FullMatrix () const 
Returns pointer to Epetra_CrsMatrix from full problem.  
Epetra_CrsMatrix *  ReducedMatrix () const 
Returns pointer to Epetra_CrsMatrix from full problem.  
Epetra_MapColoring *  RowMapColors () const 
Returns pointer to Epetra_MapColoring object: color 0 rows are part of reduced system.  
Epetra_MapColoring *  ColMapColors () const 
Returns pointer to Epetra_MapColoring object: color 0 columns are part of reduced system.  
Epetra_Map *  ReducedMatrixRowMap () const 
Returns pointer to Epetra_Map describing the reduced system row distribution.  
Epetra_Map *  ReducedMatrixColMap () const 
Returns pointer to Epetra_Map describing the reduced system column distribution.  
Epetra_Map *  ReducedMatrixDomainMap () const 
Returns pointer to Epetra_Map describing the domain map for the reduced system.  
Epetra_Map *  ReducedMatrixRangeMap () const 
Returns pointer to Epetra_Map describing the range map for the reduced system.  
Protected Member Functions  
Epetra_CrsMatrix *  FullCrsMatrix () const 
const Epetra_Map &  FullMatrixRowMap () const 
const Epetra_Map &  FullMatrixColMap () const 
const Epetra_Map &  FullMatrixDomainMap () const 
const Epetra_Map &  FullMatrixRangeMap () const 
void  InitializeDefaults () 
int  ComputeEliminateMaps () 
int  Setup (Epetra_LinearProblem *Problem) 
int  InitFullMatrixAccess () 
int  GetRow (int Row, int &NumIndices, int *&Indices) 
int  GetRowGCIDs (int Row, int &NumIndices, double *&Values, int *&GlobalIndices) 
int  GetRow (int Row, int &NumIndices, double *&Values, int *&Indices) 
int  CreatePostSolveArrays (const Epetra_IntVector &RowIDs, const Epetra_MapColoring &RowMapColors, const Epetra_IntVector &ColProfiles, const Epetra_IntVector &NewColProfiles, const Epetra_IntVector &ColHasRowWithSingleton) 
int  ConstructRedistributeExporter (Epetra_Map *SourceMap, Epetra_Map *TargetMap, Epetra_Export *&RedistributeExporter, Epetra_Map *&RedistributeMap) 
Protected Attributes  
Epetra_LinearProblem *  FullProblem_ 
Epetra_LinearProblem *  ReducedProblem_ 
Epetra_RowMatrix *  FullMatrix_ 
Epetra_CrsMatrix *  FullCrsMatrix_ 
Epetra_CrsMatrix *  ReducedMatrix_ 
Epetra_MultiVector *  ReducedRHS_ 
Epetra_MultiVector *  ReducedLHS_ 
Epetra_Map *  ReducedMatrixRowMap_ 
Epetra_Map *  ReducedMatrixColMap_ 
Epetra_Map *  ReducedMatrixDomainMap_ 
Epetra_Map *  ReducedMatrixRangeMap_ 
Epetra_Map *  OrigReducedMatrixDomainMap_ 
Epetra_Import *  Full2ReducedRHSImporter_ 
Epetra_Import *  Full2ReducedLHSImporter_ 
Epetra_Export *  RedistributeDomainExporter_ 
int *  ColSingletonRowLIDs_ 
int *  ColSingletonColLIDs_ 
int *  ColSingletonPivotLIDs_ 
double *  ColSingletonPivots_ 
int  AbsoluteThreshold_ 
double  RelativeThreshold_ 
int  NumMyRowSingletons_ 
int  NumMyColSingletons_ 
int  NumGlobalRowSingletons_ 
int  NumGlobalColSingletons_ 
double  RatioOfDimensions_ 
double  RatioOfNonzeros_ 
bool  HaveReducedProblem_ 
bool  UserDefinedEliminateMaps_ 
bool  AnalysisDone_ 
bool  SymmetricElimination_ 
Epetra_MultiVector *  tempExportX_ 
Epetra_MultiVector *  tempX_ 
Epetra_MultiVector *  tempB_ 
Epetra_MultiVector *  RedistributeReducedLHS_ 
int *  Indices_ 
Epetra_SerialDenseVector  Values_ 
Epetra_MapColoring *  RowMapColors_ 
Epetra_MapColoring *  ColMapColors_ 
bool  FullMatrixIsCrsMatrix_ 
int  MaxNumMyEntries_ 
Epetra_CrsSingletonFilter: A class for explicitly eliminating matrix rows and columns.
The Epetra_CrsSingletonFilter class takes an existing Epetra_LinearProblem object, analyzes it structure and explicitly eliminates singleton rows and columns from the matrix and appropriately modifies the RHS and LHS of the linear problem. The result of this process is a reduced system of equations that is itself an Epetra_LinearProblem object. The reduced system can then be solved using any solver that is understands an Epetra_LinearProblem. The solution for the full system is obtained by calling ComputeFullSolution(). Singleton rows are defined to be rows that have a single nonzero entry in the matrix. The equation associated with this row can be explicitly eliminated because it involved only one variable. For example if row i has a single nonzero value in column j, call it A(i,j), we can explicitly solve for x(j) = b(i)/A(i,j), where b(i) is the ith entry of the RHS and x(j) is the jth entry of the LHS. Singleton columns are defined to be columns that have a single nonzero entry in the matrix. The variable associated with this column is fully dependent, meaning that the solution for all other variables does not depend on it. If this entry is A(i,j) then the ith row and jth column can be removed from the system and x(j) can be solved after the solution for all other variables is determined. By removing singleton rows and columns, we can often produce a reduced system that is smaller and far less dense, and in general having better numerical properties. The basic procedure for using this class is as follows:
int Epetra_CrsSingletonFilter::Analyze  (  Epetra_RowMatrix *  FullMatrix  ) 
Analyze the input matrix, removing row/column pairs that have singletons.
Analyzes the user's input matrix to determine rows and columns that should be explicitly eliminated to create the reduced system. Look for rows and columns that have single entries. These rows/columns can easily be removed from the problem. The results of calling this method are two MapColoring objects accessible via RowMapColors() and ColMapColors() accessor methods. All rows/columns that would be eliminated in the reduced system have a color of 1 in the corresponding RowMapColors/ColMapColors object. All kept rows/cols have a color of 0.
int Epetra_CrsSingletonFilter::ComputeFullSolution  (  ) 
Compute a solution for the full problem using the solution of the reduced problem, put in LHS of FullProblem().
After solving the reduced linear system, this method can be called to compute the solution to the original problem, assuming the solution for the reduced system is valid. The solution of the unreduced, original problem will be in the LHS of the original Epetra_LinearProblem.
int Epetra_CrsSingletonFilter::ConstructReducedProblem  (  Epetra_LinearProblem *  Problem  ) 
Return a reduced linear problem based on results of Analyze().
Creates a new Epetra_LinearProblem object based on the results of the Analyze phase. A pointer to the reduced problem is obtained via a call to ReducedProblem().

inline 
Return total number of singletons detected, returns 1 if Analysis not performed yet.
Return total number of singletons detected across all processors. This method will not return a valid result until after the Analyze() method is called. The dimension of the reduced system can be computed by subtracting this number from dimension of full system.
References NumColSingletons(), and NumRowSingletons().
int Epetra_CrsSingletonFilter::UpdateReducedProblem  (  Epetra_LinearProblem *  Problem  ) 
Update a reduced linear problem using new values.
Updates an existing Epetra_LinearProblem object using new matrix, LHS and RHS values. The matrix structure must be identical to the matrix that was used to construct the original reduced problem.