Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dynare
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dynare
dynare
Commits
5f403e9f
Verified
Commit
5f403e9f
authored
2 years ago
by
Sébastien Villemot
Browse files
Options
Downloads
Plain Diff
Merge branch 'solve1' of git.dynare.org:JohannesPfeifer/dynare
Ref.
!2035
parents
efcb567f
c9fd266c
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!2035
Trap pathological cases in solvers
Pipeline
#7091
passed
2 years ago
Stage: build
Stage: test
Stage: pkg
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
matlab/solve1.m
+14
-1
14 additions, 1 deletion
matlab/solve1.m
matlab/trust_region.m
+5
-1
5 additions, 1 deletion
matlab/trust_region.m
with
19 additions
and
2 deletions
matlab/solve1.m
+
14
−
1
View file @
5f403e9f
...
...
@@ -121,7 +121,20 @@ for its = 1:maxit
end
if
rcond_fjac
<
sqrt
(
eps
)
fjac2
=
fjac
'*
fjac
;
p
=-
(
fjac2
+
sqrt
(
nn
*
eps
)
*
max
(
sum
(
abs
(
fjac2
)))
*
eye
(
nn
))\(
fjac
'*
fvec
);
temp
=
max
(
sum
(
abs
(
fjac2
)));
if
temp
>
0
p
=-
(
fjac2
+
sqrt
(
nn
*
eps
)
*
temp
*
eye
(
nn
))\(
fjac
'*
fvec
);
else
errorflag
=
true
;
errorcode
=
5
;
if
nargout
<
3
skipline
()
dprintf
(
'SOLVE: Iteration %s'
,
num2str
(
its
))
disp
(
'Zero Jacobian.'
)
skipline
()
end
return
end
else
p
=
-
fjac
\
fvec
;
end
...
...
This diff is collapsed.
Click to expand it.
matlab/trust_region.m
+
5
−
1
View file @
5f403e9f
...
...
@@ -327,5 +327,9 @@ else
end
% Form the appropriate convex combination of the Gauss-Newton direction and the
% scaled gradient direction.
x
=
alpha
*
x
+
(
1.0
-
alpha
)
*
min
(
sgnorm
,
delta
)
*
s
;
if
alpha
>
0
x
=
alpha
*
x
+
(
1.0
-
alpha
)
*
min
(
sgnorm
,
delta
)
*
s
;
else
%prevent zero weight on Inf evaluating to NaN
x
=
min
(
sgnorm
,
delta
)
*
s
;
end
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment