Home > matlab > bksupk.m

bksupk

PURPOSE ^

function d1 = bksupk(ny,fid,jcf,icc1)

SYNOPSIS ^

function d1 = bksupk(ny,fid,jcf,icc1)

DESCRIPTION ^

 function d1 = bksupk(ny,fid,jcf,icc1)
 Solves deterministic models recursively by backsubstitution for k leads/lags

 INPUTS
    ny:             number of endogenous variables
    fid:            saves the elements above the diagonal
    jcf:            variables index forward
    icc1:           jacobian column forward

 OUTPUTS
    d1:             vector of backsubstitution results

 SPECIAL REQUIREMENTS
    none

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function d1 = bksupk(ny,fid,jcf,icc1)
0002 
0003 % function d1 = bksupk(ny,fid,jcf,icc1)
0004 % Solves deterministic models recursively by backsubstitution for k leads/lags
0005 %
0006 % INPUTS
0007 %    ny:             number of endogenous variables
0008 %    fid:            saves the elements above the diagonal
0009 %    jcf:            variables index forward
0010 %    icc1:           jacobian column forward
0011 %
0012 % OUTPUTS
0013 %    d1:             vector of backsubstitution results
0014 %
0015 % SPECIAL REQUIREMENTS
0016 %    none
0017 
0018 % Copyright (C) 2003-2011 Dynare Team
0019 %
0020 % This file is part of Dynare.
0021 %
0022 % Dynare is free software: you can redistribute it and/or modify
0023 % it under the terms of the GNU General Public License as published by
0024 % the Free Software Foundation, either version 3 of the License, or
0025 % (at your option) any later version.
0026 %
0027 % Dynare is distributed in the hope that it will be useful,
0028 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0029 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0030 % GNU General Public License for more details.
0031 %
0032 % You should have received a copy of the GNU General Public License
0033 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0034 
0035 global M_ options_
0036 
0037 icf = [1:jcf-1] ;
0038 ir = [(options_.periods-1)*ny+1:ny*options_.periods] ;
0039 irf = icc1+(options_.periods-1)*ny ;
0040 d1 = zeros(options_.periods*ny,1) ;
0041 
0042 ofs = (((options_.periods-1)*ny+1)-1)*jcf*8 ;
0043 junk = fseek(fid,ofs,-1) ;
0044 c = fread(fid,[jcf,ny],'float64')';
0045 
0046 d1(ir) = c(:,jcf) ;
0047 ir = ir-ny ;
0048 
0049 i = 2 ;
0050 
0051 while i <= M_.maximum_lead || i <= options_.periods
0052     irf1 = selif(irf,irf<=options_.periods*ny) ;
0053 
0054     ofs = (((options_.periods-i)*ny+1)-1)*jcf*8 ;
0055     junk = fseek(fid,ofs,-1) ;
0056     c = fread(fid,[jcf,ny],'float64')' ;
0057 
0058     d1(ir) = c(:,jcf) - c(:,1:size(irf1,1))*d1(irf1) ;
0059     ir = ir - ny ;
0060     irf = irf - ny ;
0061     i = i + 1 ;
0062 end
0063 
0064 while i <= options_.periods
0065 
0066     ofs = (((options_.periods-i)*ny+1)-1)*jcf*8 ;
0067     junk = fseek(fid,ofs,-1) ;
0068     c = fread(fid,[jcf,ny],'float64')' ;
0069 
0070     d1(ir) = c(:,jcf)-c(:,icf)*d1(irf) ;
0071     ir = ir-ny ;                        
0072     irf = irf-ny ;
0073     i = i+1;
0074 end
0075 
0076 return ;

Generated on Mon 21-May-2012 02:42:43 by m2html © 2005