本文整理汇总了C++中rol::Vector类的典型用法代码示例。如果您正苦于以下问题:C++ Vector类的具体用法?C++ Vector怎么用?C++ Vector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Vector类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AugmentedLagrangian
AugmentedLagrangian(Objective<Real> &obj, EqualityConstraint<Real> &con,
const ROL::Vector<Real> &x, const ROL::Vector<Real> &c)
: mu_(0.0), fval_(0.0), isConEvaluated_(false), ncval_(0), nfval_(0), ngval_(0) {
obj_ = Teuchos::rcp(&obj, false);
con_ = Teuchos::rcp(&con, false);
c_ = c.clone();
dc1_ = x.dual().clone();
dc2_ = c.clone();
lam_ = c.dual().clone();
dlam_ = c.dual().clone();
flag_ = true;
HessianLevel_ = 1;
}
示例2: MoreauYosidaPenalty
MoreauYosidaPenalty(const Teuchos::RCP<Objective<Real> > &obj,
const Teuchos::RCP<BoundConstraint<Real> > &con,
const ROL::Vector<Real> &x, const Real mu = 1.0)
: obj_(obj), con_(con), mu_(mu),
fval_(0), isConEvaluated_(false), nfval_(0), ngval_(0) {
g_ = x.dual().clone();
l_ = x.clone();
l1_ = x.clone();
dl1_ = x.dual().clone();
u_ = x.clone();
u1_ = x.clone();
du1_ = x.dual().clone();
xlam_ = x.clone();
v_ = x.clone();
dv_ = x.dual().clone();
dv2_ = x.dual().clone();
lam_ = x.clone();
tmp_ = x.clone();
con_->setVectorToLowerBound(*l_);
con_->setVectorToUpperBound(*u_);
lam_->zero();
//lam_->set(*u_);
//lam_->plus(*l_);
//lam_->scale(0.5);
}
示例3: 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_);
}
}
示例4:
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);
}
}
示例5: 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);
}
}
示例6:
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();
}
示例7: initialize
void initialize(const ROL::Vector<Real> &x, const ROL::Vector<Real> &s, const ROL::Vector<Real> &g,
Objective<Real> &obj, BoundConstraint<Real> &con) {
LineSearch<Real>::initialize(x,s,g,obj,con);
xnew_ = x.clone();
}