Collaboration diagram for Epetra_CrsSingletonFilter:
Public Member Functions
|Epetra_CrsSingletonFilter default constructor. |
|Epetra_CrsSingletonFilter Destructor. |
|int||Analyze (Epetra_RowMatrix *FullMatrix)|
|Analyze the input matrix, removing row/column pairs that have singletons. |
|bool||SingletonsDetected () const|
|Returns true if singletons were detected in this matrix (must be called after Analyze() to be effective). |
|int||ConstructReducedProblem (Epetra_LinearProblem *Problem)|
|Return a reduced linear problem based on results of Analyze(). |
|int||UpdateReducedProblem (Epetra_LinearProblem *Problem)|
|Update a reduced linear problem using new values. |
Methods to construct Full System Solution.
|Compute a solution for the full problem using the solution of the reduced problem, put in LHS of FullProblem(). |
|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. |
|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|
|int||Setup (Epetra_LinearProblem *Problem)|
|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)|
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:
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.
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.
Return a reduced linear problem based on results of Analyze().
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.
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.