62 namespace LinAlgOpPack {
68 namespace AbstractLinAlgPack {
126 if( !sv_rhs2.
nz() ) {
128 if(beta==0.0) *vs_lhs = 0.0;
135 this->
Vp_StMtV( vs_lhs, alpha, trans_rhs1, vs_rhs2, beta );
140 this->
Vp_StMtV( vs_lhs, alpha, trans_rhs1, v_rhs2(), beta );
178 this->
Vp_StMtV( &tmp(), 1.0, M_trans, x2, 0.0 );
186 if( !x1.
nz() || !x2.
nz() ) {
192 return this->
transVtMtV( x1_d, M_trans, x1_d );
195 this->
Vp_StMtV( &tmp(), 1.0, M_trans, x2, 0.0 );
245 M_rows = this->
rows(),
246 M_cols = this->
cols(),
250 , P1_in.
rows(), P1_in.
cols(), P1_trans );
252 M_rows, M_cols, M_trans_in
253 , P2_in.
rows(), P2_in.
cols(), P2_trans );
259 reorder_P1_P2 = (
rows( P1_in.
rows(), P1_in.
cols(), P1_trans )
262 &P1 = reorder_P1_P2 ? P2_in : P1_in,
263 &P2 = reorder_P1_P2 ? P1_in : P2_in;
265 M_trans = reorder_P1_P2 ?
trans_not(M_trans_in) : M_trans_in;
275 i_k = P1_trans ==
no_trans ? P1_itr->row_i() : P1_itr->col_j(),
276 j_k = P1_trans ==
no_trans ? P1_itr->col_j() : P1_itr->row_i();
345 if( size_A < size_B ) {
398 M_rows = this->
rows(),
399 M_cols = this->
cols(),
400 opM_rows =
rows( M_rows, M_cols, M_trans ),
401 opM_cols =
cols( M_rows, M_cols, M_trans ),
405 ,M_rows, M_cols, M_trans
416 Workspace<value_type> t1_ws(wss,opM_cols),
419 t2(&t2_ws[0],t2_ws.size());
420 for(
size_type j = 1; j <= opM_rows; ++j ) {
523 this->
Vp_StMtV( &vs_lhs(), alpha, trans_rhs1, vs_rhs2(), beta );
531 this->
Vp_StMtV( &vs_lhs(), alpha, trans_rhs1, sv_rhs2, beta );
542 this->
Vp_StPtMtV( &vs_lhs(), alpha, P_rhs1, P_rhs1_trans, M_rhs2_trans, vs_rhs3(), beta );
552 this->
Vp_StPtMtV( &vs_lhs(), alpha, P_rhs1, P_rhs1_trans, M_rhs2_trans, sv_rhs3, beta );
557 ,
const Vector& v_rhs3)
const
561 return this->
transVtMtV(vs_rhs1(),trans_rhs2,vs_rhs3());
577 M_trans,alpha,P1,P1_trans,P2,P2_trans,beta
591 if(
const MatrixOpGetGMS* mwo_gms_rhs2 = dynamic_cast<const MatrixOpGetGMS*>(&mwo_rhs2)) {
597 if(
const MatrixSymOpGetGMSSym* mwo_sym_gms_rhs2 = dynamic_cast<const MatrixSymOpGetGMSSym*>(&mwo_rhs2)) {
603 if(
const MatrixOpGetGMSTri* mwo_tri_gms_rhs2 = dynamic_cast<const MatrixOpGetGMSTri*>(&mwo_rhs2)) {
friend void syr2k(const MatrixOp &M, 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)
DVectorSlice row(DMatrixSlice &gms, BLAS_Cpp::Transp trans, size_type i)
Abstract interface for immutable, finite dimensional, coordinate vectors {abstract}.
void Vp_StV(DVectorSlice *vs_lhs, value_type alpha, const DVectorSlice &vs_rhs)
vs_lhs += alpha * vs_rhs (BLAS xAXPY)
size_type dim() const
Returns the number of elements of the VectorSliceTmpl.
std::ostream & output(std::ostream &out) const
size_type dim() const
Return the number of elements in the full vector.
virtual value_type transVtMtV(const DVectorSlice &vs_rhs1, BLAS_Cpp::Transp trans_rhs2, const DVectorSlice &vs_rhs3) const
result = vs_rhs1' * op(M_rhs2) * vs_rhs3
virtual void Vp_StPtMtV(DVectorSlice *vs_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, BLAS_Cpp::Transp M_rhs2_trans, const DVectorSlice &vs_rhs3, value_type beta) const
vs_lhs = alpha * op(P_rhs1) * op(M_rhs2) * vs_rhs3 + beta * vs_rhs
void Mp_StMtM(MatrixOp *mwo_lhs, value_type alpha, const MatrixOp &mwo_rhs1, BLAS_Cpp::Transp trans_rhs1, const MatrixOp &mwo_rhs2, BLAS_Cpp::Transp trans_rhs2, value_type beta=1.0)
mwo_lhs = alpha * op(mwo_rhs1) * op(mwo_rhs2) + beta * mwo_lhs (right) (xGEMM).
void MtM_assert_sizes(size_type m_rhs1_rows, size_type m_rhs1_cols, BLAS_Cpp::Transp trans_rhs1, size_type m_rhs2_rows, size_type m_rhs2_cols, BLAS_Cpp::Transp trans_rhs2)
op(m_lhs) += op(m_rhs1)
Mix-in interface that allows the extraction of a const DenseLinAlgPack::DMatrixSliceTri view of an no...
size_type cols() const
Return the number of columns.
void Vp_StPtMtV(VectorMutable *v_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, const MatrixOp &M_rhs2, BLAS_Cpp::Transp M_rhs2_trans, const Vector &v_rhs3, value_type beta=1.0)
v_lhs = alpha * op(P_rhs1) * op(M_rhs2) * v_rhs3 + beta * v_rhs
RTOp_value_type value_type
void Vp_StV(VectorMutable *v_lhs, const value_type &alpha, const Vector &v_rhs)
v_lhs = alpha * v_rhs + v_lhs
size_type rows(size_type rows, size_type cols, BLAS_Cpp::Transp _trans)
Return rows of a possible transposed matrix.
void assign(VectorMutable *v_lhs, const V &V_rhs)
v_lhs = V_rhs.
Abstract interface that allows the extraction of a non-const DenseLinAlgPack::DMatrixSliceSym view of...
VectorSpaceSerial space_cols_
const VectorSpace & space_cols() const
void Mp_MtM_assert_sizes(size_type m_lhs_rows, size_type m_lhs_cols, BLAS_Cpp::Transp trans_lhs, size_type m_rhs1_rows, size_type m_rhs1_cols, BLAS_Cpp::Transp trans_rhs1, size_type m_rhs2_rows, size_type m_rhs2_cols, BLAS_Cpp::Transp trans_rhs2)
op(m_lhs) += op(m_rhs1) * op(m_rhs2)
const_iterator end() const
Return the end of this->const_iterator_begin().
void Mp_M_assert_sizes(size_type m_lhs_rows, size_type m_lhs_cols, BLAS_Cpp::Transp trans_lhs, size_type m_rhs_rows, size_type m_rhs_cols, BLAS_Cpp::Transp trans_rhs)
op(m_lhs) += op op(m_rhs)
BLAS_Cpp::Uplo uplo() const
bool is_sorted() const
Return true if the sequence is assumed sorted.
void V_StMtV(VectorMutable *v_lhs, value_type alpha, const MatrixOp &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const V &V_rhs2)
v_lhs = alpha * op(M_rhs1) * V_rhs2.
friend void Mp_StPtMtP(MatrixOp *mwo_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, const MatrixOp &M_rhs, BLAS_Cpp::Transp trans_rhs, const GenPermMatrixSlice &P_rhs2, BLAS_Cpp::Transp P_rhs2_trans)
Base class for all matrices implemented in a shared memory address space.
Interface adding operations specific for a symmetric matrix {abstract}.
void Vp_MtV(VectorMutable *v_lhs, const MatrixOp &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const V &V_rhs2)
v_lhs += op(M_rhs1) * V_rhs2.
virtual size_type cols() const
Return the number of columns in the matrix.
This is a full random access iterator for accessing row and colunmn indices.
RTOp_index_type size_type
Abstract interface for objects that represent a space for mutable coordinate vectors.
virtual void syrk(BLAS_Cpp::Transp M_trans, value_type alpha, value_type beta, DMatrixSliceSym *sym_lhs) const
Perform a rank-k update of a dense symmetric matrix of the form:
const_iterator begin() const
Return a random access iterator for accessing which row and column that each nonzero 1...
friend void Mp_StMtM(MatrixOp *mwo_lhs, value_type alpha, const MatrixOp &mwo_rhs1, BLAS_Cpp::Transp trans_rhs1, const MatrixOp &mwo_rhs2, BLAS_Cpp::Transp trans_rhs2, value_type beta)
Extract a constant DenseLinAlgPack::DVectorSlice view of a Vector object.
Helper class type that simplifies the usage of the MatrixSymOpGetGMSSymMutable interface for clients...
void Mt_S(DMatrixSlice *gms_lhs, value_type alpha)
gms_lhs *= alpha (BLAS xSCAL)
index_type dim() const
Returns 0 if uninitialized.
VectorSpaceSerial space_rows_
virtual void Mp_StMtM(DMatrixSlice *gms_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice &gms_rhs2, BLAS_Cpp::Transp trans_rhs2, value_type beta) const
gms_lhs = alpha * op(M_rhs1) * op(gms_rhs2) + beta * gms_lhs (right) (xGEMM)
Create an eta vector (scaled by alpha = default 1).
virtual void Mp_StPtMtP(DMatrixSlice *gms_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
gms_lhs += alpha * op(P_rhs1) * op(M_rhs) * op(P_rhs2)
f_dbl_prec f_dbl_prec f_dbl_prec * S
void Mp_StM(MatrixOp *mwo_lhs, value_type alpha, const MatrixOp &M_rhs, BLAS_Cpp::Transp trans_rhs)
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)
DVectorSlice col(DMatrixSlice &gms, BLAS_Cpp::Transp trans, size_type j)
void uninitialized_resize(size_type size, size_type nz, size_type max_nz, difference_type offset=0)
Resize to #size# with a max_nz# uninitialized non-zero elements.
friend void Mp_StM(MatrixOp *mwo_lhs, value_type alpha, const MatrixOp &M_rhs, BLAS_Cpp::Transp trans_rhs)
Abstract interface that allows the extraction of a const DMatrixSlice view of an abstract matrix...
DMatrixSliceTriEle nonconst_tri_ele(DMatrixSlice gms, BLAS_Cpp::Uplo uplo)
Return a triangular element-wise matrix.
const f_int f_dbl_prec a[]
Helper class type that simplifies the usage of the MatrixOpGetGMS interface for clients.
EOverLap overlap(const SparseVectorSlice< T_Element > &sv) const
Base class for all matrices that support basic matrix operations.
const VectorSpace & space_rows() const
value_type dot(const Vector &v_rhs1, const Vector &v_rhs2)
result = v_rhs1' * v_rhs2
DVectorSlice dense_view(SpVectorSlice &sv_rhs)
Create a dense representation of a sparse vector.
virtual void Mp_StMtP(DMatrixSlice *gms_lhs, value_type alpha, BLAS_Cpp::Transp M_trans, const GenPermMatrixSlice &P_rhs, BLAS_Cpp::Transp P_rhs_trans) const
gms_lhs += alpha * op(M_rhs) * op(P_rhs)
void assign(DMatrix &gm_lhs, const T_Matrix &gm_rhs, BLAS_Cpp::Transp trans_rhs)
gm_lhs = T_M (templated matrix type T_M)
const f_dbl_prec const f_int const f_int const f_int f_dbl_prec rhs[]
Abstract interface that allows the extraction of a const DenseLinAlgPack::DMatrixSliceSym view of an ...
Transp trans_not(Transp _trans)
Return the opposite of the transpose argument.
void initialize(size_type dim)
Initialize given the dimension of the vector space.
size_type rows() const
Return the number of rows.
void Vt_S(DVectorSlice *vs_lhs, value_type alpha)
vs_lhs *= alpha (BLAS xSCAL) (*** Note that alpha == 0.0 is handeled as vs_lhs = 0.0)
virtual void Vp_StMtV(DVectorSlice *vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const DVectorSlice &vs_rhs2, value_type beta) const =0
vs_lhs = alpha * op(M_rhs1) * vs_rhs2 + beta * vs_lhs (BLAS xGEMV)
friend void Mp_StMtP(MatrixOp *mwo_lhs, value_type alpha, const MatrixOp &M_rhs, BLAS_Cpp::Transp M_trans, const GenPermMatrixSlice &P_rhs, BLAS_Cpp::Transp P_rhs_trans)
Abstract interface that allows the extraction of a non-const DMatrixSlice view of an abstract matrix...
virtual void Mp_StM(DMatrixSlice *gms_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs) const
gms_lhs += alpha * op(M_rhs) (BLAS xAXPY)
void V_MtV(VectorMutable *v_lhs, const MatrixOp &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const V &V_rhs2)
v_lhs = op(M_rhs1) * V_rhs2.
Abstract interface for mutable coordinate vectors {abstract}.
void Vp_MtV_assert_sizes(size_type v_lhs_size, size_type m_rhs1_rows, size_type m_rhs1_cols, BLAS_Cpp::Transp trans_rhs1, size_type v_rhs2_size)
v_lhs += op(m_rhs1) * v_rhs2
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, DMatrixSliceSym *sym_lhs) const
Perform a specialized rank-2k update of a dense symmetric matrix of the form:
void initialize(index_type index, value_type value)
Initialize.
Extract a non-const DenseLinAlgPack::DVectorSlice view of a VectorMutable object. ...
virtual size_type rows() const
Return the number of rows in the matrix.
friend void syrk(const MatrixOp &mwo_rhs, BLAS_Cpp::Transp M_trans, value_type alpha, value_type beta, MatrixSymOp *sym_lhs)
virtual void Mp_StPtM(DMatrixSlice *gms_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs, BLAS_Cpp::Transp P_rhs_trans, BLAS_Cpp::Transp M_trans) const
gms_lhs += alpha * op(P) * op(M_rhs)
DVectorSlice col(size_type j)
Return DVectorSlice object representing the jth column (1-based; 1,2,..,#this->cols()#, or throw std::out_of_range)
size_type cols(size_type rows, size_type cols, BLAS_Cpp::Transp _trans)
Return columns of a possible transposed matrix.
iterator begin()
Returns iterator that iterates forward through the nonzero elements.
size_type nz() const
Return the number of non-zero elements.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
TEUCHOSCORE_LIB_DLL_EXPORT Teuchos::RCP< WorkspaceStore > get_default_workspace_store()
Concrete matrix type to represent general permutation (mapping) matrices.
friend void Mp_StPtM(MatrixOp *mwo_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs, BLAS_Cpp::Transp P_rhs_trans, const MatrixOp &M_rhs, BLAS_Cpp::Transp M_trans)
value_type dot(const DVectorSlice &vs_rhs1, const DVectorSlice &vs_rhs2)
result = vs_rhs1' * vs_rhs2 (BLAS xDOT)
Helper class type that simplifies the usage of the MatrixOpGetGMSMutable interface for clients...
DVectorSlice row(size_type i)
Return DVectorSlice object representing the ith row (1-based; 1,2,..,#this->rows()#, or throw std::out_of_range)