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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dynare
dynare
Commits
c5557b54
Commit
c5557b54
authored
3 years ago
by
Johannes Pfeifer
Browse files
Options
Downloads
Patches
Plain Diff
chol_SE.m: fix logical condition and assure symmetry instead of erroring out
parent
700a0e3a
No related branches found
No related tags found
1 merge request
!2016
chol_SE.m: fix logical condition and assure symmetry instead of erroring out
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
matlab/chol_SE.m
+6
-4
6 additions, 4 deletions
matlab/chol_SE.m
with
6 additions
and
4 deletions
matlab/chol_SE.m
+
6
−
4
View file @
c5557b54
...
...
@@ -70,8 +70,10 @@ function [R,indef, E, P]=chol_SE(A,pivoting)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
if
sum
(
sum
(
abs
(
A
-
A
'
)))
>
0
if
sum
(
sum
(
abs
(
A
-
A
'
)))
>
1e-8
error
(
'A is not symmetric'
)
elseif
sum
(
sum
(
abs
(
A
-
A
'
)))
>
0
A
=
(
A
+
A
'
)/
2
;
end
if
nargin
==
1
...
...
@@ -93,7 +95,7 @@ E=zeros(n,1);
% Find the maximum magnitude of the diagonal elements. If any diagonal element is negative, then phase1 is false.
gammma
=
max
(
diag
(
A
));
if
any
(
diag
(
A
)
)
<
0
if
any
(
diag
(
A
)
<
0
)
phase1
=
0
;
end
...
...
@@ -120,7 +122,7 @@ for j = 1:n-1
if
phase1
if
pivoting
==
1
% Find index of maximum diagonal element A(i,i) where i>=j
[
tmp
,
imaxd
]
=
max
(
diag
(
A
(
j
:
n
,
j
:
n
)));
[
~
,
imaxd
]
=
max
(
diag
(
A
(
j
:
n
,
j
:
n
)));
imaxd
=
imaxd
+
j
-
1
;
% Pivot to the top the row and column with the max diag
if
(
imaxd
~=
j
)
...
...
@@ -190,7 +192,7 @@ for j = 1:n-1
if
j
~=
n
-
1
if
pivoting
% Find the minimum negative Gershgorin bound
[
tmp
,
iming
]
=
min
(
g
(
j
:
n
));
[
~
,
iming
]
=
min
(
g
(
j
:
n
));
iming
=
iming
+
j
-
1
;
% Pivot to the top the row and column with the
% minimum negative Gershgorin bound
...
...
This diff is collapsed.
Click to expand it.
Johannes Pfeifer
@JohannesPfeifer
mentioned in commit
ae36201f
·
3 years ago
mentioned in commit
ae36201f
mentioned in commit ae36201fd1633348dee3b6b11703c3fc0766ca44
Toggle commit list
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