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
3a294deb
Commit
3a294deb
authored
6 months ago
by
Johannes Pfeifer
Browse files
Options
Downloads
Patches
Plain Diff
GetAllPosteriorDraws.m: factorize function by subsuming loading of specified blocks under main loop
parent
3cfcc98e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
matlab/estimation/GetAllPosteriorDraws.m
+20
-47
20 additions, 47 deletions
matlab/estimation/GetAllPosteriorDraws.m
with
20 additions
and
47 deletions
matlab/estimation/GetAllPosteriorDraws.m
+
20
−
47
View file @
3a294deb
...
...
@@ -83,51 +83,21 @@ else
[
nblcks
,
npar
]
=
size
(
record
.
LastParameters
);
iline
=
FirstLine
;
linee
=
1
;
if
nblcks
>
1
&&
nargin
<
7
if
strcmp
(
column
,
'all'
)
draws
=
zeros
(
NumberOfDraws
*
nblcks
,
npar
);
else
draws
=
zeros
(
NumberOfDraws
*
nblcks
,
1
);
end
iline0
=
iline
;
if
column
>
0
for
blck
=
1
:
nblcks
iline
=
iline0
;
for
file
=
FirstMhFile
:
TotalNumberOfMhFile
load
([
DirectoryName
'/'
fname
'_mh'
int2str
(
file
)
'_blck'
int2str
(
blck
)],
'x2'
)
NumberOfLines
=
size
(
x2
(
iline
:
end
,:),
1
);
if
strcmp
(
column
,
'all'
)
draws
(
linee
:
linee
+
NumberOfLines
-
1
,:)
=
x2
(
iline
:
end
,:);
else
draws
(
linee
:
linee
+
NumberOfLines
-
1
)
=
x2
(
iline
:
end
,
column
);
end
linee
=
linee
+
NumberOfLines
;
iline
=
1
;
end
end
else
for
blck
=
1
:
nblcks
iline
=
iline0
;
for
file
=
FirstMhFile
:
TotalNumberOfMhFile
load
([
DirectoryName
'/'
fname
'_mh'
int2str
(
file
)
'_blck'
int2str
(
blck
)],
'logpo2'
)
NumberOfLines
=
size
(
logpo2
(
iline
:
end
),
1
);
draws
(
linee
:
linee
+
NumberOfLines
-
1
)
=
logpo2
(
iline
:
end
);
linee
=
linee
+
NumberOfLines
;
iline
=
1
;
end
end
end
else
%read desired block
if
nblcks
==
1
blck
=
1
;
end
if
strcmp
(
column
,
'all'
)
draws
=
zeros
(
NumberOfDraws
,
npar
);
else
draws
=
zeros
(
NumberOfDraws
,
1
);
end
if
column
>
0
if
nargin
==
7
blocks_to_load
=
blck
;
nblcks
=
length
(
blck
);
else
blocks_to_load
=
1
:
nblcks
;
end
if
strcmp
(
column
,
'all'
)
draws
=
zeros
(
NumberOfDraws
*
nblcks
,
npar
);
else
draws
=
zeros
(
NumberOfDraws
*
nblcks
,
1
);
end
iline0
=
iline
;
if
column
>
0
for
blck
=
blocks_to_load
iline
=
iline0
;
for
file
=
FirstMhFile
:
TotalNumberOfMhFile
load
([
DirectoryName
'/'
fname
'_mh'
int2str
(
file
)
'_blck'
int2str
(
blck
)],
'x2'
)
NumberOfLines
=
size
(
x2
(
iline
:
end
,:),
1
);
...
...
@@ -139,10 +109,13 @@ else
linee
=
linee
+
NumberOfLines
;
iline
=
1
;
end
else
end
else
for
blck
=
blocks_to_load
iline
=
iline0
;
for
file
=
FirstMhFile
:
TotalNumberOfMhFile
load
([
DirectoryName
'/'
fname
'_mh'
int2str
(
file
)
'_blck'
int2str
(
blck
)],
'logpo2'
)
NumberOfLines
=
size
(
logpo2
(
iline
:
end
,:
),
1
);
NumberOfLines
=
size
(
logpo2
(
iline
:
end
),
1
);
draws
(
linee
:
linee
+
NumberOfLines
-
1
)
=
logpo2
(
iline
:
end
);
linee
=
linee
+
NumberOfLines
;
iline
=
1
;
...
...
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