MueLu Version of the Day
|
#include <MueLu_UtilitiesBase_decl.hpp>
Public Types | |
typedef Teuchos::ScalarTraits< Scalar >::magnitudeType | Magnitude |
Static Public Member Functions | |
static RCP< Matrix > | Crs2Op (RCP< CrsMatrix > Op) |
static RCP< CrsMatrixWrap > | GetThresholdedMatrix (const RCP< Matrix > &Ain, const Scalar threshold, const bool keepDiagonal=true, const GlobalOrdinal expectedNNZperRow=-1) |
Threshold a matrix. | |
static RCP< Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > | GetThresholdedGraph (const RCP< Matrix > &A, const Magnitude threshold, const GlobalOrdinal expectedNNZperRow=-1) |
Threshold a graph. | |
static Teuchos::ArrayRCP< Scalar > | GetMatrixDiagonal (const Matrix &A) |
Extract Matrix Diagonal. | |
static RCP< Vector > | GetMatrixDiagonalInverse (const Matrix &A, Magnitude tol=Teuchos::ScalarTraits< Scalar >::eps() *100, Scalar valReplacement=Teuchos::ScalarTraits< Scalar >::zero()) |
Extract Matrix Diagonal. | |
static Teuchos::RCP< Vector > | GetLumpedMatrixDiagonal (Matrix const &A, const bool doReciprocal=false, Magnitude tol=Teuchos::ScalarTraits< Scalar >::magnitude(Teuchos::ScalarTraits< Scalar >::zero()), Scalar valReplacement=Teuchos::ScalarTraits< Scalar >::zero(), const bool replaceSingleEntryRowWithZero=false, const bool useAverageAbsDiagVal=false) |
Extract Matrix Diagonal of lumped matrix. | |
static Teuchos::ArrayRCP< Magnitude > | GetMatrixMaxMinusOffDiagonal (const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A) |
Return vector containing: max_{i\not=k}(-a_ik), for each for i in the matrix. | |
static Teuchos::ArrayRCP< Magnitude > | GetMatrixMaxMinusOffDiagonal (const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Xpetra::Vector< LocalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &BlockNumber) |
static Teuchos::RCP< Vector > | GetInverse (Teuchos::RCP< const Vector > v, Magnitude tol=Teuchos::ScalarTraits< Scalar >::eps() *100, Scalar valReplacement=Teuchos::ScalarTraits< Scalar >::zero()) |
Return vector containing inverse of input vector. | |
static RCP< Vector > | GetMatrixOverlappedDiagonal (const Matrix &A) |
Extract Overlapped Matrix Diagonal. | |
static RCP< Vector > | GetMatrixOverlappedDeletedRowsum (const Matrix &A) |
Extract Overlapped Matrix Deleted Rowsum. | |
static RCP< Xpetra::Vector< Magnitude, LocalOrdinal, GlobalOrdinal, Node > > | GetMatrixOverlappedAbsDeletedRowsum (const Matrix &A) |
static Teuchos::Array< Magnitude > | ResidualNorm (const Xpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Op, const MultiVector &X, const MultiVector &RHS) |
static Teuchos::Array< Magnitude > | ResidualNorm (const Xpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Op, const MultiVector &X, const MultiVector &RHS, MultiVector &Resid) |
static RCP< MultiVector > | Residual (const Xpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Op, const MultiVector &X, const MultiVector &RHS) |
static void | Residual (const Xpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Op, const MultiVector &X, const MultiVector &RHS, MultiVector &Resid) |
static Scalar | PowerMethod (const Matrix &A, bool scaleByDiag=true, LocalOrdinal niters=10, Magnitude tolerance=1e-2, bool verbose=false, unsigned int seed=123) |
Power method. | |
static Scalar | PowerMethod (const Matrix &A, const RCP< Vector > &diagInvVec, LocalOrdinal niters=10, Magnitude tolerance=1e-2, bool verbose=false, unsigned int seed=123) |
Power method. | |
static RCP< Teuchos::FancyOStream > | MakeFancy (std::ostream &os) |
static Teuchos::ScalarTraits< Scalar >::magnitudeType | Distance2 (const Teuchos::Array< Teuchos::ArrayRCP< const Scalar > > &v, LocalOrdinal i0, LocalOrdinal i1) |
Squared distance between two rows in a multivector. | |
static Teuchos::ScalarTraits< Scalar >::magnitudeType | Distance2 (const Teuchos::ArrayView< double > &weight, const Teuchos::Array< Teuchos::ArrayRCP< const Scalar > > &v, LocalOrdinal i0, LocalOrdinal i1) |
Weighted squared distance between two rows in a multivector. | |
static Teuchos::ArrayRCP< const bool > | DetectDirichletRows (const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Magnitude &tol=Teuchos::ScalarTraits< Scalar >::zero(), bool count_twos_as_dirichlet=false) |
Detect Dirichlet rows. | |
static Teuchos::ArrayRCP< const bool > | DetectDirichletRowsExt (const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, bool &bHasZeroDiagonal, const Magnitude &tol=Teuchos::ScalarTraits< Scalar >::zero()) |
Detect Dirichlet rows (extended version) | |
static void | FindNonZeros (const Teuchos::ArrayRCP< const Scalar > vals, Teuchos::ArrayRCP< bool > nonzeros) |
Find non-zero values in an ArrayRCP Compares the value to 2 * machine epsilon. | |
static void | DetectDirichletColsAndDomains (const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Teuchos::ArrayRCP< bool > &dirichletRows, Teuchos::ArrayRCP< bool > dirichletCols, Teuchos::ArrayRCP< bool > dirichletDomain) |
Detects Dirichlet columns & domains from a list of Dirichlet rows. | |
static void | ApplyRowSumCriterion (const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Magnitude rowSumTol, Teuchos::ArrayRCP< bool > &dirichletRows) |
Apply Rowsum Criterion. | |
static void | ApplyRowSumCriterion (const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Xpetra::Vector< LocalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &BlockNumber, const Magnitude rowSumTol, Teuchos::ArrayRCP< bool > &dirichletRows) |
static Teuchos::ArrayRCP< const bool > | DetectDirichletCols (const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Teuchos::ArrayRCP< const bool > &dirichletRows) |
Detect Dirichlet columns based on Dirichlet rows. | |
static Scalar | Frobenius (const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B) |
Frobenius inner product of two matrices. | |
static void | SetRandomSeed (const Teuchos::Comm< int > &comm) |
Set seed for random number generator. | |
static void | FindDirichletRows (Teuchos::RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &A, std::vector< LocalOrdinal > &dirichletRows, bool count_twos_as_dirichlet=false) |
static void | ApplyOAZToMatrixRows (Teuchos::RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &A, const std::vector< LocalOrdinal > &dirichletRows) |
static void | ApplyOAZToMatrixRows (Teuchos::RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &A, const Teuchos::ArrayRCP< const bool > &dirichletRows) |
static void | ZeroDirichletRows (Teuchos::RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &A, const std::vector< LocalOrdinal > &dirichletRows, Scalar replaceWith=Teuchos::ScalarTraits< Scalar >::zero()) |
static void | ZeroDirichletRows (Teuchos::RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &A, const Teuchos::ArrayRCP< const bool > &dirichletRows, Scalar replaceWith=Teuchos::ScalarTraits< Scalar >::zero()) |
static void | ZeroDirichletRows (Teuchos::RCP< Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &X, const Teuchos::ArrayRCP< const bool > &dirichletRows, Scalar replaceWith=Teuchos::ScalarTraits< Scalar >::zero()) |
static void | ZeroDirichletCols (Teuchos::RCP< Matrix > &A, const Teuchos::ArrayRCP< const bool > &dirichletCols, Scalar replaceWith=Teuchos::ScalarTraits< Scalar >::zero()) |
static void | FindDirichletRowsAndPropagateToCols (Teuchos::RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &A, Teuchos::RCP< Xpetra::Vector< int, LocalOrdinal, GlobalOrdinal, Node > > &isDirichletRow, Teuchos::RCP< Xpetra::Vector< int, LocalOrdinal, GlobalOrdinal, Node > > &isDirichletCol) |
static RCP< const Xpetra::BlockedMap< LocalOrdinal, GlobalOrdinal, Node > > | GeneratedBlockedTargetMap (const Xpetra::BlockedMap< LocalOrdinal, GlobalOrdinal, Node > &sourceBlockedMap, const Xpetra::Import< LocalOrdinal, GlobalOrdinal, Node > &Importer) |
static bool | MapsAreNested (const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &rowMap, const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &colMap) |
Private Types | |
using | CrsGraph = Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > |
using | CrsGraphFactory = Xpetra::CrsGraphFactory< LocalOrdinal, GlobalOrdinal, Node > |
using | CrsMatrixWrap = Xpetra::CrsMatrixWrap< Scalar, LocalOrdinal, GlobalOrdinal, Node > |
using | CrsMatrix = Xpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > |
using | Matrix = Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > |
using | Vector = Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > |
using | BlockedVector = Xpetra::BlockedVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > |
using | MultiVector = Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > |
using | BlockedMultiVector = Xpetra::BlockedMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > |
using | BlockedMap = Xpetra::BlockedMap< LocalOrdinal, GlobalOrdinal, Node > |
using | Map = Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > |
Definition at line 112 of file MueLu_UtilitiesBase_decl.hpp.
|
private |
Definition at line 117 of file MueLu_UtilitiesBase_decl.hpp.
|
private |
Definition at line 118 of file MueLu_UtilitiesBase_decl.hpp.
|
private |
Definition at line 119 of file MueLu_UtilitiesBase_decl.hpp.
|
private |
Definition at line 120 of file MueLu_UtilitiesBase_decl.hpp.
|
private |
Definition at line 121 of file MueLu_UtilitiesBase_decl.hpp.
|
private |
Definition at line 122 of file MueLu_UtilitiesBase_decl.hpp.
|
private |
Definition at line 123 of file MueLu_UtilitiesBase_decl.hpp.
|
private |
Definition at line 124 of file MueLu_UtilitiesBase_decl.hpp.
|
private |
Definition at line 125 of file MueLu_UtilitiesBase_decl.hpp.
|
private |
Definition at line 126 of file MueLu_UtilitiesBase_decl.hpp.
|
private |
Definition at line 127 of file MueLu_UtilitiesBase_decl.hpp.
typedef Teuchos::ScalarTraits<Scalar>::magnitudeType MueLu::UtilitiesBase< Scalar, LocalOrdinal, GlobalOrdinal, Node >::Magnitude |
Definition at line 129 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Definition at line 132 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Threshold a matrix.
Returns matrix filtered with a threshold value.
NOTE – it's assumed that A has been fillComplete'd.
Definition at line 144 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Threshold a graph.
Returns graph filtered with a threshold value.
NOTE – it's assumed that A has been fillComplete'd.
Definition at line 198 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Extract Matrix Diagonal.
Returns Matrix diagonal in ArrayRCP.
NOTE – it's assumed that A has been fillComplete'd.
Definition at line 236 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Extract Matrix Diagonal.
Returns inverse of the Matrix diagonal in ArrayRCP.
NOTE – it's assumed that A has been fillComplete'd.
Definition at line 264 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Extract Matrix Diagonal of lumped matrix.
Returns Matrix diagonal of lumped matrix in RCP<Vector>.
NOTE – it's assumed that A has been fillComplete'd.
Definition at line 283 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Return vector containing: max_{i\not=k}(-a_ik), for each for i in the matrix.
[in] | A | input matrix @ret: vector containing max_{i\not=k}(-a_ik) |
Definition at line 378 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Definition at line 397 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Return vector containing inverse of input vector.
[in] | v | input vector |
[in] | tol | tolerance. If entries of input vector are smaller than tolerance they are replaced by valReplacement (see below). The default value for tol is 100*eps (machine precision) |
[in] | valReplacement | Value put in for undefined entries in output vector (default: 0.0) @ret: vector containing inverse values of input vector v |
Definition at line 429 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Extract Overlapped Matrix Diagonal.
Returns overlapped Matrix diagonal in ArrayRCP.
The local overlapped diagonal has an entry for each index in A's column map. NOTE – it's assumed that A has been fillComplete'd.
Definition at line 467 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Extract Overlapped Matrix Deleted Rowsum.
Returns overlapped Matrix deleted Rowsum in ArrayRCP.
The local overlapped deleted Rowsum has an entry for each index in A's column map. NOTE – it's assumed that A has been fillComplete'd.
Definition at line 510 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Definition at line 553 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Definition at line 602 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Definition at line 611 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Definition at line 620 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Definition at line 630 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Power method.
A | matrix |
scaleByDiag | if true, estimate the largest eigenvalue of \( D^; A \). |
niters | maximum number of iterations |
tolerance | stopping tolerance @verbose if true, print iteration information @seed seed for randomizing initial guess |
(Shamelessly grabbed from tpetra/examples.)
Definition at line 648 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Power method.
A | matrix |
diagInvVec | reciprocal of matrix diagonal |
niters | maximum number of iterations |
tolerance | stopping tolerance @verbose if true, print iteration information @seed seed for randomizing initial guess |
(Shamelessly grabbed from tpetra/examples.)
Definition at line 677 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Definition at line 725 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Squared distance between two rows in a multivector.
Used for coordinate vectors.
Definition at line 734 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Weighted squared distance between two rows in a multivector.
Used for coordinate vectors.
Definition at line 748 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Detect Dirichlet rows.
The routine assumes, that if there is only one nonzero per row, it is on the diagonal and therefore a DBC. This is safe for most of our applications, but one should be aware of that.
There is an alternative routine (see DetectDirichletRowsExt)
[in] | A | matrix |
[in] | tol | If a row entry's magnitude is less than or equal to this tolerance, the entry is treated as zero. |
Definition at line 772 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Detect Dirichlet rows (extended version)
Look at each matrix row and mark it as Dirichlet if there is only one "not small" nonzero on the diagonal. In determining whether a nonzero is "not small" use \f abs(A(i,j)) / sqrt(abs(diag[i]*diag[j])) > tol
[in] | A | matrix |
[in/out] | bHasZeroDiagonal Reference to boolean variable. Returns true if there is a zero on the diagonal in the local part of the Matrix. Otherwise it is false. Different processors might return a different value. There is no global reduction! | |
[in] | tol | If a row entry's magnitude is less than or equal to this tolerance, the entry is treated as zero. |
Definition at line 824 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Find non-zero values in an ArrayRCP Compares the value to 2 * machine epsilon.
[in] | vals | - ArrayRCP<const Scalar> of values to be tested |
[out] | nonzeros | - ArrayRCP<bool> of true/false values for whether each entry in vals is nonzero |
Definition at line 862 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Detects Dirichlet columns & domains from a list of Dirichlet rows.
[in] | A | - Matrix on which to apply Dirichlet column detection |
[in] | dirichletRows | - ArrayRCP<bool> of indicators as to which rows are Dirichlet |
[out] | dirichletCols | - ArrayRCP<bool> of indicators as to which cols are Dirichlet |
[out] | dirichletDomain | - ArrayRCP<bool> of indicators as to which domains are Dirichlet |
Definition at line 880 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Apply Rowsum Criterion.
Flags a row i as dirichlet if:
\sum_{j\not=i} A_ij > A_ii * tol
[in] | A | matrix |
[in] | rowSumTol | See above |
[in/out] | dirichletRows boolean array. The ith entry is true if the above criterion is satisfied (or if it was already set to true) |
Definition at line 932 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Definition at line 960 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Detect Dirichlet columns based on Dirichlet rows.
The routine finds all column indices that are in Dirichlet rows, where Dirichlet rows are described by dirichletRows, as returned by DetectDirichletRows.
[in] | A | matrix |
[in] | dirichletRows | array of Dirichlet rows. |
Definition at line 1005 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Frobenius inner product of two matrices.
Used in energy minimization algorithms
Definition at line 1045 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Set seed for random number generator.
Distribute the seeds evenly in [1,INT_MAX-1]. This guarantees nothing about where random number streams on difference processes will intersect. This does avoid overflow situations in parallel when multiplying by a PID. It also avoids the pathological case of having the same random number stream on each process.
Definition at line 1112 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Definition at line 1139 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Definition at line 1161 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Definition at line 1187 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Definition at line 1221 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Definition at line 1237 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Definition at line 1256 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Definition at line 1270 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Definition at line 1287 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Definition at line 1332 of file MueLu_UtilitiesBase_decl.hpp.
|
inlinestatic |
Definition at line 1386 of file MueLu_UtilitiesBase_decl.hpp.