本文整理汇总了C++中rol::Vector::zero方法的典型用法代码示例。如果您正苦于以下问题:C++ Vector::zero方法的具体用法?C++ Vector::zero怎么用?C++ Vector::zero使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rol::Vector
的用法示例。
在下文中一共展示了Vector::zero方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: two
void hessVec_11(ROL::Vector<Real> &hv,
const ROL::Vector<Real> &v,
const ROL::Vector<Real> &u,
const ROL::Vector<Real> &z,
Real &tol) {
if ( useFU_ ) {
hv.zero();
}
else {
Teuchos::RCP<Tpetra::MultiVector<> > hvp
= (Teuchos::dyn_cast<ROL::TpetraMultiVector<Real> >(hv)).getVector();
Teuchos::RCP<const Tpetra::MultiVector<> > vp
= (Teuchos::dyn_cast<const ROL::TpetraMultiVector<Real> >(v)).getVector();
data_->ApplyJacobian1ToVec(hvp, vp);
Real two(2);
hvp->scale(two*scale_);
}
}
示例2:
void gradient_2(ROL::Vector<Real> &g,
const ROL::Vector<Real> &u,
const ROL::Vector<Real> &z,
Real &tol) {
Teuchos::RCP<Tpetra::MultiVector<> > gp
= (Teuchos::dyn_cast<ROL::TpetraMultiVector<Real> >(g)).getVector();
if ( useFU_ ) {
g.zero();
}
else {
Teuchos::RCP<const Tpetra::MultiVector<> > up
= (Teuchos::dyn_cast<const ROL::TpetraMultiVector<Real> >(u)).getVector();
Teuchos::RCP<Tpetra::MultiVector<> > tmp
= Teuchos::rcp(new Tpetra::MultiVector<>(gp->getMap(), 1));
data_->ApplyAdjointJacobian2ToVec (tmp, up, up);
filter_->apply(gp, tmp);
}
}
示例3: catch
void gradient_2(ROL::Vector<Real> &g, const ROL::Vector<Real> &u,
const ROL::Vector<Real> &z, Real &tol ) {
try {
Teuchos::RCP<Tpetra::MultiVector<> > gp =
(Teuchos::dyn_cast<ROL::TpetraMultiVector<Real> >(g)).getVector();
Teuchos::RCP<const Tpetra::MultiVector<> > up =
(Teuchos::dyn_cast<const ROL::TpetraMultiVector<Real> >(u)).getVector();
Teuchos::RCP<const Tpetra::MultiVector<> > zp =
(Teuchos::dyn_cast<const ROL::TpetraMultiVector<Real> >(z)).getVector();
assembler_->assembleQoIGradient2(qoi_,up,zp);
gp->scale(static_cast<Real>(1),*(assembler_->getQoIGradient2()));
}
catch ( Exception::Zero & ez ) {
g.zero();
}
catch ( Exception::NotImplemented & eni ) {
ROL::ParametrizedObjective_SimOpt<Real>::gradient_2(g,u,z,tol);
}
}
示例4:
void applyAdjointHessian_22(ROL::Vector<Real> &ahwv, const ROL::Vector<Real> &w, const ROL::Vector<Real> &v,
const ROL::Vector<Real> &u, const ROL::Vector<Real> &z, Real &tol)
{
ahwv.zero();
}