本文整理汇总了C++中IntervalMatrix::put方法的典型用法代码示例。如果您正苦于以下问题:C++ IntervalMatrix::put方法的具体用法?C++ IntervalMatrix::put怎么用?C++ IntervalMatrix::put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IntervalMatrix
的用法示例。
在下文中一共展示了IntervalMatrix::put方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: jacobian
void FncKhunTucker::jacobian(const IntervalVector& x_lambda, IntervalMatrix& J, const BitSet& components, int v) const {
if (components.size()!=n+nb_mult) {
not_implemented("FncKhunTucker: 'jacobian' for selected components");
//J.resize(n+nb_mult,n+nb_mult);
}
IntervalVector x=x_lambda.subvector(0,n-1);
int lambda0=n; // The index of lambda0 in the box x_lambda is nb_var.
int l=lambda0; // mutipliers indices counter. The first multiplier is lambda0.
// matrix corresponding to the "Hessian expression" lambda_0*d^2f+lambda_1*d^2g_1+...=0
IntervalMatrix hessian=x_lambda[l] * df.jacobian(x,v<n? v : -1); // init
if (v==-1 || v==l) J.put(0, l, df.eval_vector(x), false);
l++;
IntervalVector gx;
if (!active.empty())
gx = sys.f_ctrs.eval_vector(x,active);
// normalization equation (init)
J[lambda0].put(0,Vector::zeros(n));
J[lambda0][lambda0]=1.0;
IntervalVector dgi(n); // store dg_i([x]) (used in several places)
for (BitSet::const_iterator i=ineq.begin(); i!=ineq.end(); ++i) {
hessian += x_lambda[l] * dg[i].jacobian(x,v<n? v : -1);
dgi=dg[i].eval_vector(x);
J.put(0, l, dgi, false);
J.put(l, 0, (x_lambda[l]*dgi), true);
J.put(l, n, Vector::zeros(nb_mult), true);
J[l][l]=gx[i];
J[lambda0][l] = 1.0;
l++;
}
for (BitSet::const_iterator i=ineq.begin(); i!=ineq.end(); ++i) {
hessian += x_lambda[l] * dg[i].jacobian(x,v<n? v : -1);
dgi=dg[i].eval_vector(x);
J.put(0, l, dgi, false);
J.put(l, 0, dgi, true);
J.put(l, n, Vector::zeros(nb_mult), true);
J[lambda0][l] = 2*x_lambda[l];
l++;
}
for (BitSet::const_iterator v=bound_left.begin(); v!=bound_left.end(); ++v) {
// this constraint does not contribute to the "Hessian expression"
dgi=Vector::zeros(n);
dgi[v]=-1.0;
J.put(0, l, dgi, false);
J.put(l, 0, (x_lambda[l]*dgi), true);
J.put(l, n, Vector::zeros(nb_mult), true);
J[l][l]=(-x[v]+sys.box[v].lb());
J[lambda0][l] = 1.0;
l++;
}
for (BitSet::const_iterator v=bound_right.begin(); v!=bound_right.end(); ++v) {
// this constraint does not contribute to the "Hessian expression"
dgi=Vector::zeros(n);
dgi[v]=1.0;
J.put(0, l, dgi, false);
J.put(l, 0, (x_lambda[l]*dgi), true);
J.put(l, n, Vector::zeros(nb_mult), true);
J[l][l]=(x[v]-sys.box[v].ub());
J[lambda0][l] = 1.0;
l++;
}
assert(l==nb_mult+n);
J.put(0,0,hessian);
}