Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dóra Kocsis
dynare
Commits
820aca66
Commit
820aca66
authored
Aug 27, 2010
by
Houtan Bastani
Browse files
SWZ: replace free with swzFree
parent
12993a81
Changes
2
Hide whitespace changes
Inline
Side-by-side
matlab/swz/c-code/sbvar/var/forecast.c
View file @
820aca66
...
...
@@ -119,7 +119,7 @@ int forecast_percentile(FILE *f_out, TVector percentiles, int draws, FILE *poste
ERROR_EXIT:
FreeMatrixHistogram
(
histogram
);
FreeMatrix
(
forecast
);
f
ree
(
S
);
swzF
ree
(
S
);
FreeVector
(
initial
);
FreeVector
(
prob
);
FreeVector
(
init_prob
);
...
...
@@ -229,7 +229,7 @@ int forecast_percentile_regime(FILE *f_out, TVector percentiles, int draws,
ERROR_EXIT:
FreeMatrixHistogram
(
histogram
);
FreeMatrix
(
forecast
);
f
ree
(
S
);
swzF
ree
(
S
);
FreeVector
(
initial
);
FreeVector
(
prob
);
FreeVector
(
init_prob
);
...
...
@@ -362,9 +362,9 @@ int main(int nargs, char **args)
Read_VAR_Parameters
((
FILE
*
)
NULL
,
parm
,
head
,
model
);
p
=
(
T_VAR_Parameters
*
)(
model
->
theta
);
f
ree
(
spec
);
f
ree
(
head
);
f
ree
(
parm
);
swzF
ree
(
spec
);
swzF
ree
(
head
);
swzF
ree
(
parm
);
//============================= Compute forecasts =============================
...
...
@@ -374,7 +374,7 @@ int main(int nargs, char **args)
/* fmt="forecasts_mean_%s.prn"; */
/* sprintf(out_filename=(char*)swzMalloc(strlen(fmt) + strlen(tag) - 1),fmt,tag); */
/* f_out=fopen(out_filename,"wt"); */
/*
f
ree(out_filename); */
/*
swzF
ree(out_filename); */
/* printf("Constructing mean forecast\n"); */
/* if (F=dw_state_space_mean_unconditional_forecast((TVector*)NULL,h,statespace->nobs,model)) */
/* for (i=0; i < h; i++) */
...
...
@@ -452,7 +452,7 @@ int main(int nargs, char **args)
fmt
=
"forecasts_percentiles_regime_%d_%s.prn"
;
sprintf
(
out_filename
=
(
char
*
)
swzMalloc
(
strlen
(
fmt
)
+
strlen
(
tag
)
-
3
),
fmt
,
s
,
tag
);
f_out
=
fopen
(
out_filename
,
"wt"
);
f
ree
(
out_filename
);
swzF
ree
(
out_filename
);
printf
(
"Constructing percentiles for forecasts - regime %d
\n
"
,
s
);
forecast_percentile_regime
(
f_out
,
percentiles
,
draws
,
posterior_file
,
s
,
p
->
nobs
,
horizon
,
model
);
fclose
(
f_out
);
...
...
@@ -463,7 +463,7 @@ int main(int nargs, char **args)
fmt
=
"forecasts_percentiles_regime_%d_%s.prn"
;
sprintf
(
out_filename
=
(
char
*
)
swzMalloc
(
strlen
(
fmt
)
+
strlen
(
tag
)
-
3
),
fmt
,
s
,
tag
);
f_out
=
fopen
(
out_filename
,
"wt"
);
f
ree
(
out_filename
);
swzF
ree
(
out_filename
);
printf
(
"Constructing percentiles for forecasts - regime %d
\n
"
,
s
);
forecast_percentile_regime
(
f_out
,
percentiles
,
draws
,
posterior_file
,
s
,
p
->
nobs
,
horizon
,
model
);
fclose
(
f_out
);
...
...
@@ -473,7 +473,7 @@ int main(int nargs, char **args)
fmt
=
"forecasts_percentiles_%s.prn"
;
sprintf
(
out_filename
=
(
char
*
)
swzMalloc
(
strlen
(
fmt
)
+
strlen
(
tag
)
-
1
),
fmt
,
tag
);
f_out
=
fopen
(
out_filename
,
"wt"
);
f
ree
(
out_filename
);
swzF
ree
(
out_filename
);
printf
(
"Constructing percentiles for forecasts - %d draws of shocks/regimes per posterior value
\n
"
,
draws
);
forecast_percentile
(
f_out
,
percentiles
,
draws
,
posterior_file
,
p
->
nobs
,
horizon
,
model
);
fclose
(
f_out
);
...
...
matlab/swz/c-code/utilities/DWCcode/histogram/dw_histogram.c
View file @
820aca66
...
...
@@ -81,17 +81,17 @@ void FreeMatrixHistogram(TMatrixHistogram *h)
int
i
,
j
;
for
(
i
=
h
->
rows
-
1
;
i
>=
0
;
i
--
)
{
for
(
j
=
h
->
cols
-
1
;
j
>=
0
;
j
--
)
f
ree
(
h
->
freq
[
i
][
j
]);
f
ree
(
h
->
freq
[
i
]);
for
(
j
=
h
->
cols
-
1
;
j
>=
0
;
j
--
)
swzF
ree
(
h
->
freq
[
i
][
j
]);
swzF
ree
(
h
->
freq
[
i
]);
}
f
ree
(
h
->
freq
);
for
(
i
=
h
->
rows
-
1
;
i
>=
0
;
i
--
)
f
ree
(
h
->
low
[
i
]);
f
ree
(
h
->
low
);
for
(
i
=
h
->
rows
-
1
;
i
>=
0
;
i
--
)
f
ree
(
h
->
high
[
i
]);
f
ree
(
h
->
high
);
swzF
ree
(
h
->
freq
);
for
(
i
=
h
->
rows
-
1
;
i
>=
0
;
i
--
)
swzF
ree
(
h
->
low
[
i
]);
swzF
ree
(
h
->
low
);
for
(
i
=
h
->
rows
-
1
;
i
>=
0
;
i
--
)
swzF
ree
(
h
->
high
[
i
]);
swzF
ree
(
h
->
high
);
FreeMatrix
(
h
->
Min
);
FreeMatrix
(
h
->
Max
);
f
ree
(
h
);
swzF
ree
(
h
);
}
void
AddMatrixObservation
(
TMatrix
X
,
TMatrixHistogram
*
h
)
...
...
@@ -226,13 +226,13 @@ void SetMaxMinVectorHistogram(TVector Min, TVector Max, TVectorHistogram *h)
void
FreeVectorHistogram
(
TVectorHistogram
*
h
)
{
int
i
;
for
(
i
=
h
->
dim
-
1
;
i
>=
0
;
i
--
)
f
ree
(
h
->
freq
[
i
]);
f
ree
(
h
->
freq
);
f
ree
(
h
->
low
);
f
ree
(
h
->
high
);
for
(
i
=
h
->
dim
-
1
;
i
>=
0
;
i
--
)
swzF
ree
(
h
->
freq
[
i
]);
swzF
ree
(
h
->
freq
);
swzF
ree
(
h
->
low
);
swzF
ree
(
h
->
high
);
FreeVector
(
h
->
Min
);
FreeVector
(
h
->
Max
);
f
ree
(
h
);
swzF
ree
(
h
);
}
void
AddVectorObservation
(
TVector
x
,
TVectorHistogram
*
h
)
...
...
@@ -355,8 +355,8 @@ void SetMaxMinScalarHistogram(PRECISION Min, PRECISION Max, TScalarHistogram *h)
void
FreeScalarHistogram
(
TScalarHistogram
*
h
)
{
f
ree
(
h
->
freq
);
f
ree
(
h
);
swzF
ree
(
h
->
freq
);
swzF
ree
(
h
);
}
void
AddScalarObservation
(
PRECISION
x
,
TScalarHistogram
*
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