本文整理汇总了C++中AbstractLinAlgPack::Vt_S方法的典型用法代码示例。如果您正苦于以下问题:C++ AbstractLinAlgPack::Vt_S方法的具体用法?C++ AbstractLinAlgPack::Vt_S怎么用?C++ AbstractLinAlgPack::Vt_S使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AbstractLinAlgPack
的用法示例。
在下文中一共展示了AbstractLinAlgPack::Vt_S方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Vp_StMtV
void MatrixSymPosDefLBFGS::Vp_StMtV(
VectorMutable* y, value_type alpha, BLAS_Cpp::Transp trans_rhs1
, const Vector& x, value_type beta
) const
{
using AbstractLinAlgPack::Vt_S;
using AbstractLinAlgPack::Vp_StV;
using AbstractLinAlgPack::Vp_StMtV;
using LinAlgOpPack::V_StMtV;
using LinAlgOpPack::V_MtV;
typedef VectorDenseEncap vde;
typedef VectorDenseMutableEncap vdme;
using Teuchos::Workspace;
Teuchos::WorkspaceStore* wss = Teuchos::get_default_workspace_store().get();
assert_initialized();
TEUCHOS_TEST_FOR_EXCEPT( !( original_is_updated_ ) ); // For now just always update
// y = b*y + Bk * x
//
// y = b*y + (1/gk)*x - [ (1/gk)*S Y ] * inv(Q) * [ (1/gk)*S' ] * x
// [ Y' ]
// Perform the following operations (in order):
//
// y = b*y
//
// y += (1/gk)*x
//
// t1 = [ (1/gk)*S'*x ] <: R^(2*m)
// [ Y'*x ]
//
// t2 = inv(Q) * t1 <: R^(2*m)
//
// y += -(1/gk) * S * t2(1:m)
//
// y += -1.0 * Y * t2(m+1,2m)
const value_type
invgk = 1.0 / gamma_k_;
// y = b*y
Vt_S( y, beta );
// y += (1/gk)*x
Vp_StV( y, invgk, x );
if( !m_bar_ )
return; // No updates have been added yet.
const multi_vec_ptr_t
S = this->S(),
Y = this->Y();
// Get workspace
const size_type
mb = m_bar_;
Workspace<value_type> t1_ws(wss,2*mb);
DVectorSlice t1(&t1_ws[0],t1_ws.size());
Workspace<value_type> t2_ws(wss,2*mb);
DVectorSlice t2(&t2_ws[0],t2_ws.size());
VectorSpace::vec_mut_ptr_t
t = S->space_rows().create_member();
// t1 = [ (1/gk)*S'*x ]
// [ Y'*x ]
V_StMtV( t.get(), invgk, *S, BLAS_Cpp::trans, x );
t1(1,mb) = vde(*t)();
V_MtV( t.get(), *Y, BLAS_Cpp::trans, x );
t1(mb+1,2*mb) = vde(*t)();
// t2 = inv(Q) * t1
V_invQtV( &t2, t1 );
// y += -(1/gk) * S * t2(1:m)
(vdme(*t)() = t2(1,mb));
Vp_StMtV( y, -invgk, *S, BLAS_Cpp::no_trans, *t );
// y += -1.0 * Y * t2(m+1,2m
(vdme(*t)() = t2(mb+1,2*mb));
Vp_StMtV( y, -1.0, *Y, BLAS_Cpp::no_trans, *t );
}