diff --git a/matlab/@dynTime/dynTime.m b/matlab/@dynTime/dynTime.m deleted file mode 100644 index baff706d389af8be068fe25789c55b7dcdeb410c..0000000000000000000000000000000000000000 --- a/matlab/@dynTime/dynTime.m +++ /dev/null @@ -1,82 +0,0 @@ -function sp = dynTime(a) -%@info: -%! @deftypefn {Function File} {@var{sp} =} dynTime (@var{a}) -%! @anchor{dynTime} -%! @sp 1 -%! Constructor for the Dynare dynTime class. -%! @sp 2 -%! @strong{Inputs} -%! @sp 1 -%! @table @ @var -%! @item a -%! dynTime object instantiated by @ref{dynTime}. -%! @end table -%! @sp 2 -%! @strong{Outputs} -%! @sp 1 -%! @table @ @var -%! @item sp -%! dynTime object. -%! @end table -%! @sp 2 -%! @strong{Properties} -%! @sp 1 -%! The constructor defines the following properties: -%! @sp 1 -%! @table @ @var -%! @item freq -%! Scalar integer, the frequency of the time series. @var{freq} is equal to 1 if data are on a yearly basis or if -%! frequency is unspecified. @var{freq} is equal to 4 if data are on a quaterly basis. @var{freq} is equal to -%! 12 if data are on a monthly basis. @var{freq} is equal to 52 if data are on a weekly basis. -%! @item time -%! Array of integers (nobs*2). The first column defines the years associated to each observation. The second column, -%! depending on the frequency, indicates the week, month or quarter numbers. For yearly data or unspecified frequency -%! the second column is filled by ones. -%! @end table -%! @sp 1 -%! @strong{This function is called by:} -%! @sp 2 -%! @strong{This function calls:} -%! -%! @end deftypefn -%@eod: - -% Copyright (C) 2011, 2012 Dynare Team -% -% This file is part of Dynare. -% -% Dynare is free software: you can redistribute it and/or modify -% it under the terms of the GNU General Public License as published by -% the Free Software Foundation, either version 3 of the License, or -% (at your option) any later version. -% -% Dynare is distributed in the hope that it will be useful, -% but WITHOUT ANY WARRANTY; without even the implied warranty of -% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -% GNU General Public License for more details. -% -% You should have received a copy of the GNU General Public License -% along with Dynare. If not, see <http://www.gnu.org/licenses/>. - -% Original author: stephane DOT adjemian AT univ DASH lemans DOT fr - -sp = struct; - -sp.freq = []; -sp.time = []; - -sp = class(sp,'dynTime'); - -switch nargin - case 0 - return - case 1 - if isa(a,'dynTime') - sp = a; - else - error(['dynTime::dynTime: Input argument ' inputname(1) ' must be a dynTime object!']) - end - otherwise - error(['dynTime::dynTime: Too many input arguments!']) -end - diff --git a/matlab/@dynTime/setFreq.m b/matlab/@dynTime/setFreq.m deleted file mode 100644 index 2530e564906f5e69a526b33c1a448174ab71073d..0000000000000000000000000000000000000000 --- a/matlab/@dynTime/setFreq.m +++ /dev/null @@ -1,64 +0,0 @@ -function sp = setFreq(sp,freq) -% Set frequency of a dynTime object. - -%@info: -%! @deftypefn {Function File} {@var{sp} =} setFreq (@var{sp}, @var{freq}) -%! @anchor{@dynTime/setFreq} -%! @sp 1 -%! Set frequency of a dynTime object. -%! @sp 2 -%! @strong{Inputs} -%! @sp 1 -%! @table @ @var -%! @item sp -%! dynTime object instantiated by @ref{dynTime} -%! @item freq -%! scalar integer equal to 1 (yearly data), 4 (quaterly data), 12 (monthly data) or 52 (weekly data). -%! @end table -%! @sp 1 -%! @strong{Outputs} -%! @sp 1 -%! @table @ @var -%! @item sp -%! Updated @ref{dynTime} object. -%! @end table -%! @sp 2 -%! @strong{Example} -%! @sp 1 -%! Let @var{sp} be an object instantiated by @ref{dynTime}, both following syntaxes can be used to define the frequency: -%! @sp 1 -%! @example -%! sp = setFreq(sp,4); -%! @end example -%! or -%! @example -%! sp = sp.setFreq(4); -%! @end example -%! @sp 1 -%! Note that the second syntax is probably slower than the first one, and should not be used in a large loop. -%! @sp 2 -%! @strong{This function is called by:} -%! @sp 2 -%! @strong{This function calls:} -%! -%! @end deftypefn -%@eod: - -% Copyright (C) 2012 Dynare Team -% -% This file is part of Dynare. -% -% Dynare is free software: you can redistribute it and/or modify -% it under the terms of the GNU General Public License as published by -% the Free Software Foundation, either version 3 of the License, or -% (at your option) any later version. -% -% Dynare is distributed in the hope that it will be useful, -% but WITHOUT ANY WARRANTY; without even the implied warranty of -% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -% GNU General Public License for more details. -% -% You should have received a copy of the GNU General Public License -% along with Dynare. If not, see <http://www.gnu.org/licenses/>. - -sp.freq = freq; \ No newline at end of file diff --git a/matlab/@dynTime/setSize.m b/matlab/@dynTime/setSize.m deleted file mode 100644 index 7cdf33224433a41a4e90d6dccc29f49212d3b0eb..0000000000000000000000000000000000000000 --- a/matlab/@dynTime/setSize.m +++ /dev/null @@ -1,62 +0,0 @@ -function sp = setSize(sp,n) -%@info: -%! @deftypefn {Function File} {@var{sp} =} setSize (@var{sp}, @var{n}) -%! @anchor{@dynTime/setSize} -%! @sp 1 -%! Set the size of a dynTime object. -%! @sp 2 -%! @strong{Inputs} -%! @sp 1 -%! @table @ @var -%! @item sp -%! dynTime object instantiated by @ref{dynTime} -%! @item n -%! Positive scalar integer, the number of periods. -%! @end table -%! @sp 1 -%! @strong{Outputs} -%! @sp 1 -%! @table @ @var -%! @item sp -%! Updated @ref{dynTime} object. -%! @end table -%! @sp 2 -%! @strong{Example} -%! @sp 1 -%! Let @var{sp} be an object instantiated by @ref{dynTime}, both following syntaxes are equivalent: -%! @sp 1 -%! @example -%! sp = setSize(sp,167); -%! @end example -%! or -%! @example -%! sp = sp.setSize(167); -%! @end example -%! @sp 1 -%! Note that the second syntax is probably slower than the first one, and should not be used in a large loop. -%! @sp 2 -%! @strong{This function is called by:} -%! @sp 2 -%! @strong{This function calls:} -%! -%! @end deftypefn -%@eod: - -% Copyright (C) 2012 Dynare Team -% -% This file is part of Dynare. -% -% Dynare is free software: you can redistribute it and/or modify -% it under the terms of the GNU General Public License as published by -% the Free Software Foundation, either version 3 of the License, or -% (at your option) any later version. -% -% Dynare is distributed in the hope that it will be useful, -% but WITHOUT ANY WARRANTY; without even the implied warranty of -% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -% GNU General Public License for more details. -% -% You should have received a copy of the GNU General Public License -% along with Dynare. If not, see <http://www.gnu.org/licenses/>. - - sp.time = NaN(n,2); diff --git a/matlab/@dynTime/setTime.m b/matlab/@dynTime/setTime.m deleted file mode 100644 index 739c1cba908ad5a5006b54f02ad9e63cf35dbd90..0000000000000000000000000000000000000000 --- a/matlab/@dynTime/setTime.m +++ /dev/null @@ -1,76 +0,0 @@ -function sp = setTime(sp,i,date) -% Update time member of a dynTime object. - -%@info: -%! @deftypefn {Function File} {@var{sp} =} setTime (@var{sp}, @var{i}, @var{freq}) -%! @anchor{@dynTime/setTime} -%! @sp 1 -%! Update time member of a dynTime object. -%! @sp 2 -%! @strong{Inputs} -%! @sp 1 -%! @table @ @var -%! @item sp -%! dynTime object instantiated by @ref{dynTime} -%! @item i -%! (if nargin==3) scalar integer, targeting a row of the matrix @var{sp}.time (see @ref{dynTime} for a description of this matrix). -%! @sp 1 -%! (if nargin==2) nobs*2 matrix of integers (see @ref{dynTime} for a description of this array). -%! @item date -%! row vector of two integers (see @ref{dynTime} for a description of the rows of @var{sp}). -%! @end table -%! @sp 1 -%! @strong{Outputs} -%! @sp 1 -%! @table @ @var -%! @item sp -%! Updated @ref{dynTime} object. -%! @end table -%! @sp 2 -%! @strong{Example} -%! @sp 1 -%! Let @var{sp} be an object instantiated by @ref{dynTime}, both following syntaxes can be used to update the time member: -%! @sp 1 -%! @example -%! sp = setTime(sp,2,[1950,4]); -%! @end example -%! or -%! @example -%! sp = sp.setFreq(2,[1950,4]); -%! @end example -%! @sp 1 -%! Note that the second syntax is probably slower than the first one, and should not be used in a large loop. -%! @sp 2 -%! @strong{This function is called by:} -%! @sp 2 -%! @strong{This function calls:} -%! -%! @end deftypefn -%@eod: - -% Copyright (C) 2012 Dynare Team -% -% This file is part of Dynare. -% -% Dynare is free software: you can redistribute it and/or modify -% it under the terms of the GNU General Public License as published by -% the Free Software Foundation, either version 3 of the License, or -% (at your option) any later version. -% -% Dynare is distributed in the hope that it will be useful, -% but WITHOUT ANY WARRANTY; without even the implied warranty of -% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -% GNU General Public License for more details. -% -% You should have received a copy of the GNU General Public License -% along with Dynare. If not, see <http://www.gnu.org/licenses/>. - -if nargin==3 - sp.time(i,:) = date; -elseif nargin==2 - if isa(i,'dynTime') - sp.time=i.time; - else - sp.time=i; - end -end \ No newline at end of file diff --git a/matlab/@dynTime/subsref.m b/matlab/@dynTime/subsref.m deleted file mode 100644 index 71e1688004451362d3c3e759af1ad8c13899c79d..0000000000000000000000000000000000000000 --- a/matlab/@dynTime/subsref.m +++ /dev/null @@ -1,182 +0,0 @@ -function B = subsref(A, S) -%@info: -%! @deftypefn {Function File} {@var{B} =} subsref (@var{A},@var{S}) -%! @anchor{@dynTime/subsref} -%! @sp 1 -%! Overloads the subsref method for the Dynare time series class (@ref{dynTime}). -%! @sp 2 -%! @strong{Inputs} -%! @sp 1 -%! @table @ @var -%! @item A -%! Dynare time series object instantiated by @ref{dynSeries}. -%! @item S -%! Matlab's structure array S with two fields, type and subs. The type field is string containing '()', '@{@}', or '.', where '()' specifies -%! integer subscripts, '@{@}' specifies cell array subscripts, and '.' specifies subscripted structure fields. The subs field is a cell array -%! or a string containing the actual subscripts (see matlab's documentation). -%! @end table -%! @sp 1 -%! @strong{Outputs} -%! @sp 1 -%! @table @ @var -%! @item B -%! Dynare time series object. Depending on the calling sequence @var{us} is a transformation of @var{ts} obtained by applying a public method on @var{ts}, -%! or a dynSeries object built by extracting a variable from @var{ts}, or a dynSeries object containing a subsample of the all the variable in @var{ts}. -%! @end table -%! @sp 2 -%! @strong{This function is called by:} -%! @sp 2 -%! @strong{This function calls:} -%! @sp 1 -%! @ref{dynTime}, @ref{@@dynTime/setFreq}, @ref{@@dynTime/setSize}, @ref{@@dynTime/setTime} -%! -%! @end deftypefn -%@eod: - -% Copyright (C) 2012 Dynare Team -% -% This file is part of Dynare. -% -% Dynare is free software: you can redistribute it and/or modify -% it under the terms of the GNU General Public License as published by -% the Free Software Foundation, either version 3 of the License, or -% (at your option) any later version. -% -% Dynare is distributed in the hope that it will be useful, -% but WITHOUT ANY WARRANTY; without even the implied warranty of -% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -% GNU General Public License for more details. -% -% You should have received a copy of the GNU General Public License -% along with Dynare. If not, see <http://www.gnu.org/licenses/>. - -if isequal(S(1).type,'.') - switch S(1).subs - case {'time','freq','init','last'} % Public members. - B = builtin('subsref', A, S(1)); - case {'setFreq','setSize','setTime'} % Give "dot access" to public methods. - if length(S)==1 - B = feval(S(1).subs,A); - else - if isequal(S(2).type,'()') - B = feval(S(1).subs,A,S(2).subs{:}); - else - error('dynTime::subsref: Something is wrong in your syntax!') - end - end - otherwise - error('dynTime::subsref: Unknown public method or member!') - end -elseif isequal(S.type,'()') % Extract a sub-sample. - if length(S.subs)==1 - S.subs = [S.subs, ':']; - end - B = builtin('subsref', A.time, S); -else - error('dynTime::subsref: Something is wrong in your syntax!') -end - -%@test:1 -%$ addpath ../matlab -%$ % Define a data set. -%$ A = [transpose(1:10),2*transpose(1:10)]; -%$ -%$ % Define names -%$ A_name = char('A1','A2'); -%$ -%$ % Instantiate a time series object. -%$ ts1 = dynSeries(A,[],A_name,[]); -%$ -%$ % Call the tested method. -%$ a = ts1(2:9); -%$ -%$ % Expected results. -%$ e.data = [transpose(2:9),2*transpose(2:9)]; -%$ e.nobs = 8;g -%$ e.vobs = 2; -%$ e.name = char('A1','A2'); -%$ e.freq = 1; -%$ tmp = ts1.time; e.time = tmp(2:9,:); -%$ e.init = e.time(1,:); -%$ e.last = e.time(end,:); -%$ -%$ % Check the results. -%$ t(1) = dyn_assert(a.data,e.data); -%$ t(2) = dyn_assert(a.time,e.time); -%$ t(3) = dyn_assert(a.nobs,e.nobs); -%$ t(4) = dyn_assert(a.vobs,e.vobs); -%$ t(5) = dyn_assert(a.freq,e.freq); -%$ t(6) = dyn_assert(a.init,e.init); -%$ t(7) = dyn_assert(a.last,e.last); -%$ T = all(t); -%@eof:1 - -%@test:2 -%$ addpath ../matlab -%$ % Define a data set. -%$ A = [transpose(1:10),2*transpose(1:10)]; -%$ -%$ % Define names -%$ A_name = char('A1','A2'); -%$ -%$ % Instantiate a time series object. -%$ ts1 = dynSeries(A,[],A_name,[]); -%$ -%$ % Call the tested method. -%$ a = ts1.A1; -%$ -%$ % Expected results. -%$ e.data = transpose(1:10); -%$ e.nobs = 10; -%$ e.vobs = 1; -%$ e.name = char('A1'); -%$ e.freq = 1; -%$ e.time = [transpose(1:10),ones(10,1)]; -%$ e.init = e.time(1,:); -%$ e.last = e.time(end,:); -%$ -%$ % Check the results. -%$ t(1) = dyn_assert(a.data,e.data); -%$ t(2) = dyn_assert(a.time,e.time); -%$ t(3) = dyn_assert(a.nobs,e.nobs); -%$ t(4) = dyn_assert(a.vobs,e.vobs); -%$ t(5) = dyn_assert(a.freq,e.freq); -%$ t(6) = dyn_assert(a.init,e.init); -%$ t(7) = dyn_assert(a.last,e.last); -%$ T = all(t); -%@eof:2 - -%@test:3 -%$ addpath ../matlab -%$ % Define a data set. -%$ A = [transpose(1:10),2*transpose(1:10)]; -%$ -%$ % Define names -%$ A_name = char('A1','A2'); -%$ -%$ % Instantiate a time series object. -%$ ts1 = dynSeries(A,[],A_name,[]); -%$ -%$ % Call the tested method. -%$ a = ts1.log; -%$ -%$ % Expected results. -%$ e.data = log(A); -%$ e.nobs = 10; -%$ e.vobs = 2; -%$ e.name = char('A1','A2'); -%$ e.freq = 1; -%$ tmp = ts1.time; e.time = tmp(1:10,:); -%$ e.init = e.time(1,:); -%$ e.last = e.time(end,:); -%$ -%$ % Check the results. -%$ t(1) = dyn_assert(a.data,e.data); -%$ t(2) = dyn_assert(a.time,e.time); -%$ t(3) = dyn_assert(a.nobs,e.nobs); -%$ t(4) = dyn_assert(a.vobs,e.vobs); -%$ t(5) = dyn_assert(a.freq,e.freq); -%$ t(6) = dyn_assert(a.init,e.init); -%$ t(7) = dyn_assert(a.last,e.last); -%$ T = all(t); -%@eof:3