Skip to content

Commit a44d355

Browse files
committed
fixing ci runtime errors
1 parent df028e9 commit a44d355

File tree

3 files changed

+26
-12
lines changed

3 files changed

+26
-12
lines changed

src/Optimization/InnerProduct.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,15 @@ bool InnerProduct::apply_M(const hiopVector& x, hiopVector& y) const
9292
return true;
9393
}
9494
}
95-
95+
96+
// Applies lumped mass matrix;
97+
bool InnerProduct::apply_M_lumped(const hiopVector& x, hiopVector& y) const
98+
{
99+
y.copyFrom(x);
100+
y.componentMult(*M_lumped());
101+
return true;
102+
}
103+
96104
// Computes ||x||_M
97105
double InnerProduct::norm_M(const hiopVector& x) const
98106
{
@@ -130,9 +138,12 @@ double InnerProduct::norm_H_dual(const hiopVector& x) const
130138
double InnerProduct::norm_stationarity(const hiopVector& x) const
131139
{
132140
if(nlp_->useWeightedInnerProd()) {
133-
nlp_->eval_H_inv(x, *vec_n_);
134-
auto dp = x.dotProductWith(*vec_n_);
135-
return ::std::sqrt(dp);
141+
//nlp_->eval_H_inv(x, *vec_n_);
142+
//auto dp = x.dotProductWith(*vec_n_);
143+
//return ::std::sqrt(dp);
144+
vec_n_->copyFrom(x);
145+
vec_n_->componentDiv(*M_lumped());
146+
return vec_n_->infnorm();
136147
} else {
137148
return x.infnorm();
138149
}

src/Optimization/InnerProduct.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ class InnerProduct
8888

8989
// Compute y=M*x
9090
bool apply_M(const hiopVector& x, hiopVector& y) const;
91+
92+
// Appply lumped mass matrix, y=M_lumped*x
93+
bool apply_M_lumped(const hiopVector& x, hiopVector& y) const;
9194

9295
// Computes ||x||_M
9396
double norm_M(const hiopVector& x) const;

src/Optimization/hiopResidual.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ int hiopResidual::update(const hiopIterate& it,
186186
//using rxl as auxiliary variable to compute -M*zl+M*zu
187187
rxl->copyFrom(*it.zu);
188188
rxl->axpy(-1.0, *it.zl);
189-
nlp->inner_prod()->apply_M(*rxl, *rx);
189+
nlp->inner_prod()->apply_M_lumped(*rxl, *rx);
190190
//continue adding to rx
191191
jac_c.transTimesVec(1.0, *rx, 1.0, *it.yc);
192192
jac_d.transTimesVec(1.0, *rx, 1.0, *it.yd);
@@ -258,28 +258,28 @@ int hiopResidual::update(const hiopIterate& it,
258258
nlp->log->printf(hovScalars, "NLP resid [update]: inf norm ryd=%22.17e\n", buf);
259259

260260
// rxl=x-sxl-xl
261-
if(nlp->n_low_local() > 0) {
261+
if(nlp->n_low() > 0) {
262262
rxl->copyFrom(*it.x);
263263
rxl->axpy(-1.0, *it.sxl);
264264
rxl->axpy(-1.0, nlp->get_xl());
265265
// zero out entries in the resid that don't correspond to a finite low bound
266266
if(nlp->n_low_local() < nx_loc) {
267267
rxl->selectPattern(nlp->get_ixl());
268268
}
269-
buf = rxl->infnorm_local();
269+
buf = rxl->infnorm();
270270
// nrmInf_nlp_feasib = fmax(nrmInf_nlp_feasib, buf);
271271
nlp->log->printf(hovScalars, "NLP resid [update]: inf norm rxl=%22.17e\n", buf);
272272
}
273273
// printf(" %10.4e (xl)", nrmInf_nlp_feasib);
274274
// rxu=-x-sxu+xu
275-
if(nlp->n_upp_local() > 0) {
275+
if(nlp->n_upp() > 0) {
276276
rxu->copyFrom(nlp->get_xu());
277277
rxu->axpy(-1.0, *it.x);
278278
rxu->axpy(-1.0, *it.sxu);
279279
if(nlp->n_upp_local() < nx_loc) {
280280
rxu->selectPattern(nlp->get_ixu());
281281
}
282-
buf = rxu->infnorm_local();
282+
buf = rxu->infnorm();
283283
// nrmInf_nlp_feasib = fmax(nrmInf_nlp_feasib, buf);
284284
nlp->log->printf(hovScalars, "NLP resid [update]: inf norm rxu=%22.17e\n", buf);
285285
}
@@ -311,7 +311,7 @@ int hiopResidual::update(const hiopIterate& it,
311311
nrmOne_bar_feasib = nrmOne_nlp_feasib;
312312

313313
// rszl = \mu e - sxl * zl
314-
if(nlp->n_low_local() > 0) { //! n_low()
314+
if(nlp->n_low() > 0) { //! n_low()
315315
rszl->setToZero();
316316
rszl->axzpy(-1.0, *it.sxl, *it.zl);
317317
if(nlp->n_low_local() < nx_loc) {
@@ -328,7 +328,7 @@ int hiopResidual::update(const hiopIterate& it,
328328
nlp->log->printf(hovScalars, "NLP resid [update]: inf norm rszl=%22.17e\n", buf);
329329
}
330330
// rszu = \mu e - sxu * zu
331-
if(nlp->n_upp_local() > 0) { //!
331+
if(nlp->n_upp() > 0) {
332332
rszu->setToZero();
333333
rszu->axzpy(-1.0, *it.sxu, *it.zu);
334334
if(nlp->n_upp_local() < nx_loc) {
@@ -474,7 +474,7 @@ void hiopResidual::update_soc(const hiopIterate& it,
474474
nrmInf_bar_optim = nrmInf_bar_feasib = nrmInf_bar_complem = 0;
475475
nrmOne_nlp_feasib = nrmOne_bar_feasib = 0.;
476476
nrmOne_nlp_optim = nrmOne_bar_optim = 0.;
477-
assert(false);
477+
478478
size_type nx_loc = rx->get_local_size();
479479
const double& mu = logprob.mu;
480480
double buf;

0 commit comments

Comments
 (0)