44 #include "AbstractLinAlgPack/src/AbstractLinAlgPack_MatrixSymDiagStd.hpp"
45 #include "AbstractLinAlgPack/src/AbstractLinAlgPack_SpVectorClass.hpp"
50 namespace AbstractLinAlgPack {
110 vs_lhs->size(), n, n, trans_rhs1, vs_rhs2.size() );
116 if( vs_rhs2.stride() == 1 && vs_lhs->stride() == 1 ) {
119 *d_itr = diag.raw_ptr(),
120 *x_itr = vs_rhs2.raw_ptr();
122 *y_itr = vs_lhs->raw_ptr(),
123 *y_end = y_itr + vs_lhs->size();
126 while( y_itr != y_end )
127 *y_itr++ = alpha * (*d_itr++) * (*x_itr++);
129 else if( beta == 1.0 ) {
130 while( y_itr != y_end )
131 *y_itr++ += alpha * (*d_itr++) * (*x_itr++);
134 for( ; y_itr != y_end; ++y_itr )
135 *y_itr = beta * (*y_itr) + alpha * (*d_itr++) * (*x_itr++);
141 d_itr = diag.begin(),
142 x_itr = vs_rhs2.begin();
144 y_itr = vs_lhs->begin(),
145 y_end = vs_lhs->end();
146 for( ; y_itr != y_end; ++y_itr, ++d_itr, ++x_itr ) {
147 #ifdef LINALGPACK_CHECK_RANGE
152 *y_itr = beta * (*y_itr) + alpha * (*d_itr) * (*x_itr);
165 , n, n, trans_rhs1, sv_rhs2.size() );
178 ; x_itr != sv_rhs2.end()
181 (*vs_lhs)(x_itr->indice() + sv_rhs2.offset())
182 += alpha *
diag(x_itr->indice() + sv_rhs2.offset()) * x_itr->value();
204 , n, n, trans_rhs1, vs_rhs2.size() );
206 if( vs_rhs2.stride() == 1 && vs_lhs->stride() == 1 ) {
209 *d_itr = diag.raw_ptr(),
210 *x_itr = vs_rhs2.raw_ptr();
212 *y_itr = vs_lhs->raw_ptr(),
213 *y_end = y_itr + vs_lhs->size();
214 while( y_itr != y_end )
215 *y_itr++ = (*x_itr++) / (*d_itr++);
220 d_itr = diag.begin(),
221 x_itr = vs_rhs2.begin();
223 y_itr = vs_lhs->begin(),
224 y_end = vs_lhs->end();
225 for( ; y_itr != y_end; ++y_itr, ++d_itr, ++x_itr ) {
229 *y_itr = (*x_itr)/(*d_itr);
250 , n, n, trans_rhs1, sv_rhs2.size() );
253 ; x_itr != sv_rhs2.end()
256 (*vs_lhs)(x_itr->indice() + sv_rhs2.offset())
257 = x_itr->value() /
diag(x_itr->indice() + sv_rhs2.offset());
VectorSpace::vec_mut_ptr_t diag_
void Vp_StV(DVectorSlice *vs_lhs, value_type alpha, const DVectorSlice &vs_rhs)
vs_lhs += alpha * vs_rhs (BLAS xAXPY)
void init_diagonal(const Vector &diag)
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
MatrixSymDiagStd(const VectorSpace::vec_mut_ptr_t &diag=Teuchos::null, bool unique=true)
Calls this->initialize().
void Vp_StMtV(VectorMutable *v_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2, value_type beta) const
bool Mp_StM(MatrixOp *g_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs) const
Add to a mutable matrix lhs.
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)
const element_type * const_iterator
RTOp_index_type size_type
StrideIterPack::stride_iter< value_type *, value_type, value_type &, value_type *, difference_type > iterator
StrideIterPack::stride_iter< const value_type *, value_type, const value_type &, const value_type *, difference_type > const_iterator
SparseVectorSlice< SparseElement< index_type, value_type > > SpVectorSlice
DenseLinAlgPack::VectorSliceTmpl< value_type > DVectorSlice
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)
void V_InvMtV(VectorMutable *v_lhs, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2) const
void init_identity(const VectorSpace &space_diag, value_type alpha)
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
size_type cols() const
Returns this->rows()
size_type rows() const
Returns 0 if not initalized (this->diag() == NULL).
DenseLinAlgPack::DMatrixSlice DMatrixSlice
VectorMutable & diag()
Give non-const access to the diagonal vector.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)