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
6f184371
Commit
6f184371
authored
Feb 02, 2011
by
Ferhat Mihoubi
Browse files
- Correction of temporary terms when bytecode is used and solve_algo <= 4
parent
90503684
Changes
4
Hide whitespace changes
Inline
Side-by-side
matlab/block_bytecode_mfs_steadystate.m
View file @
6f184371
...
...
@@ -20,8 +20,7 @@ function [r, g1] = block_bytecode_mfs_steadystate(y, b, y_all)
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
global
M_
oo_
global
temporary_terms
;
indx
=
M_
.
blocksMFS
{
b
};
y_all
(
indx
)
=
y
;
x
=
[
oo_
.
exo_steady_state
;
oo_
.
exo_det_steady_state
];
eval
([
'
[chk, r, g1
, nulldev, temporary_terms
] = bytecode( y_all, x, M_.params, 1, y_all,
temporary_terms,
'
'
evaluate
'
'
,
'
'
static
'
'
,
'
'
block = '
int2str
(
b
)
'
''
,
''
global_temporary_terms
''
);'
]);
[
chk
,
r
,
g1
]
=
bytecode
(
y_all
,
x
,
M_
.
params
,
1
,
y_all
,
'evaluate'
,
'static'
,
[
'block = '
int2str
(
b
)
]);
matlab/dynare_solve_block_or_bytecode.m
View file @
6f184371
...
...
@@ -59,7 +59,7 @@ elseif options_.bytecode
end
x
(
M_
.
blocksMFS
{
b
})
=
y
;
else
[
ch
eck
,
x
]
=
feval
(
'
bytecode
'
,
x
,
exo
,
params
,
'static'
,
[
'block = '
int2str
(
b
)]);
[
ch
k
,
nulldev
,
nulldev1
,
x
]
=
bytecode
(
x
,
exo
,
params
,
1
,
x
,
'evaluate'
,
'static'
,
[
'block = '
int2str
(
b
)]);
end
;
end
else
...
...
mex/sources/bytecode/Interpreter.cc
View file @
6f184371
...
...
@@ -2546,9 +2546,9 @@ Interpreter::compute_blocks(string file_name, string bin_basename, bool steady_s
#ifdef DEBUG
mexPrintf
(
"---------------------------------------------------------
\n
"
);
if
(
block
<
0
)
mexPrintf
(
"FBEGINBLOCK %d
\n
"
,
Block_Count
+
1
);
mexPrintf
(
"FBEGINBLOCK
Block_Count=
%d
\n
"
,
Block_Count
+
1
);
else
mexPrintf
(
"FBEGINBLOCK %d
\n
"
,
block
+
1
);
mexPrintf
(
"FBEGINBLOCK
block=
%d
\n
"
,
block
+
1
);
#endif
//it's a new block
{
...
...
mex/sources/bytecode/bytecode.cc
View file @
6f184371
...
...
@@ -387,48 +387,57 @@ mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
}
if
(
nlhs
>
2
)
{
int
jacob_field_number
=
0
,
jacob_exo_field_number
=
0
,
jacob_exo_det_field_number
=
0
,
jacob_other_endo_field_number
=
0
;
if
(
!
block_structur
)
{
const
char
*
field_names
[]
=
{
"g1"
,
"g1_x"
,
"g1_xd"
,
"g1_o"
};
jacob_field_number
=
0
;
jacob_exo_field_number
=
1
;
jacob_exo_det_field_number
=
2
;
jacob_other_endo_field_number
=
2
;
mwSize
dims
[
1
]
=
{
nb_blocks
};
plhs
[
2
]
=
mxCreateStructArray
(
1
,
dims
,
4
,
field_names
);
}
else
if
(
!
mxIsStruct
(
block_structur
))
{
plhs
[
2
]
=
interprete
.
get_jacob
(
0
);
//mexCallMATLAB(0,NULL, 1, &plhs[2], "disp");
dont_store_a_structure
=
true
;
}
else
if
(
evaluate
)
{
plhs
[
2
]
=
block_structur
;
jacob_field_number
=
mxAddField
(
plhs
[
2
],
"g1"
);
if
(
jacob_field_number
==
-
1
)
DYN_MEX_FUNC_ERR_MSG_TXT
(
"Fatal error in bytecode: in main, cannot add extra field jacob to the structArray
\n
"
);
jacob_exo_field_number
=
mxAddField
(
plhs
[
2
],
"g1_x"
);
if
(
jacob_exo_field_number
==
-
1
)
DYN_MEX_FUNC_ERR_MSG_TXT
(
"Fatal error in bytecode: in main, cannot add extra field jacob_exo to the structArray
\n
"
);
jacob_exo_det_field_number
=
mxAddField
(
plhs
[
2
],
"g1_xd"
);
if
(
jacob_exo_det_field_number
==
-
1
)
DYN_MEX_FUNC_ERR_MSG_TXT
(
"Fatal error in bytecode: in main, cannot add extra field jacob_exo_det to the structArray
\n
"
);
jacob_other_endo_field_number
=
mxAddField
(
plhs
[
2
],
"g1_o"
);
if
(
jacob_other_endo_field_number
==
-
1
)
DYN_MEX_FUNC_ERR_MSG_TXT
(
"Fatal error in bytecode: in main, cannot add extra field jacob_other_endo to the structArray
\n
"
);
int
jacob_field_number
=
0
,
jacob_exo_field_number
=
0
,
jacob_exo_det_field_number
=
0
,
jacob_other_endo_field_number
=
0
;
if
(
!
block_structur
)
{
const
char
*
field_names
[]
=
{
"g1"
,
"g1_x"
,
"g1_xd"
,
"g1_o"
};
jacob_field_number
=
0
;
jacob_exo_field_number
=
1
;
jacob_exo_det_field_number
=
2
;
jacob_other_endo_field_number
=
2
;
mwSize
dims
[
1
]
=
{
nb_blocks
};
plhs
[
2
]
=
mxCreateStructArray
(
1
,
dims
,
4
,
field_names
);
}
else
if
(
!
mxIsStruct
(
block_structur
))
{
plhs
[
2
]
=
interprete
.
get_jacob
(
0
);
//mexCallMATLAB(0,NULL, 1, &plhs[2], "disp");
dont_store_a_structure
=
true
;
}
else
{
plhs
[
2
]
=
block_structur
;
jacob_field_number
=
mxAddField
(
plhs
[
2
],
"g1"
);
if
(
jacob_field_number
==
-
1
)
DYN_MEX_FUNC_ERR_MSG_TXT
(
"Fatal error in bytecode: in main, cannot add extra field jacob to the structArray
\n
"
);
jacob_exo_field_number
=
mxAddField
(
plhs
[
2
],
"g1_x"
);
if
(
jacob_exo_field_number
==
-
1
)
DYN_MEX_FUNC_ERR_MSG_TXT
(
"Fatal error in bytecode: in main, cannot add extra field jacob_exo to the structArray
\n
"
);
jacob_exo_det_field_number
=
mxAddField
(
plhs
[
2
],
"g1_xd"
);
if
(
jacob_exo_det_field_number
==
-
1
)
DYN_MEX_FUNC_ERR_MSG_TXT
(
"Fatal error in bytecode: in main, cannot add extra field jacob_exo_det to the structArray
\n
"
);
jacob_other_endo_field_number
=
mxAddField
(
plhs
[
2
],
"g1_o"
);
if
(
jacob_other_endo_field_number
==
-
1
)
DYN_MEX_FUNC_ERR_MSG_TXT
(
"Fatal error in bytecode: in main, cannot add extra field jacob_other_endo to the structArray
\n
"
);
}
if
(
!
dont_store_a_structure
)
{
for
(
int
i
=
0
;
i
<
nb_blocks
;
i
++
)
{
mxSetFieldByNumber
(
plhs
[
2
],
i
,
jacob_field_number
,
interprete
.
get_jacob
(
i
));
mxSetFieldByNumber
(
plhs
[
2
],
i
,
jacob_exo_field_number
,
interprete
.
get_jacob_exo
(
i
));
mxSetFieldByNumber
(
plhs
[
2
],
i
,
jacob_exo_det_field_number
,
interprete
.
get_jacob_exo_det
(
i
));
mxSetFieldByNumber
(
plhs
[
2
],
i
,
jacob_other_endo_field_number
,
interprete
.
get_jacob_other_endo
(
i
));
}
}
}
if
(
!
dont_store_a_structure
)
else
{
for
(
int
i
=
0
;
i
<
nb_blocks
;
i
++
)
{
mxSetFieldByNumber
(
plhs
[
2
],
i
,
jacob_field_number
,
interprete
.
get_jacob
(
i
));
mxSetFieldByNumber
(
plhs
[
2
],
i
,
jacob_exo_field_number
,
interprete
.
get_jacob_exo
(
i
));
mxSetFieldByNumber
(
plhs
[
2
],
i
,
jacob_exo_det_field_number
,
interprete
.
get_jacob_exo_det
(
i
));
mxSetFieldByNumber
(
plhs
[
2
],
i
,
jacob_other_endo_field_number
,
interprete
.
get_jacob_other_endo
(
i
));
}
plhs
[
2
]
=
mxCreateDoubleMatrix
(
1
,
1
,
mxREAL
);
pind
=
mxGetPr
(
plhs
[
0
]);
pind
[
0
]
=
NAN
;
}
if
(
nlhs
>
3
)
{
...
...
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