Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
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
Johannes Pfeifer
dynare
Commits
8b197bf7
Verified
Commit
8b197bf7
authored
3 years ago
by
Stéphane Adjemian
Browse files
Options
Downloads
Patches
Plain Diff
Remove duplicate assignments for parameters.
parent
4386116c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
matlab/aggregate.m
+41
-2
41 additions, 2 deletions
matlab/aggregate.m
tests/ecb/aggregate/3/parameter-values.inc
+2
-1
2 additions, 1 deletion
tests/ecb/aggregate/3/parameter-values.inc
tests/ecb/aggregate/3/parameters.inc
+1
-1
1 addition, 1 deletion
tests/ecb/aggregate/3/parameters.inc
with
44 additions
and
4 deletions
matlab/aggregate.m
+
41
−
2
View file @
8b197bf7
...
...
@@ -166,7 +166,7 @@ xlist = xlist(1:xnum,:);
xlist
=
xlist
(
idx
,:);
% Get parameter values.
calibration
=
''
;
pArray
=
cell
(
0
,
3
)
;
for
i
=
1
:
length
(
varargin
)
fid
=
fopen
(
sprintf
(
'%s/parameter-values.inc'
,
varargin
{
i
}));
if
fid
<
0
...
...
@@ -176,12 +176,51 @@ for i=1:length(varargin)
end
cline
=
fgetl
(
fid
);
while
ischar
(
cline
)
calibration
=
sprintf
(
'%s\n%s'
,
calibration
,
cline
);
tmp
=
textscan
(
cline
,
'%s = %f'
,
'Delimiter'
,
{
';'
,
'='
,
' '
});
pArray
(
end
+
1
,
1
)
=
tmp
{
1
};
pArray
{
end
,
2
}
=
tmp
{
2
};
pArray
{
end
,
3
}
=
varargin
{
i
};
cline
=
fgetl
(
fid
);
end
fclose
(
fid
);
end
if
rows
(
pArray
)
>
1
irow
=
2
;
while
irow
<=
rows
(
pArray
)
ispreviouslydefined
=
strcmpi
(
pArray
{
irow
,
1
},
pArray
(
1
:
irow
-
1
,
1
));
if
any
(
ispreviouslydefined
)
if
isnan
(
pArray
{
ispreviouslydefined
,
2
})
if
~
isnan
(
pArray
{
irow
,
2
})
% Remove first assignment (with NaN)
pArray
(
ispreviouslydefined
,:)
=
[];
else
% Remove second assignment (both assigments are NaNs)
pArray
(
irow
,:)
=
[];
end
elseif
isnan
(
pArray
{
irow
,
2
})
% New assigment is NaN but not the previous one.
pArray
(
irow
,:)
=
[];
else
% Check that the values are identical in both assignments.
if
abs
(
pArray
{
ispreviouslydefined
,
2
}
-
pArray
{
irow
,
2
})
>
1e-10
error
(
'More than one assigment for parameter %s with different values (see cherrypicked files in %s and %s).'
,
pArray
{
irow
,
1
},
pArray
{
irow
,
3
},
pArray
{
ispreviouslydefined
,
3
});
else
% Remove last assignement (duplicate).
pArray
(
irow
,:)
=
[];
end
end
else
irow
=
irow
+
1
;
end
end
end
calibration
=
''
;
for
i
=
1
:
rows
(
pArray
)
calibration
=
sprintf
(
'%s%s = %f;\n'
,
calibration
,
pArray
{
i
,
1
},
pArray
{
i
,
2
});
end
% Move the endogenous variables which are not LHS of an equation
% into the set of exogenous variables.
[
~
,
i1
]
=
intersect
(
elist
(:,
1
),
eqlist
(:,
1
));
...
...
This diff is collapsed.
Click to expand it.
tests/ecb/aggregate/3/parameter-values.inc
+
2
−
1
View file @
8b197bf7
...
...
@@ -4,4 +4,5 @@ c3 = -.3;
d3
=
-.
4
;
e3
=
-.
5
;
f3
=
-.
6
;
g3
=
-.
7
;
\ No newline at end of file
g3
=
-.
7
;
g1
=
.7
;
This diff is collapsed.
Click to expand it.
tests/ecb/aggregate/3/parameters.inc
+
1
−
1
View file @
8b197bf7
parameters
a3
b3
c3
d3
e3
f3
g3
;
\ No newline at end of file
parameters
a3
b3
c3
d3
e3
f3
g3
g1
;
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