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
Frédéric Karamé
dynare
Commits
d4910b4a
Commit
d4910b4a
authored
11 years ago
by
MichelJuillard
Browse files
Options
Downloads
Patches
Plain Diff
extended-preprocessor: adding missing file for test example
parent
351e04ab
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
others/cpp/tests/test1.cc
+71
-0
71 additions, 0 deletions
others/cpp/tests/test1.cc
with
71 additions
and
0 deletions
others/cpp/tests/test1.cc
0 → 100644
+
71
−
0
View file @
d4910b4a
#include
<iostream>
#include
"dynare_cpp_driver.hh"
#include
"DecisionRules.hh"
DynareInfo
*
preprocessorOutput
(
void
);
void
steadystate
(
const
double
*
,
const
double
*
,
double
*
,
int
*
);
void
FirstDerivatives
(
const
double
*
y
,
double
*
x
,
int
nb_row_x
,
double
*
params
,
double
*
steady_state
,
int
it_
,
double
*
residual
,
double
*
g1
,
double
*
v2
,
double
*
v3
);
main
(
int
argc
,
char
**
argv
)
{
DynareInfo
model_info
;
int
endo_nbr
=
model_info
.
get_endo_nbr
();
int
exo_nbr
=
model_info
.
get_exo_nbr
();
double
*
params
=
model_info
.
get_params_data
();
// Steady state
double
*
steady_state
=
new
double
[
endo_nbr
];
int
info
;
steadystate
(
NULL
,
params
,
steady_state
,
&
info
);
for
(
int
i
=
0
;
i
<
endo_nbr
;
++
i
)
std
::
cout
<<
model_info
.
get_endo_name_by_index
(
i
)
<<
" "
<<
steady_state
[
i
]
<<
"
\n
"
;
// 1st order approximation
double
qz_criterium
=
1.000001
;
vector
<
size_t
>
zeta_back
=
model_info
.
get_zeta_back
();
vector
<
size_t
>
zeta_fwrd
=
model_info
.
get_zeta_fwrd
();
vector
<
size_t
>
zeta_mixed
=
model_info
.
get_zeta_mixed
();
vector
<
size_t
>
zeta_static
=
model_info
.
get_zeta_static
();
int
nfwrd
=
zeta_fwrd
.
size
();
int
nback
=
zeta_back
.
size
();
int
nmixed
=
zeta_mixed
.
size
();
int
nstatic
=
zeta_static
.
size
();
int
jacob_cols
=
zeta_back
.
size
()
+
zeta_fwrd
.
size
()
+
zeta_mixed
.
size
()
+
exo_nbr
;
double
*
exo_steady_state
=
new
double
[
exo_nbr
];
double
*
jacob_data
=
new
double
[
endo_nbr
*
jacob_cols
];
FirstDerivatives
(
steady_state
,
exo_steady_state
,
0
,
params
,
steady_state
,
1
,
NULL
,
jacob_data
,
NULL
,
NULL
);
DecisionRules
dr
(
endo_nbr
,
exo_nbr
,
zeta_fwrd
,
zeta_back
,
zeta_mixed
,
zeta_static
,
qz_criterium
);
int
sdyn
=
nfwrd
+
nback
+
2
*
nmixed
;
int
jacobian_col_nbr
=
sdyn
+
endo_nbr
+
exo_nbr
;
MatrixView
jacob_tmp
(
jacob_data
,
endo_nbr
,
jacobian_col_nbr
,
endo_nbr
);
Matrix
jacobian
(
endo_nbr
,
jacobian_col_nbr
),
g_y
(
endo_nbr
,
nback
+
nmixed
),
g_u
(
endo_nbr
,
exo_nbr
);
jacobian
=
jacob_tmp
;
try
{
dr
.
compute
(
jacobian
,
g_y
,
g_u
);
}
catch
(
GeneralizedSchurDecomposition
::
GSDException
&
e
)
{
std
::
cerr
<<
e
<<
std
::
endl
;
}
catch
(
DecisionRules
::
BlanchardKahnException
&
e
)
{
std
::
cerr
<<
e
<<
std
::
endl
;
}
Vector
eig_real
(
sdyn
),
eig_cmplx
(
sdyn
);
dr
.
getGeneralizedEigenvalues
(
eig_real
,
eig_cmplx
);
std
::
cout
<<
"Eigenvalues (real part): "
<<
eig_real
<<
"Eigenvalues (complex part): "
<<
eig_cmplx
<<
std
::
endl
<<
"g_y = "
<<
std
::
endl
<<
g_y
<<
std
::
endl
<<
"g_u = "
<<
std
::
endl
<<
g_u
;
}
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