From fe8ae2c5658323c4aa2428b095d9b88a891cea8e Mon Sep 17 00:00:00 2001
From: Michel Juillard <michel.juillard@mjui.fr>
Date: Thu, 2 Aug 2012 11:25:52 +0200
Subject: [PATCH] adding doc *.m file for k_order_perturbation MEX

---
 matlab/k_order_perturbation.m | 53 +++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100644 matlab/k_order_perturbation.m

diff --git a/matlab/k_order_perturbation.m b/matlab/k_order_perturbation.m
new file mode 100644
index 0000000000..566a281175
--- /dev/null
+++ b/matlab/k_order_perturbation.m
@@ -0,0 +1,53 @@
+% [err, g_0, g_1, g_2, g_3, derivs] = k_order_perturbation(dr,DynareModel,DynareOptions)
+% computes a k_order_petrubation solution for k=1,2,3
+%
+% INPUTS
+% dr:            struct   describing the reduced form solution of the model.
+% DynareModel:   struct   jobs's parameters
+% DynareOptions: struct   job's options
+%
+% OUTPUTS
+% err:           double   err code (currently unused)
+% g_0:           vector   dynare++ output. Constant effect of future volatility (in
+%                         dr.order_var order) on the decision rule
+%                         (=ghs2/2). Contains zero when order of
+%                         approximation is 1.
+% g_1:           matrix   dynare++ output. First order Taylor coefficients
+%                         of decision rule. When order of approximation
+%                         is 3, the. Contains both the effect of
+%                         state endogenous variable and shocks. The rows
+%                         are in dr.order_var order. The columns are in
+%                         dr.order_var order of state endogenous
+%                         variables and shocks
+% g_2:           matrix   dynare++ output. Second order Taylor coefficients of decision
+%                         rule. Contains both the effect of state endogenous
+%                         variable and shocks. The rows are in dr.order_var
+%                         order. Each row corresponds to the vectorized
+%                         version of the lower triangle of the Hessian
+%                         matrix. The Taylor coefficient (1/2) is
+%                         included. The columns of the Hessian matrix are in
+%                         dr.order_var order of state endogenous variables
+%                         and shocks
+% g_3:           matrix   dynare++ output. Third order Taylor coefficients of decision
+%                         rule. Contains both the effect of state endogenous
+%                         variable and shocks. The rows are in dr.order_var
+%                         order. Each row corresponds to the vectorized
+%                         version of the 3rd order derivatives tensor where each
+%                         combination of variables appears only once.
+%                         The Taylor coefficient (1/6) is
+%                         included. Inside the tensor, the variables are in
+%                         dr.order_var order of state endogenous variables
+%                         and shocks 
+% derivs        struct    contains the original derivatives of the
+%                         decision function (ghx, ghu, ghxx, ghxu, ghuu,
+%                         ghs2, ghxxx, ghxxu, ghxuu,ghuuu, ghxss, ghuss),
+%                         keeping the effect of future volatility
+%                         separate (in  ghs2, ghxss and ghuss). The
+%                         derivatives matrices contain full versions of
+%                         the Hessian matrices and 3rd order
+%                         tensor. Symmetric derivatives are repeated. The
+%                         Taylor coefficients (1/2 and 1/6) aren't
+%                         included.
+% k_order_peturbation is a compiled MEX function. It's source code is in
+% dynare/mex/sources/k_order_perturbation.cc and it uses code provided by
+% dynare++
-- 
GitLab