42 #ifndef DENSE_V_P_S_T_P_T_M_T_V_H
43 #define DENSE_V_P_S_T_P_T_M_T_V_H
45 #include "AbstractLinAlgPack/src/AbstractLinAlgPack_SpVectorClass.hpp"
46 #include "AbstractLinAlgPack_SpVectorOp.hpp"
47 #include "AbstractLinAlgPack/src/AbstractLinAlgPack_EtaVector.hpp"
48 #include "AbstractLinAlgPack/src/AbstractLinAlgPack_GenPermMatrixSlice.hpp"
49 #include "AbstractLinAlgPack_GenPermMatrixSliceOp.hpp"
50 #include "AbstractLinAlgPack_LinAlgOpPackHack.hpp"
51 #include "DenseLinAlgPack_DMatrixClass.hpp"
52 #include "DenseLinAlgPack_DMatrixOut.hpp"
53 #include "DenseLinAlgPack_AssertOp.hpp"
54 #include "MiWorkspacePack.h"
56 namespace AbstractLinAlgPack {
64 template<
class M_t,
class V_t>
65 void dense_Vp_StPtMtV(
68 ,
const GenPermMatrixSlice &P
82 using DenseLinAlgPack::DVector;
98 opM_rows =
rows( M.rows(), M.cols(), M_trans ),
99 opM_cols =
cols( M.rows(), M.cols(), M_trans );
100 if( ny !=
rows( P.rows(), P.cols(), P_trans )
102 ||
cols( P.rows(), P.cols(), P_trans ) != opM_rows )
103 throw std::length_error(
"MatrixOp::Vp_StPtMtV(...) : Error, "
104 "sizes of arguments does not match up" );
118 else if(b!=1.0)
Vt_S(y,b);
120 else if( opM_rows > P.nz() || P.is_identity() ) {
122 Workspace<value_type> t_ws(wss,opM_rows);
123 DVectorSlice t(&t_ws[0],t_ws.size());
124 LinAlgOpPack::V_MtV( &t, M, M_trans, x );
126 Vp_StMtV( y, a, P, P_trans, t(), b );
131 else if(b!=1.0)
Vt_S(y,b);
133 Workspace<value_type> t_ws(wss,opM_cols);
134 DVectorSlice t(&t_ws[0],t_ws.size());
135 if( P.is_identity() ) {
136 for(
size_type k = 1; k <= P.nz(); ++k ) {
141 LinAlgOpPack::V_MtV( &t, M,
trans_not(M_trans), eta(j,opM_rows)() );
143 (*y)(i) += a *
dot( t(), x );
149 i = P_trans ==
no_trans ? itr->row_i() : itr->col_j(),
150 j = P_trans ==
no_trans ? itr->col_j() : itr->row_i();
152 LinAlgOpPack::V_MtV( &t, M,
trans_not(M_trans), eta(j,opM_rows)() );
154 (*y)(i) += a *
dot( t(), x );
162 #endif // DENSE_V_P_S_T_P_T_M_T_V_H
void Vt_S(VectorMutable *v_lhs, const value_type &alpha)
v_lhs *= alpha
size_type rows(size_type rows, size_type cols, BLAS_Cpp::Transp _trans)
Create an eta vector (scaled by alpha = default 1).
void Vp_StMtV(VectorMutable *v_lhs, value_type alpha, const MatrixOp &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2, value_type beta=1.0)
v_lhs = alpha * op(M_rhs1) * v_rhs2 + beta * v_lhs (BLAS xGEMV)
value_type dot(const Vector &v_rhs1, const Vector &v_rhs2)
result = v_rhs1' * v_rhs2
Transp trans_not(Transp _trans)
size_type cols(size_type rows, size_type cols, BLAS_Cpp::Transp _trans)
TEUCHOSCORE_LIB_DLL_EXPORT Teuchos::RCP< WorkspaceStore > get_default_workspace_store()
Concrete matrix type to represent general permutation (mapping) matrices.
GenPermMatrixSliceIteratorPack::row_col_iterator< const index_type > const_iterator