Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CoMISo
CoMISo
Commits
0ab09ef7
Commit
0ab09ef7
authored
Oct 23, 2020
by
Max Lyon
Browse files
regularize hessian in NASOQSolver.cc
parent
d754afe6
Pipeline
#15453
failed with stages
in 16 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
NSolver/NASOQSolver.cc
View file @
0ab09ef7
...
...
@@ -24,11 +24,22 @@ namespace COMISO {
//== IMPLEMENTATION ==========================================================
void
regularize_hessian
(
NProblemInterface
::
SMatrixNP
&
_H
)
{
NProblemInterface
::
SMatrixNP
id
;
id
.
resize
(
_H
.
rows
(),
_H
.
cols
());
id
.
setIdentity
();
double
reg_factor
=
1e-8
;
auto
diag
=
_H
.
diagonal
();
_H
=
_H
+
reg_factor
*
diag
.
sum
()
/
diag
.
rows
()
*
id
;
}
NProblemInterface
::
SMatrixNP
get_hessian
(
NProblemInterface
*
_problem
)
{
std
::
vector
<
double
>
zero
(
_problem
->
n_unknowns
(),
0
);
NProblemInterface
::
SMatrixNP
H
;
_problem
->
eval_hessian
(
zero
.
data
(),
H
);
regularize_hessian
(
H
);
return
H
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment