44 #ifndef MATRIX_VECTOR_TEMPLATE_OP_DEF_H
45 #define MATRIX_VECTOR_TEMPLATE_OP_DEF_H
47 #include "AbstractLinAlgPack_MatrixVectorTemplateOp.hpp"
48 #include "DenseLinAlgPack_DMatrixClass.hpp"
58 template<
class T_Matrix>
66 for(
int k = 1; k <= gm_rhs.cols(); ++k)
74 template<
class T_Matrix>
78 DenseLinAlgPack::resize_gm_lhs(gm_lhs,gm_rhs.rows(),gm_rhs.cols(),trans_rhs);
79 DMatrixSlice gms_lhs = gm_lhs;
80 imp_assign(gms_lhs,gm_rhs,trans_rhs);
84 template<
class T_Matrix>
88 DenseLinAlgPack::assert_gms_lhs(gms_lhs,gm_rhs.rows(),gm_rhs.cols(),trans_rhs);
89 imp_assign(gms_lhs,gm_rhs,trans_rhs);
97 template<
class T_Matrix>
98 void imp_assert_V_MtV_rhs_sizes(
const T_Matrix& gm_rhs1,
BLAS_Cpp::Transp trans_rhs1
104 if(cols != vs_rhs2.size())
105 throw std::length_error(
"V_MtV: The sizes of the rhs expression do not match");
109 template<
class T_Matrix>
114 size_type
rows = gm_rhs1.rows();
115 AbstractLinAlgPack::DVectorSlice::iterator itr_v_lhs = vs_lhs.
begin();
116 for(size_type i = 1; i <=
rows; ++i)
120 template<
class T_Matrix>
125 size_type cols = gm_rhs1.cols();
126 AbstractLinAlgPack::DVectorSlice::iterator itr_v_lhs = vs_lhs.
begin();
127 for(size_type j = 1; j <=
cols; ++j)
135 template<
class T_Matrix>
136 void AbstractLinAlgPack::V_MtV(DVector& v_lhs,
const T_Matrix& gm_rhs1,
BLAS_Cpp::Transp trans_rhs1
137 ,
const DVectorSlice& vs_rhs2)
139 imp_assert_V_MtV_rhs_sizes(gm_rhs1,trans_rhs1,vs_rhs2);
141 DVectorSlice vs_lhs = v_lhs;
143 imp_V_MtV_no_trans(vs_lhs,gm_rhs1,vs_rhs2);
145 imp_V_MtV_trans(vs_lhs,gm_rhs1,vs_rhs2);
148 template<
class T_Matrix>
149 void AbstractLinAlgPack::V_MtV(DVectorSlice& v_lhs,
const T_Matrix& gm_rhs1,
BLAS_Cpp::Transp trans_rhs1
150 ,
const DVectorSlice& vs_rhs2)
152 imp_assert_V_MtV_rhs_sizes(gm_rhs1,trans_rhs1,vs_rhs2);
153 DenseLinAlgPack::assert_resize_vs_lhs(v_lhs, (trans_rhs1==
BLAS_Cpp::no_trans) ? gm_rhs1.rows() : gm_rhs1.cols());
155 imp_V_MtV_no_trans(v_lhs,gm_rhs1,vs_rhs2);
157 imp_V_MtV_trans(v_lhs,gm_rhs1,vs_rhs2);
160 #endif // MATRIX_VECTOR_TEMPLATE_OP_DEF_H
size_type rows(size_type rows, size_type cols, BLAS_Cpp::Transp _trans)
void assign(VectorMutable *v_lhs, const V &V_rhs)
v_lhs = V_rhs.
const_iterator begin() const
value_type dot(const Vector &v_rhs1, const Vector &v_rhs2)
result = v_rhs1' * v_rhs2
DVectorSlice col(size_type j)
size_type cols(size_type rows, size_type cols, BLAS_Cpp::Transp _trans)
DVectorSlice row(size_type i)