42 #ifndef COO_MATRIX_TMPL_OP_DEF_H
43 #define COO_MATRIX_TMPL_OP_DEF_H
45 #include "AbstractLinAlgPack_COOMatrixTmplOpDecl.hpp"
47 #include "DenseLinAlgPack_DMatrixClass.hpp"
48 #include "DenseLinAlgPack_DVectorOp.hpp"
49 #include "DenseLinAlgPack_AssertOp.hpp"
51 namespace AbstractLinAlgPack {
55 using DenseLinAlgPack::Mp_M_assert_sizes;
56 using DenseLinAlgPack::Vp_MtV_assert_sizes;
57 using DenseLinAlgPack::Mp_MtM_assert_sizes;
60 template<
class T_COOM>
65 , coom_rhs.rows(), coom_rhs.cols(), trans_rhs );
66 typename T_COOM::difference_type
67 i_o = coom_rhs.row_offset(),
68 j_o = coom_rhs.col_offset();
70 for(
typename T_COOM::const_iterator itr = coom_rhs.begin(); itr != coom_rhs.end(); ++itr)
71 (*gms_lhs)(itr->row_i()+i_o,itr->col_j()+j_o) += alpha * itr->value();
73 for(
typename T_COOM::const_iterator itr = coom_rhs.begin(); itr != coom_rhs.end(); ++itr)
74 (*gms_lhs)(itr->col_j()+j_o,itr->row_i()+i_o) += alpha * itr->value();
78 template<
class T_COOM>
82 Vp_MtV_assert_sizes( vs_lhs->
dim(), coom_rhs1.rows(), coom_rhs1.cols(), trans_rhs1, vs_rhs2.
dim() );
83 typename T_COOM::difference_type
84 i_o = coom_rhs1.row_offset(),
85 j_o = coom_rhs1.col_offset();
87 for(
typename T_COOM::const_iterator itr = coom_rhs1.begin(); itr != coom_rhs1.end(); ++itr)
88 (*vs_lhs)(itr->row_i()+i_o) += alpha * itr->value() * vs_rhs2(itr->col_j()+j_o);
90 for(
typename T_COOM::const_iterator itr = coom_rhs1.begin(); itr != coom_rhs1.end(); ++itr)
91 (*vs_lhs)(itr->col_j()+j_o) += alpha * itr->value() * vs_rhs2(itr->row_i()+i_o);
94 namespace UtilityPack {
97 template<
class T_COOM>
98 void imp_Mp_StMtCOOM(DMatrixSlice& gms_lhs,
BLAS_Cpp::Transp trans_lhs, value_type alpha
106 template<
class T_COOM>
111 , coom_rhs1.rows(), coom_rhs1.cols(), trans_rhs1
112 , gms_rhs2.
rows() ,gms_rhs2.
cols(), trans_rhs2 );
113 UtilityPack::imp_Mp_StMtCOOM( gms_lhs,
BLAS_Cpp::trans, alpha, gms_rhs2
118 template<
class T_COOM>
123 , gms_rhs1.
rows() ,gms_rhs1.
cols(), trans_rhs1
124 , coom_rhs2.rows(), coom_rhs2.cols(), trans_rhs2 );
126 , trans_rhs1, coom_rhs2, trans_rhs2 );
151 namespace UtilityPack {
192 template<
class T_COOM>
193 void imp_Mp_StMtCOOM(DMatrixSlice* gms_lhs,
BLAS_Cpp::Transp trans_lhs, value_type alpha
199 using DenseLinAlgPack::col;
201 typename T_COOM::difference_type
202 i_o = coom_rhs2.row_offset(),
203 j_o = coom_rhs2.col_offset();
204 for(
typename T_COOM::const_iterator itr = coom_rhs2.begin(); itr != coom_rhs2.end(); ++itr) {
205 size_type i =
rows( itr->row_i() + i_o , itr->col_j() + j_o , trans_rhs2 ),
206 j =
cols( itr->row_i() + i_o , itr->col_j() + j_o , trans_rhs2 );
209 , col(gms_rhs1,trans_rhs1,i) );
217 #endif // COO_MATRIX_TMPL_OP_DEF_H
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)
void Mp_StMtCOOM(DMatrixSlice *gms_lhs, value_type alpha, const DMatrixSlice &gms_rhs1, BLAS_Cpp::Transp trans_rhs1, const T_COOM &coom_rhs2, BLAS_Cpp::Transp trans_rhs2)
gms_lhs += alpha * op(gms_rhs1) * op(coom_rhs2) (left) (BLAS xGEMM)
void Mp_StCOOMtM(DMatrixSlice *gms_lhs, value_type alpha, const T_COOM &coom_rhs1, BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice &gms_rhs2, BLAS_Cpp::Transp trans_rhs2)
gms_lhs += alpha * op(coom_rhs1) * op(gms_rhs2) (right) (BLAS xGEMM)
void Mp_StCOOM(DMatrixSlice *gms_lhs, value_type alpha, const T_COOM &coom_rhs, BLAS_Cpp::Transp trans_rhs)
gms_lhs += alpha * op(coom_rhs) (time = O(coom_rhs.nz(), space = O(1))
void Vp_StCOOMtV(DVectorSlice *vs_lhs, value_type alpha, const T_COOM &coom_rhs1, BLAS_Cpp::Transp trans_rhs1, const DVectorSlice &vs_rhs2)
vs_lhs += alpha * op(coom_rhs1) * vs_rhs2 (BLAS xGEMV) (time = O(coom_rhs.nz(), space = O(1)) ...
Transp trans_not(Transp _trans)
size_type cols(size_type rows, size_type cols, BLAS_Cpp::Transp _trans)