44 #ifndef MATRIX_VECTOR_TEMPLATE_OP_DEF_H
45 #define MATRIX_VECTOR_TEMPLATE_OP_DEF_H
58 template<
class T_Matrix>
66 for(
int k = 1; k <= gm_rhs.cols(); ++k)
74 template<
class T_Matrix>
80 imp_assign(gms_lhs,gm_rhs,trans_rhs);
84 template<
class T_Matrix>
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();
116 for(size_type i = 1; i <=
rows; ++i)
120 template<
class T_Matrix>
125 size_type cols = gm_rhs1.cols();
127 for(size_type j = 1; j <=
cols; ++j)
135 template<
class T_Matrix>
139 imp_assert_V_MtV_rhs_sizes(gm_rhs1,trans_rhs1,vs_rhs2);
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>
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
AbstractLinAlgPack::size_type size_type
DenseLinAlgPack::size_type size_type
size_type rows(size_type rows, size_type cols, BLAS_Cpp::Transp _trans)
Return rows of a possible transposed matrix.
void resize(size_type n, value_type val=value_type())
C++ Standard Library compatable iterator class for accesing nonunit stride arrays of data...
void assert_gms_lhs(const DMatrixSlice &gms_lhs, size_type rows, size_type cols, BLAS_Cpp::Transp trans_rhs=BLAS_Cpp::no_trans)
size_type rows() const
Return the number of rows.
value_type dot(const Vector &v_rhs1, const Vector &v_rhs2)
result = v_rhs1' * v_rhs2
void assign(DMatrix &gm_lhs, const T_Matrix &gm_rhs, BLAS_Cpp::Transp trans_rhs)
gm_lhs = T_M (templated matrix type T_M)
DenseLinAlgPack::VectorSliceTmpl< value_type > DVectorSlice
size_type rows() const
Return the number of rows.
void resize_gm_lhs(DMatrix *gm_rhs, size_type rows, size_type cols, BLAS_Cpp::Transp trans_rhs)
Utility to resize a DMatrix to the size of a rhs matrix.
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.
void V_MtV(DVector &v_lhs, const T_Matrix &gm_rhs1, BLAS_Cpp::Transp trans_rhs1, const DVectorSlice &vs_rhs2)
v_lhs = T_M * vs_lhs (templated matrix type T_M)
DVectorSlice row(size_type i)
Return DVectorSlice object representing the ith row (1-based; 1,2,..,#this->rows()#, or throw std::out_of_range)