MOOCHO (Single Doxygen Collection)
Version of the Day
|
Implements D = - inv(C) * N
for a variable reduction projection.
More...
#include <ConstrainedOptPack_MatrixVarReductImplicit.hpp>
Private Types | |
typedef std::vector < VectorSpace::vec_mut_ptr_t > | InvCtN_rows_t |
typedef std::list< index_type > | InvCtN_rows_set_list_t |
Private Member Functions | |
void | assert_initialized () const |
Private Attributes | |
AbstractLinAlgPack::MatrixOpNonsing * | C |
AbstractLinAlgPack::MatrixOp * | N |
AbstractLinAlgPack::MatrixOp * | D_direct |
Public types | |
typedef Teuchos::RCP< const MatrixOpNonsing > | mat_nonsing_ptr_t |
typedef Teuchos::RCP< const MatrixOp > | mat_ptr_t |
Constructors / initializers | |
virtual void | initialize (const mat_nonsing_ptr_t &C, const mat_ptr_t &N, const mat_ptr_t &D_direct) |
Initialize this matrix object. More... | |
virtual void | set_uninitialized () |
Set the matrix to uninitialized. More... | |
Access | |
const mat_nonsing_ptr_t & | C_ptr () const |
Return the smart pointer to the aggregate basis matrix object C . More... | |
const mat_ptr_t & | N_ptr () const |
Return the smart pointer to the aggregate nonbasis matrix object N . More... | |
const mat_ptr_t & | D_direct_ptr () const |
Return the smart pointer to the aggregate precomputed matrix object D_direct (if set). More... | |
Overridden from MatrixBase. | |
size_type | rows () const |
size_type | cols () const |
Overridden from MatrixOp. | |
const VectorSpace & | space_cols () const |
const VectorSpace & | space_rows () const |
MatrixOp & | operator= (const MatrixOp &M) |
std::ostream & | output (std::ostream &) const |
void | Vp_StMtV (VectorMutable *v_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2, value_type beta) const |
void | Vp_StMtV (VectorMutable *v_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const SpVectorSlice &sv_rhs2, value_type beta) const |
void | Vp_StPtMtV (VectorMutable *v_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, BLAS_Cpp::Transp M_rhs2_trans, const Vector &v_rhs3, value_type beta) const |
void | Vp_StPtMtV (VectorMutable *v_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, BLAS_Cpp::Transp M_rhs2_trans, const SpVectorSlice &sv_rhs3, value_type beta) const |
Additional Inherited Members | |
Public Types inherited from AbstractLinAlgPack::MatrixOp | |
enum | EMatNormType { MAT_NORM_INF, MAT_NORM_2, MAT_NORM_1, MAT_NORM_FORB } |
Type of matrix norm. More... | |
Public Member Functions inherited from AbstractLinAlgPack::MatrixOp | |
virtual void | zero_out () |
M_lhs = 0 : Zero out the matrix. More... | |
virtual void | Mt_S (value_type alpha) |
M_lhs *= alpha : Multiply a matrix by a scalar. More... | |
virtual MatrixOp & | operator= (const MatrixOp &mwo_rhs) |
M_lhs = mwo_rhs : Virtual assignment operator. More... | |
virtual mat_mut_ptr_t | clone () |
Clone the non-const matrix object (if supported). More... | |
virtual mat_ptr_t | clone () const |
Clone the const matrix object (if supported). More... | |
const MatNorm | calc_norm (EMatNormType requested_norm_type=MAT_NORM_1, bool allow_replacement=false) const |
Compute a norm of this matrix. More... | |
virtual mat_ptr_t | sub_view (const Range1D &row_rng, const Range1D &col_rng) const |
Create a transient constant sub-matrix view of this matrix (if supported). More... | |
mat_ptr_t | sub_view (const index_type &rl, const index_type &ru, const index_type &cl, const index_type &cu) const |
Inlined implementation calls this->sub_view(Range1D(rl,ru),Range1D(cl,cu)) . More... | |
virtual mat_ptr_t | perm_view (const Permutation *P_row, const index_type row_part[], int num_row_part, const Permutation *P_col, const index_type col_part[], int num_col_part) const |
Create a permuted view: M_perm = P_row' * M * P_col . More... | |
virtual mat_ptr_t | perm_view_update (const Permutation *P_row, const index_type row_part[], int num_row_part, const Permutation *P_col, const index_type col_part[], int num_col_part, const mat_ptr_t &perm_view) const |
Reinitialize a permuted view: M_perm = P_row' * M * P_col . More... | |
Public Member Functions inherited from AbstractLinAlgPack::MatrixBase | |
virtual | ~MatrixBase () |
Virtual destructor. More... | |
virtual size_type | nz () const |
Return the number of nonzero elements in the matrix. More... | |
Protected Member Functions inherited from AbstractLinAlgPack::MatrixOp | |
virtual bool | Mp_StM (MatrixOp *mwo_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs) const |
mwo_lhs += alpha * op(M_rhs) (BLAS xAXPY). More... | |
virtual bool | Mp_StM (value_type alpha, const MatrixOp &M_rhs, BLAS_Cpp::Transp trans_rhs) |
M_lhs += alpha * op(mwo_rhs) (BLAS xAXPY). More... | |
virtual bool | Mp_StMtP (MatrixOp *mwo_lhs, value_type alpha, BLAS_Cpp::Transp M_trans, const GenPermMatrixSlice &P_rhs, BLAS_Cpp::Transp P_rhs_trans) const |
mwo_lhs += alpha * op(M_rhs) * op(P_rhs). More... | |
virtual bool | Mp_StMtP (value_type alpha, const MatrixOp &mwo_rhs, BLAS_Cpp::Transp M_trans, const GenPermMatrixSlice &P_rhs, BLAS_Cpp::Transp P_rhs_trans) |
M_lhs += alpha * op(mwo_rhs) * op(P_rhs). More... | |
virtual bool | Mp_StPtM (MatrixOp *mwo_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs, BLAS_Cpp::Transp P_rhs_trans, BLAS_Cpp::Transp M_trans) const |
mwo_lhs += alpha * op(P_rhs) * op(M_rhs). More... | |
virtual bool | Mp_StPtM (value_type alpha, const GenPermMatrixSlice &P_rhs, BLAS_Cpp::Transp P_rhs_trans, const MatrixOp &mwo_rhs, BLAS_Cpp::Transp M_trans) |
M_lhs += alpha * op(P_rhs) * op(mwo_rhs). More... | |
virtual bool | Mp_StPtMtP (MatrixOp *mwo_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, BLAS_Cpp::Transp M_trans, const GenPermMatrixSlice &P_rhs2, BLAS_Cpp::Transp P_rhs2_trans) const |
mwo_lhs += alpha * op(P_rhs1) * op(M_rhs) * op(P_rhs2). More... | |
virtual bool | Mp_StPtMtP (value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, const MatrixOp &mwo_rhs, BLAS_Cpp::Transp M_trans, const GenPermMatrixSlice &P_rhs2, BLAS_Cpp::Transp P_rhs2_trans) |
M_lhs += alpha * op(P_rhs1) * op(mwo_rhs) * op(P_rhs2). More... | |
virtual void | Vp_StMtV (VectorMutable *v_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2, value_type beta) const =0 |
v_lhs = alpha * op(M_rhs1) * v_rhs2 + beta * v_lhs (BLAS xGEMV) More... | |
virtual void | Vp_StMtV (VectorMutable *v_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const SpVectorSlice &sv_rhs2, value_type beta) const |
v_lhs = alpha * op(M_rhs1) * sv_rhs2 + beta * v_lhs (BLAS xGEMV) More... | |
virtual void | Vp_StPtMtV (VectorMutable *v_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, BLAS_Cpp::Transp M_rhs2_trans, const Vector &v_rhs3, value_type beta) const |
v_lhs = alpha * op(P_rhs1) * op(M_rhs2) * v_rhs3 + beta * v_rhs More... | |
virtual void | Vp_StPtMtV (VectorMutable *v_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, BLAS_Cpp::Transp M_rhs2_trans, const SpVectorSlice &sv_rhs3, value_type beta) const |
v_lhs = alpha * op(P_rhs1) * op(M_rhs2) * sv_rhs3 + beta * v_rhs More... | |
virtual value_type | transVtMtV (const Vector &v_rhs1, BLAS_Cpp::Transp trans_rhs2, const Vector &v_rhs3) const |
result = v_rhs1' * op(M_rhs2) * v_rhs3 More... | |
virtual value_type | transVtMtV (const SpVectorSlice &sv_rhs1, BLAS_Cpp::Transp trans_rhs2, const SpVectorSlice &sv_rhs3) const |
result = sv_rhs1' * op(M_rhs2) * sv_rhs3 More... | |
virtual void | syr2k (BLAS_Cpp::Transp M_trans, value_type alpha, const GenPermMatrixSlice &P1, BLAS_Cpp::Transp P1_trans, const GenPermMatrixSlice &P2, BLAS_Cpp::Transp P2_trans, value_type beta, MatrixSymOp *symwo_lhs) const |
Perform a specialized rank-2k update of a dense symmetric matrix of the form: More... | |
virtual bool | Mp_StMtM (MatrixOp *mwo_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const MatrixOp &mwo_rhs2, BLAS_Cpp::Transp trans_rhs2, value_type beta) const |
mwo_lhs = alpha * op(M_rhs1) * op(mwo_rhs2) + beta * mwo_lhs (left) (xGEMM). More... | |
virtual bool | Mp_StMtM (MatrixOp *mwo_lhs, value_type alpha, const MatrixOp &mwo_rhs1, BLAS_Cpp::Transp trans_rhs1, BLAS_Cpp::Transp trans_rhs2, value_type beta) const |
mwo_lhs = alpha * op(mwo_rhs1) * op(M_rhs2) + beta * mwo_lhs (right) (xGEMM) More... | |
virtual bool | Mp_StMtM (value_type alpha, const MatrixOp &mwo_rhs1, BLAS_Cpp::Transp trans_rhs1, const MatrixOp &mwo_rhs2, BLAS_Cpp::Transp trans_rhs2, value_type beta) |
M_lhs = alpha * op(mwo_rhs1) * op(mwo_rhs2) + beta * mwo_lhs (left) (xGEMM) More... | |
virtual bool | syrk (BLAS_Cpp::Transp M_trans, value_type alpha, value_type beta, MatrixSymOp *sym_lhs) const |
Perform a rank-k update of a symmetric matrix of the form: More... | |
virtual bool | syrk (const MatrixOp &mwo_rhs, BLAS_Cpp::Transp M_trans, value_type alpha, value_type beta) |
Perform a rank-k update of a symmetric matrix of the form: More... | |
Implements D = - inv(C) * N
for a variable reduction projection.
This class is used to implement an implicit matrix defined as
D = - inv(C) * N
The operations y = op(D)*x
are implemented as:
y = D * x = -inv(C) * (N * x) y = D' * x = - N' * (inv(C') * x)
This class also allows the client to set a precomputed matrix D_direct
that represents D = -inv(C)*N
that will be used to extract rows or columns or to implement operations involving GenPermMatrixSlice
when convenient. One might ask why this subclass would even be used if D_direct
was even available. The reason is that it may be cheaper to perform the sparse solve and matrix-vector multiplication with C
and N
than it is to use a dense precomputed matrix D_direct
. Determining if this class is even useful when D_direct
is availible must be determined at runtime using timing data (which can be very hard to do well in general).
This implementation is designed to deal efficiently with the case where matrix- vector multiplications will only be performed with subsets of rows of inv(C)*N
or columns of N'inv(C'). This primarily affects two types of operations:
y = b*y + a[-N'inv(C')]*x (x
is a SpVectorSlice
object)
y = b*y + a*op(P)[-inv(C)*N]*x
(P
has few nonzeros, x is any vector)
when D_direct
is not set then needed rows of inv(C)*N
are generated on the fly (as abstract vectors) and stored away for later use. When this->initialize()
is called then all of these computed rows are discarded and they must be generated again.
Definition at line 91 of file ConstrainedOptPack_MatrixVarReductImplicit.hpp.
typedef Teuchos::RCP<const MatrixOpNonsing> ConstrainedOptPack::MatrixVarReductImplicit::mat_nonsing_ptr_t |
Definition at line 100 of file ConstrainedOptPack_MatrixVarReductImplicit.hpp.
typedef Teuchos::RCP<const MatrixOp> ConstrainedOptPack::MatrixVarReductImplicit::mat_ptr_t |
Definition at line 102 of file ConstrainedOptPack_MatrixVarReductImplicit.hpp.
|
private |
Definition at line 240 of file ConstrainedOptPack_MatrixVarReductImplicit.hpp.
|
private |
Definition at line 241 of file ConstrainedOptPack_MatrixVarReductImplicit.hpp.
|
virtual |
Initialize this
matrix object.
C | [in] Nonsingular basis matrix object. This matrix object must not be altered while this is in use or until this->initialize() is called again. |
N | [in] Genaral nonbasis matrix object. This matrix object must not be altered while this is in use or until this->initialize() is called again. |
D_direct | [in] Matrix object for D = -inv(C)*N already computed. The matrix object D_direct will not be modifed by this and must not be altered while c\ this matrix object is in use or until this->initialize() is called again. D_direct == NULL is allowed and this matrix object will just have to do without. For most applications (except those using direct linear solvers for C and when N has many columns) D_direct should be set to NULL and should not be computed by the client (that is the whole purpose for this matrix class). |
Preconditions:
C.get() != NULL
(throw std::invalid_argument
) N.get() != NULL
(throw std::invalid_argument
) D_direct != NULL
] D_direct->space_cols().is_compatible(C->space_cols()) == true && D_direct->space_rows().is_compatible(N->space_rows()) == true
(throw VectorSpace::IncompatibleVectorSpaces
) Postconditions:
this->C_ptr().get() == C.get()
this->N_ptr().get() == N.get()
this->D_direct_ptr().get() == N.get()
Definition at line 197 of file ConstrainedOptPack_MatrixVarReductImplicit.cpp.
|
virtual |
Set the matrix to uninitialized.
Postconditions:
this->C_ptr().get() == NULL
this->N_ptr().get() == NULL
this->D_direct_ptr().get() == NULL
Definition at line 239 of file ConstrainedOptPack_MatrixVarReductImplicit.cpp.
|
inline |
Return the smart pointer to the aggregate basis matrix object C
.
If this
is the only reference to this matrix object, then return.count() == 1
will be true.
Definition at line 284 of file ConstrainedOptPack_MatrixVarReductImplicit.hpp.
|
inline |
Return the smart pointer to the aggregate nonbasis matrix object N
.
If this
is the only reference to this matrix object, then return.count() == 1
will be true.
Definition at line 291 of file ConstrainedOptPack_MatrixVarReductImplicit.hpp.
|
inline |
Return the smart pointer to the aggregate precomputed matrix object D_direct
(if set).
If this
is the only reference to this matrix object, then return.count() == 1
will be true.
Definition at line 298 of file ConstrainedOptPack_MatrixVarReductImplicit.hpp.
|
virtual |
Reimplemented from AbstractLinAlgPack::MatrixBase.
Definition at line 249 of file ConstrainedOptPack_MatrixVarReductImplicit.cpp.
|
virtual |
Reimplemented from AbstractLinAlgPack::MatrixBase.
Definition at line 254 of file ConstrainedOptPack_MatrixVarReductImplicit.cpp.
|
virtual |
Implements AbstractLinAlgPack::MatrixBase.
Definition at line 261 of file ConstrainedOptPack_MatrixVarReductImplicit.cpp.
|
virtual |
Implements AbstractLinAlgPack::MatrixBase.
Definition at line 267 of file ConstrainedOptPack_MatrixVarReductImplicit.cpp.
MatrixOp & ConstrainedOptPack::MatrixVarReductImplicit::operator= | ( | const MatrixOp & | M | ) |
Definition at line 273 of file ConstrainedOptPack_MatrixVarReductImplicit.cpp.
|
virtual |
Reimplemented from AbstractLinAlgPack::MatrixOp.
Definition at line 280 of file ConstrainedOptPack_MatrixVarReductImplicit.cpp.
void ConstrainedOptPack::MatrixVarReductImplicit::Vp_StMtV | ( | VectorMutable * | v_lhs, |
value_type | alpha, | ||
BLAS_Cpp::Transp | trans_rhs1, | ||
const Vector & | v_rhs2, | ||
value_type | beta | ||
) | const |
Definition at line 289 of file ConstrainedOptPack_MatrixVarReductImplicit.cpp.
void ConstrainedOptPack::MatrixVarReductImplicit::Vp_StMtV | ( | VectorMutable * | v_lhs, |
value_type | alpha, | ||
BLAS_Cpp::Transp | trans_rhs1, | ||
const SpVectorSlice & | sv_rhs2, | ||
value_type | beta | ||
) | const |
Definition at line 300 of file ConstrainedOptPack_MatrixVarReductImplicit.cpp.
void ConstrainedOptPack::MatrixVarReductImplicit::Vp_StPtMtV | ( | VectorMutable * | v_lhs, |
value_type | alpha, | ||
const GenPermMatrixSlice & | P_rhs1, | ||
BLAS_Cpp::Transp | P_rhs1_trans, | ||
BLAS_Cpp::Transp | M_rhs2_trans, | ||
const Vector & | v_rhs3, | ||
value_type | beta | ||
) | const |
Definition at line 358 of file ConstrainedOptPack_MatrixVarReductImplicit.cpp.
void ConstrainedOptPack::MatrixVarReductImplicit::Vp_StPtMtV | ( | VectorMutable * | v_lhs, |
value_type | alpha, | ||
const GenPermMatrixSlice & | P_rhs1, | ||
BLAS_Cpp::Transp | P_rhs1_trans, | ||
BLAS_Cpp::Transp | M_rhs2_trans, | ||
const SpVectorSlice & | sv_rhs3, | ||
value_type | beta | ||
) | const |
Definition at line 388 of file ConstrainedOptPack_MatrixVarReductImplicit.cpp.
|
private |
Definition at line 420 of file ConstrainedOptPack_MatrixVarReductImplicit.cpp.
|
private |
Definition at line 247 of file ConstrainedOptPack_MatrixVarReductImplicit.hpp.
|
private |
Definition at line 248 of file ConstrainedOptPack_MatrixVarReductImplicit.hpp.
|
private |
Definition at line 249 of file ConstrainedOptPack_MatrixVarReductImplicit.hpp.