Skip to content

Commit 2e62c25

Browse files
committed
update
1 parent d8fcaa3 commit 2e62c25

File tree

2 files changed

+24
-23
lines changed

2 files changed

+24
-23
lines changed

src/Optimization/hiopHessianLowRank.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ hiopHessianLowRank::hiopHessianLowRank(hiopNlpDenseConstraints* nlp, int max_mem
108108
#ifdef HIOP_USE_MPI
109109
buff_kxk_ = new double[nlp->m() * nlp->m()];
110110
buff_2lxk_ = new double[nlp->m() * 2 * l_max_];
111-
buff1_lxlx3_ = new double[3*l_max_ * l_max_];
112-
buff2_lxlx3_ = new double[3*l_max_ * l_max_];
111+
buff1_lxlx3_ = new double[3 * l_max_ * l_max_];
112+
buff2_lxlx3_ = new double[3 * l_max_ * l_max_];
113113
#else
114114
//not needed in non-MPI mode
115115
buff_kxk_ = nullptr;
@@ -452,7 +452,7 @@ void hiopHessianLowRank::updateInternalBFGSRepresentation()
452452
B0DhInv.scale(sigma_);
453453
matTimesDiagTimesMatTrans_local(StB0DhInvYmL, *St_, B0DhInv, *Yt_);
454454
#ifdef HIOP_USE_MPI
455-
memcpy(buff1_lxlx3_+l*l, StB0DhInvYmL.local_data(), buffsize);
455+
memcpy(buff1_lxlx3_ + l * l, StB0DhInvYmL.local_data(), buffsize);
456456
#else
457457
//substract L
458458
StB0DhInvYmL.addMatrix(-1.0, *L_);

src/Optimization/hiopHessianLowRank.hpp

+21-20
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ class hiopHessianLowRank : public hiopMatrix
160160
//these are matrices from the compact representation; they are updated at each iteration.
161161
// more exactly Bk=B0-[B0*St' Yt']*[St*B0*St' L]*[St*B0]
162162
// [ L' -D] [Yt ]
163-
hiopMatrixDense *St_;
164-
hiopMatrixDense *Yt_; //we store the transpose to easily access columns in S and T
165-
hiopMatrixDense *L_; //lower triangular from the compact representation
163+
hiopMatrixDense* St_;
164+
hiopMatrixDense* Yt_; //we store the transpose to easily access columns in S and T
165+
hiopMatrixDense* L_; //lower triangular from the compact representation
166166
hiopVector* D_; //diag
167167
//these are matrices from the representation of the inverse
168168
hiopMatrixDense* V_;
@@ -175,10 +175,10 @@ class hiopHessianLowRank : public hiopMatrix
175175
void updateL(const hiopVector& STy, const double& sTy);
176176
void updateD(const double& sTy);
177177
//also stored are the iterate, gradient obj, and Jacobians at the previous optimization iteration
178-
hiopIterate *it_prev_;
179-
hiopVector *grad_f_prev_;
180-
hiopMatrixDense *Jac_c_prev_;
181-
hiopMatrixDense *Jac_d_prev_;
178+
hiopIterate* it_prev_;
179+
hiopVector* grad_f_prev_;
180+
hiopMatrixDense* Jac_c_prev_;
181+
hiopMatrixDense* Jac_d_prev_;
182182

183183
//internal helpers
184184
void updateInternalBFGSRepresentation();
@@ -213,27 +213,27 @@ class hiopHessianLowRank : public hiopMatrix
213213
inline hiopVector& new_n_vec1(size_type n)
214214
{
215215
#ifdef HIOP_DEEPCHECKS
216-
assert(n_vec1_!=nullptr);
216+
assert(n_vec1_ != nullptr);
217217
assert(n_vec1_->get_size()==n);
218218
#endif
219219
return *n_vec1_;
220220
}
221221
inline hiopVector& new_n_vec2(size_type n)
222222
{
223223
#ifdef HIOP_DEEPCHECKS
224-
assert(n_vec2_!=nullptr);
224+
assert(n_vec2_ != nullptr);
225225
assert(n_vec2_->get_size()==n);
226226
#endif
227227
return *n_vec2_;
228228
}
229229
inline hiopVector& new_2l_vec1(int l) {
230-
if(twol_vec1_!=nullptr && twol_vec1_->get_size()==2*l) {
230+
if(twol_vec1_ != nullptr && twol_vec1_->get_size() == 2 * l) {
231231
return *twol_vec1_;
232232
}
233-
if(twol_vec1_!=nullptr) {
233+
if(twol_vec1_ != nullptr) {
234234
delete twol_vec1_;
235235
}
236-
twol_vec1_ = LinearAlgebraFactory::create_vector(nlp_->options->GetString("mem_space"), 2*l);
236+
twol_vec1_ = LinearAlgebraFactory::create_vector(nlp_->options->GetString("mem_space"), 2 * l);
237237
return *twol_vec1_;
238238
}
239239
private:
@@ -474,19 +474,20 @@ class hiopHessianInvLowRank_obsolette : public hiopHessianLowRank
474474
void updateD(const double& sTy);
475475
private:
476476
hiopVector* H0_;
477-
hiopMatrixDense *St_;
478-
hiopMatrixDense *Yt_; //we store the transpose to easily access columns in S and T
479-
hiopMatrixDense *R_;
477+
hiopMatrixDense* St_;
478+
hiopMatrixDense* Yt_; //we store the transpose to easily access columns in S and T
479+
hiopMatrixDense* R_;
480480
hiopVector* D_;
481481

482482
int sigma_update_strategy_;
483483
double sigma_safe_min_;
484484
double sigma_safe_max_;
485485

486486
//also stored are the iterate, gradient obj, and Jacobians at the previous iterations
487-
hiopIterate *it_prev_;
488-
hiopVector *grad_f_prev_;
489-
hiopMatrixDense *Jac_c_prev_, *Jac_d_prev_;
487+
hiopIterate* it_prev_;
488+
hiopVector* grad_f_prev_;
489+
hiopMatrixDense* Jac_c_prev_;
490+
hiopMatrixDense* Jac_d_prev_;
490491

491492
//internals buffers
492493
double* buff_kxk_; // size = num_constraints^2
@@ -513,15 +514,15 @@ class hiopHessianInvLowRank_obsolette : public hiopHessianLowRank
513514
inline hiopVector& new_n_vec1(size_type n)
514515
{
515516
#ifdef HIOP_DEEPCHECKS
516-
assert(n_vec1_!=nullptr);
517+
assert(n_vec1_ != nullptr);
517518
assert(n_vec1_->get_size()==n);
518519
#endif
519520
return *n_vec1_;
520521
}
521522
inline hiopVector& new_n_vec2(size_type n)
522523
{
523524
#ifdef HIOP_DEEPCHECKS
524-
assert(n_vec2_!=nullptr);
525+
assert(n_vec2_ != nullptr);
525526
assert(n_vec2_->get_size()==n);
526527
#endif
527528
return *n_vec2_;

0 commit comments

Comments
 (0)