diff --git a/matlab/@dynDates/append.m b/matlab/@dates/append.m similarity index 75% rename from matlab/@dynDates/append.m rename to matlab/@dates/append.m index fdf3bc6b0..f4a817c63 100644 --- a/matlab/@dynDates/append.m +++ b/matlab/@dates/append.m @@ -1,16 +1,16 @@ function B = append(A,a) % --*-- Unitary tests --*-- -% append method for dynDates class. +% append method for dates class. % % INPUTS -% o A dynDates object. -% o a dynDates object with one element or string that can be interpreted as a date. +% o A dates object. +% o a dates object with one element or string that can be interpreted as a date. % % OUTPUTS -% o B dynDates object containing dates defined in A and a. +% o B dates object containing dates defined in A and a. % % EXAMPLE 1 -% If A is a dynDates object with quarterly frequency, then B = A.append(dynDates('1950Q2')) and +% If A is a dates object with quarterly frequency, then B = A.append(dates('1950Q2')) and % B = A.append('1950Q2') are equivalent syntaxes. % Copyright (C) 2012-2013 Dynare Team @@ -30,23 +30,23 @@ function B = append(A,a) % --*-- Unitary tests --*-- % You should have received a copy of the GNU General Public License % along with Dynare. If not, see . -if isa(a,'dynDates') +if isa(a,'dates') if ~isequal(length(a),1) - error(['dynDates::append: Input argument ' inputname(a) ' has to be a dynDates object with one element.']) + error(['dates::append: Input argument ' inputname(a) ' has to be a dates object with one element.']) end if isempty(a) B = A; return end elseif isdate(a) - a = dynDates(a); + a = dates(a); end if ~isequal(A.freq, a.freq) - error(['dynDates::append: A and a must have common frequency!']) + error(['dates::append: A and a must have common frequency!']) end -B = dynDates(); +B = dates(); B.ndat = A.ndat+1; B.freq = A.freq; B.time = NaN(B.ndat,2); @@ -67,8 +67,8 @@ B.time(A.ndat+1,:) = a.time; %$ e.ndat = 5; %$ %$ % Call the tested routine. -%$ d = dynDates(B4,B3,B2,B1); -%$ d = d.append(dynDates(B5)); +%$ d = dates(B4,B3,B2,B1); +%$ d = d.append(dates(B5)); %$ %$ % Check the results. %$ t(1) = dyn_assert(d.time,e.time); @@ -91,7 +91,7 @@ B.time(A.ndat+1,:) = a.time; %$ e.ndat = 5; %$ %$ % Call the tested routine. -%$ d = dynDates(B4,B3,B2,B1); +%$ d = dates(B4,B3,B2,B1); %$ d = d.append(B5); %$ %$ % Check the results. diff --git a/matlab/@dynDates/colon.m b/matlab/@dates/colon.m similarity index 68% rename from matlab/@dynDates/colon.m rename to matlab/@dates/colon.m index a1c143479..29a54ecea 100644 --- a/matlab/@dynDates/colon.m +++ b/matlab/@dates/colon.m @@ -3,12 +3,12 @@ function C = colon(varargin) % --*-- Unitary tests --*-- % Overloads the colon operator (:). This method can be used to create ranges of dates. % % INPUTS -% o A dynDates object with one element. +% o A dates object with one element. % o d integer scalar, number of periods between each date (default value, if nargin==2, is one) -% o B dynDates object with one element. +% o B dates object with one element. % % OUTPUTS -% o C dynDates object with length(B-A) elements (if d==1). +% o C dates object with length(B-A) elements (if d==1). % % REMARKS % B must be greater than A if d>0. @@ -34,39 +34,39 @@ if isequal(nargin,2) A = varargin{1}; B = varargin{2}; d = 1; - if ~(isa(A,'dynDates') && isa(B,'dynDates') && isequal(length(A),1) && isequal(length(B),1)) - error('dynDates::colon: In an expression like A:B, A and B must be dynDates objects!') + if ~(isa(A,'dates') && isa(B,'dates') && isequal(length(A),1) && isequal(length(B),1)) + error('dates::colon: In an expression like A:B, A and B must be dates objects!') end elseif isequal(nargin,3) A = varargin{1}; B = varargin{3}; d = varargin{2}; - if ~(isa(A,'dynDates') && isa(B,'dynDates') && isequal(length(A),1) && isequal(length(B),1)) - error('dynDates::colon: In an expression like A:d:B, A and B must be dynDates objects and d a scalar integer (number of periods)!') + if ~(isa(A,'dates') && isa(B,'dates') && isequal(length(A),1) && isequal(length(B),1)) + error('dates::colon: In an expression like A:d:B, A and B must be dates objects and d a scalar integer (number of periods)!') end if ~(isscalar(d) && isint(d)) - error('dynDates::colon: In an expression like A:d:B, A and B must be dynDates objects and d a scalar integer (number of periods)!') + error('dates::colon: In an expression like A:d:B, A and B must be dates objects and d a scalar integer (number of periods)!') end if isequal(d,0) - error('dynDates::colon: In an expression like A:d:B, d (the incremental number of periods) must nonzero!') + error('dates::colon: In an expression like A:d:B, d (the incremental number of periods) must nonzero!') end else - error('dynDates::colon: Wrong calling sequence! See the manual for the colon (:) operator and dynDates objects.') + error('dates::colon: Wrong calling sequence! See the manual for the colon (:) operator and dates objects.') end if ~isequal(A.freq,B.freq) - error(['dynDates::colon: Input arguments ' inputname(1) 'and ' inputname(2) ' must have common frequency!']) + error(['dates::colon: Input arguments ' inputname(1) 'and ' inputname(2) ' must have common frequency!']) end if A>B && d>0 - error(['dynDates::colon: ' inputname(1) ' must precede ' inputname(2) '!' ]) + error(['dates::colon: ' inputname(1) ' must precede ' inputname(2) '!' ]) end if B>A && d<0 - error(['dynDates::colon: ' inputname(2) ' must precede ' inputname(1) '!' ]) + error(['dates::colon: ' inputname(2) ' must precede ' inputname(1) '!' ]) end -C = dynDates(); +C = dates(); n = (B-A)+1; C.freq = A.freq; C.ndat = n; @@ -95,8 +95,8 @@ C.ndat = rows(C.time); %$ e.time = [1950 2; 1950 3; 1950 4; 1951 1; 1951 2; 1951 3; 1951 4]; %$ %$ % Call the tested routine. -%$ d1 = dynDates(date_1); -%$ d2 = dynDates(date_2); +%$ d1 = dates(date_1); +%$ d2 = dates(date_2); %$ d3 = d1:d2; %$ %$ % Check the results. @@ -111,7 +111,7 @@ C.ndat = rows(C.time); %$ e.time = [1950 2; 1950 3; 1950 4; 1951 1; 1951 2; 1951 3; 1951 4]; %$ %$ % Call the tested routine. -%$ d = dynDates('1950Q2'):dynDates('1951Q4'); +%$ d = dates('1950Q2'):dates('1951Q4'); %$ %$ % Check the results. %$ t(1) = dyn_assert(d.time,e.time); @@ -125,7 +125,7 @@ C.ndat = rows(C.time); %$ e.time = [1950 2; 1950 4; 1951 2; 1951 4]; %$ %$ % Call the tested routine. -%$ d = dynDates('1950Q2'):2:dynDates('1951Q4'); +%$ d = dates('1950Q2'):2:dates('1951Q4'); %$ %$ % Check the results. %$ t(1) = dyn_assert(d.time,e.time); diff --git a/matlab/@dynDates/disp.m b/matlab/@dates/disp.m similarity index 95% rename from matlab/@dynDates/disp.m rename to matlab/@dates/disp.m index 107f768ef..9c012fea4 100644 --- a/matlab/@dynDates/disp.m +++ b/matlab/@dates/disp.m @@ -18,14 +18,14 @@ function disp(dd) % along with Dynare. If not, see . if isempty(dd) - fprintf('Empty dynDates object.\n'); + fprintf('Empty dates object.\n'); return end max_displayed = 5; first_displayed = 2; -fprintf('. if isempty(dd) - fprintf('%s is an empty dynDates object.\n', inputname(1)); + fprintf('%s is an empty dates object.\n', inputname(1)); return end max_displayed = 5; first_displayed = 2; -fprintf('%s = . dd = struct('ndat', 0, 'freq', NaN(0), 'time', NaN(0,2)); -dd = class(dd,'dynDates'); +dd = class(dd,'dates'); switch nargin case 0 % Returns an empty object return case 1 - if isa(varargin{1},'dynDates') + if isa(varargin{1},'dates') % Returns a copy of the input argument dd = varargin{1}; elseif isdate(varargin{1}) @@ -79,14 +79,14 @@ switch nargin dd.freq = date.freq; dd.time = date.time; elseif isfreq(varargin{1}) - % Instantiate an empty dynDates object (only set frequency) + % Instantiate an empty dates object (only set frequency) if ischar(varargin{1}) dd.freq = string2freq(varargin{1}); else dd.freq = varargin{1}; end else - error('dynDates:: Wrong calling sequence of the constructor!') + error('dates:: Wrong calling sequence of the constructor!') end otherwise dd.ndat = nargin; @@ -96,7 +96,7 @@ switch nargin dd.freq = date.freq; dd.time(1,:) = date.time; else - error(['dynDates::dynDates: Input 1 has to be a string date!']) + error(['dates::dates: Input 1 has to be a string date!']) end for i=2:dd.ndat if isdate(varargin{i}) @@ -104,10 +104,10 @@ switch nargin if isequal(date.freq,dd.freq) dd.time(i,:) = date.time; else - error(['dynDates::dynDates: Check that all the inputs have the same frequency (see input number ' str2num(i) ')!']) + error(['dates::dates: Check that all the inputs have the same frequency (see input number ' str2num(i) ')!']) end else - error(['dynDates::dynDates: Input ' str2num(i) ' has to be a string date!']) + error(['dates::dates: Input ' str2num(i) ' has to be a string date!']) end end end @@ -125,7 +125,7 @@ end %$ e.ndat = 4; %$ %$ % Call the tested routine. -%$ d = dynDates(B1,B2,B3,B4); +%$ d = dates(B1,B2,B3,B4); %$ %$ % Check the results. %$ t(1) = dyn_assert(d.time,e.time); @@ -147,7 +147,7 @@ end %$ e.ndat = 4; %$ %$ % Call the tested routine. -%$ d = dynDates(B1,B2,B3,B4); +%$ d = dates(B1,B2,B3,B4); %$ %$ % Check the results. %$ t(1) = dyn_assert(d.time,e.time); @@ -169,7 +169,7 @@ end %$ e.ndat = 4; %$ %$ % Call the tested routine. -%$ d = dynDates(B1,B2,B3,B4); +%$ d = dates(B1,B2,B3,B4); %$ %$ % Check the results. %$ t(1) = dyn_assert(d.time,e.time); @@ -179,7 +179,7 @@ end %@eof:3 %% @test:4 -%$ % Define a dynDates object +%$ % Define a dates object %$ B = dynDate('1950Q1'):dynDate('1960Q3'); %$ %$ diff --git a/matlab/@dynDates/dynDates2decimal.m b/matlab/@dates/dynDates2decimal.m similarity index 92% rename from matlab/@dynDates/dynDates2decimal.m rename to matlab/@dates/dynDates2decimal.m index 6d36cc1f6..4a50881ef 100644 --- a/matlab/@dynDates/dynDates2decimal.m +++ b/matlab/@dates/dynDates2decimal.m @@ -1,5 +1,5 @@ -function y = dynDates2decimal(dd) -% function y = dynDates2decimal(dd) +function y = dates2decimal(dd) +% function y = dates2decimal(dd) % returns a vector of doubles with the fractional part corresponding % to the subperiod. Mostly used for plots. diff --git a/matlab/@dynDates/end.m b/matlab/@dates/end.m similarity index 85% rename from matlab/@dynDates/end.m rename to matlab/@dates/end.m index 40a26e5a5..22129549f 100644 --- a/matlab/@dynDates/end.m +++ b/matlab/@dates/end.m @@ -3,12 +3,12 @@ function lastIndex = end(o, k, n) % End keyword % % INPUTS -% o [dynDates] dynDates object +% o [dates] dates object % k [integer] index where end appears % n [integer] number of indices % % OUTPUTS -% lastIndex [integer] last dynDates index +% lastIndex [integer] last dates index % % SPECIAL REQUIREMENTS % none @@ -30,6 +30,6 @@ function lastIndex = end(o, k, n) % You should have received a copy of the GNU General Public License % along with Dynare. If not, see . -assert(k==1 && n==1, '@dynDates/end: dynDates only has one dimension'); +assert(k==1 && n==1, '@dates/end: dates only has one dimension'); lastIndex = o.ndat; end \ No newline at end of file diff --git a/matlab/@dynDates/eq.m b/matlab/@dates/eq.m similarity index 68% rename from matlab/@dynDates/eq.m rename to matlab/@dates/eq.m index c185b8252..16983d184 100644 --- a/matlab/@dynDates/eq.m +++ b/matlab/@dates/eq.m @@ -1,10 +1,10 @@ function C = eq(A,B) % --*-- Unitary tests --*-- -% Overloads == operator for dynDates objects. +% Overloads == operator for dates objects. % % INPUTS -% o A dynDates object with n or 1 elements. -% o B dynDates object with n or 1 elements. +% o A dates object with n or 1 elements. +% o B dates object with n or 1 elements. % % OUTPUTS % o C column vector of max(n,1) elements (zeros or ones). @@ -27,11 +27,11 @@ function C = eq(A,B) % --*-- Unitary tests --*-- % along with Dynare. If not, see . if ~isequal(nargin,2) - error('dynDates::eq: I need exactly two input arguments!') + error('dates::eq: I need exactly two input arguments!') end -if ~isa(A,'dynDates') || ~isa(B,'dynDates') - error(['dynDates::eq: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' have to be a dynDates objects!']) +if ~isa(A,'dates') || ~isa(B,'dates') + error(['dates::eq: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' have to be a dates objects!']) end if ~isequal(A.freq,B.freq) @@ -50,10 +50,10 @@ else end %@test:1 -%$ % Define some dynDates objects -%$ d1 = dynDates('1950Q1','1950Q2','1950Q3','1950Q4') ; -%$ d2 = dynDates('1960Q1','1960Q2','1960Q3','1960Q4') ; -%$ d3 = dynDates('1950Q1','1960Q2','1950Q3','1960Q4') ; +%$ % Define some dates objects +%$ d1 = dates('1950Q1','1950Q2','1950Q3','1950Q4') ; +%$ d2 = dates('1960Q1','1960Q2','1960Q3','1960Q4') ; +%$ d3 = dates('1950Q1','1960Q2','1950Q3','1960Q4') ; %$ %$ % Call the tested routine. %$ t1 = d1==d1; @@ -68,10 +68,10 @@ end %@eof:1 %@test:2 -%$ % Define some dynDates objects -%$ d1 = dynDates('1950Q1') ; -%$ d2 = dynDates('1960Q1') ; -%$ d3 = dynDates('1960Q1') ; +%$ % Define some dates objects +%$ d1 = dates('1950Q1') ; +%$ d2 = dates('1960Q1') ; +%$ d3 = dates('1960Q1') ; %$ %$ % Call the tested routine. %$ t1 = d1==d1; @@ -86,10 +86,10 @@ end %@eof:2 %@test:3 -%$ % Define some dynDates objects -%$ d1 = dynDates('1950Q1','1950Q2','1950Q3','1950Q4') ; -%$ d2 = dynDates('1950Q2') ; -%$ d3 = dynDates('1970Q1') ; +%$ % Define some dates objects +%$ d1 = dates('1950Q1','1950Q2','1950Q3','1950Q4') ; +%$ d2 = dates('1950Q2') ; +%$ d3 = dates('1970Q1') ; %$ %$ % Call the tested routine. %$ t1 = d1==d2; diff --git a/matlab/@dynDates/ge.m b/matlab/@dates/ge.m similarity index 71% rename from matlab/@dynDates/ge.m rename to matlab/@dates/ge.m index 07101a4dd..8f18cf7ab 100644 --- a/matlab/@dynDates/ge.m +++ b/matlab/@dates/ge.m @@ -1,10 +1,10 @@ function C = ge(A,B) % --*-- Unitary tests --*-- -% Overloads the >= operator for dynDates objects. +% Overloads the >= operator for dates objects. % % INPUTS -% o A dynDates object with n or 1 elements. -% o B dynDates object with n or 1 elements. +% o A dates object with n or 1 elements. +% o B dates object with n or 1 elements. % % OUTPUTS % o C column vector of max(n,1) elements (zeros or ones). @@ -27,11 +27,11 @@ function C = ge(A,B) % --*-- Unitary tests --*-- % along with Dynare. If not, see . if ~isequal(nargin,2) - error('dynDates::ge: I need exactly two input arguments!') + error('dates::ge: I need exactly two input arguments!') end -if ~isa(A,'dynDates') || ~isa(B,'dynDates') - error(['dynDates::ge: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' have to be a dynDates objects!']) +if ~isa(A,'dates') || ~isa(B,'dates') + error(['dates::ge: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' have to be a dates objects!']) end if ~isequal(A.freq,B.freq) @@ -71,10 +71,10 @@ end %$ date_5 = '1949Q2'; %$ %$ % Call the tested routine. -%$ d2 = dynDates(date_2); -%$ d3 = dynDates(date_3); -%$ d4 = dynDates(date_4); -%$ d5 = dynDates(date_5); +%$ d2 = dates(date_2); +%$ d3 = dates(date_3); +%$ d4 = dates(date_4); +%$ d5 = dates(date_5); %$ i1 = (d2>=d3); %$ i2 = (d3>=d4); %$ i3 = (d4>=d2); @@ -98,15 +98,15 @@ end %$ B4 = '1945Q4'; %$ B5 = '1950Q1'; %$ -%$ % Create dynDates objects. -%$ dd = dynDates(B1,B2,B3,B4); +%$ % Create dates objects. +%$ dd = dates(B1,B2,B3,B4); %$ %$ % Check the results. -%$ t(1) = dyn_assert(dynDates(B1)>=dynDates(B2),0); -%$ t(2) = dyn_assert(dynDates(B2)>=dynDates(B1),1); -%$ t(3) = dyn_assert(dynDates(B2)>=dynDates(B2),1); -%$ t(4) = dyn_assert(dd>=dynDates(B5),zeros(4,1)); -%$ t(5) = dyn_assert(dynDates(B5)>=dd,ones(4,1)); -%$ t(6) = dyn_assert(dynDates(B1)>=dd,[1; zeros(3,1)]); +%$ t(1) = dyn_assert(dates(B1)>=dates(B2),0); +%$ t(2) = dyn_assert(dates(B2)>=dates(B1),1); +%$ t(3) = dyn_assert(dates(B2)>=dates(B2),1); +%$ t(4) = dyn_assert(dd>=dates(B5),zeros(4,1)); +%$ t(5) = dyn_assert(dates(B5)>=dd,ones(4,1)); +%$ t(6) = dyn_assert(dates(B1)>=dd,[1; zeros(3,1)]); %$ T = all(t); %@eof:2 \ No newline at end of file diff --git a/matlab/@dynDates/getDatesCellStringArray.m b/matlab/@dates/getDatesCellStringArray.m similarity index 98% rename from matlab/@dynDates/getDatesCellStringArray.m rename to matlab/@dates/getDatesCellStringArray.m index 4b7b16546..734fa0355 100644 --- a/matlab/@dynDates/getDatesCellStringArray.m +++ b/matlab/@dates/getDatesCellStringArray.m @@ -3,7 +3,7 @@ function m = getDatesCellStringArray(dd) % Returns a cell array of strings containing the dates % % INPUTS -% dd - dynDates object +% dd - dates object % % OUTPUTS % m - cell array of strings diff --git a/matlab/@dynDates/gt.m b/matlab/@dates/gt.m similarity index 70% rename from matlab/@dynDates/gt.m rename to matlab/@dates/gt.m index 706620faa..241dd729e 100644 --- a/matlab/@dynDates/gt.m +++ b/matlab/@dates/gt.m @@ -1,10 +1,10 @@ function C = gt(A,B) % --*-- Unitary tests --*-- -% Overloads the > operator for dynDates objects. +% Overloads the > operator for dates objects. % % INPUTS -% o A dynDates object with n or 1 elements. -% o B dynDates object with n or 1 elements. +% o A dates object with n or 1 elements. +% o B dates object with n or 1 elements. % % OUTPUTS % o C column vector of max(n,1) elements (zeros or ones). @@ -27,11 +27,11 @@ function C = gt(A,B) % --*-- Unitary tests --*-- % along with Dynare. If not, see . if ~isequal(nargin,2) - error('dynDates::gt: I need exactly two input arguments!') + error('dates::gt: I need exactly two input arguments!') end -if ~isa(A,'dynDates') || ~isa(B,'dynDates') - error(['dynDates::gt: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' have to be a dynDates objects!']) +if ~isa(A,'dates') || ~isa(B,'dates') + error(['dates::gt: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' have to be a dates objects!']) end if ~isequal(A.freq,B.freq) @@ -70,10 +70,10 @@ end %$ date_5 = '1949Q2'; %$ %$ % Call the tested routine. -%$ d2 = dynDates(date_2); -%$ d3 = dynDates(date_3); -%$ d4 = dynDates(date_4); -%$ d5 = dynDates(date_5); +%$ d2 = dates(date_2); +%$ d3 = dates(date_3); +%$ d4 = dates(date_4); +%$ d5 = dates(date_5); %$ i1 = (d2>d3); %$ i2 = (d3>d4); %$ i3 = (d4>d2); @@ -95,15 +95,15 @@ end %$ B4 = '1945Q4'; %$ B5 = '1950Q1'; %$ -%$ % Create dynDates objects. -%$ dd = dynDates(B1,B2,B3,B4); +%$ % Create dates objects. +%$ dd = dates(B1,B2,B3,B4); %$ %$ % Check the results. -%$ t(1) = dyn_assert(dynDates(B1)>dynDates(B2),0); -%$ t(2) = dyn_assert(dynDates(B2)>dynDates(B1),1); -%$ t(3) = dyn_assert(dynDates(B5)>dynDates(B1),1); -%$ t(4) = dyn_assert(dd>dynDates(B5),zeros(4,1)); -%$ t(5) = dyn_assert(dynDates(B5)>dd,ones(4,1)); -%$ t(6) = dyn_assert(dynDates(B1)>dd,[0; zeros(3,1)]); +%$ t(1) = dyn_assert(dates(B1)>dates(B2),0); +%$ t(2) = dyn_assert(dates(B2)>dates(B1),1); +%$ t(3) = dyn_assert(dates(B5)>dates(B1),1); +%$ t(4) = dyn_assert(dd>dates(B5),zeros(4,1)); +%$ t(5) = dyn_assert(dates(B5)>dd,ones(4,1)); +%$ t(6) = dyn_assert(dates(B1)>dd,[0; zeros(3,1)]); %$ T = all(t); %@eof:2 \ No newline at end of file diff --git a/matlab/@dynDates/intersect.m b/matlab/@dates/intersect.m similarity index 82% rename from matlab/@dynDates/intersect.m rename to matlab/@dates/intersect.m index e5c2a1b8a..870efbbc8 100644 --- a/matlab/@dynDates/intersect.m +++ b/matlab/@dates/intersect.m @@ -2,7 +2,7 @@ function C = intersect(A,B) % --*-- Unitary tests --*-- %@info: %! @deftypefn {Function File} {@var{C} =} intersect (@var{A},@var{B}) -%! @anchor{@dynDates/intersect} +%! @anchor{@dates/intersect} %! @sp 1 %! C of B and A. %! if A and B are not disjoints. @@ -11,16 +11,16 @@ function C = intersect(A,B) % --*-- Unitary tests --*-- %! @sp 1 %! @table @ @var %! @item A -%! @ref{dynDates} object. +%! @ref{dates} object. %! @item B -%! @ref{dynDates} object. +%! @ref{dates} object. %! @end table %! @sp 2 %! @strong{Outputs} %! @sp 1 %! @table @ @var %! @item C -%! @ref{dynDates} object. +%! @ref{dates} object. %! @end table %! @end deftypefn %@eod: @@ -42,8 +42,8 @@ function C = intersect(A,B) % --*-- Unitary tests --*-- % You should have received a copy of the GNU General Public License % along with Dynare. If not, see . -if ~isa(A,'dynDates') || ~isa(B,'dynDates') - error(['dynDates::plus: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' must be dynDates objects!']) +if ~isa(A,'dates') || ~isa(B,'dates') + error(['dates::plus: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' must be dates objects!']) end if eq(A,B) @@ -52,13 +52,13 @@ if eq(A,B) end if ~isequal(A.freq,B.freq) - C = dynDates(); + C = dates(); return end time = intersect(A.time,B.time,'rows'); -C = dynDates(); +C = dates(); if isempty(time) return end @@ -68,7 +68,7 @@ C.time = time; C.ndat = rows(time); %@test:1 -%$ % Define some dynDates objects +%$ % Define some dates objects %$ d1 = dynDate('1950Q1'):dynDate('1969Q4') ; %$ d2 = dynDate('1960Q1'):dynDate('1969Q4') ; %$ d3 = dynDate('1970Q1'):dynDate('1979Q4') ; diff --git a/matlab/@dynDates/isempty.m b/matlab/@dates/isempty.m similarity index 89% rename from matlab/@dynDates/isempty.m rename to matlab/@dates/isempty.m index 980ff2b09..2ebd9baeb 100644 --- a/matlab/@dynDates/isempty.m +++ b/matlab/@dates/isempty.m @@ -2,15 +2,15 @@ function B = isempty(A) % --*-- Unitary tests --*-- %@info: %! @deftypefn {Function File} {@var{B} =} isempty (@var{A}) -%! @anchor{@dynDates/isempty} +%! @anchor{@dates/isempty} %! @sp 1 -%! Overloads the isempty function for the @ref{dynDates} class. +%! Overloads the isempty function for the @ref{dates} class. %! @sp 2 %! @strong{Inputs} %! @sp 1 %! @table @ @var %! @item A -%! @ref{dynDates} object. +%! @ref{dates} object. %! @end table %! @sp 1 %! @strong{Outputs} @@ -43,7 +43,7 @@ B = isequal(A.ndat,0); %@test:1 %$ % Instantiate an empty dynDate object -%$ d = dynDates(); +%$ d = dates(); %$ % Test if this object is empty %$ t(1) = isempty(d); %$ T = all(t); diff --git a/matlab/@dynDates/isequal.m b/matlab/@dates/isequal.m similarity index 83% rename from matlab/@dynDates/isequal.m rename to matlab/@dates/isequal.m index 55b7a2f11..1e436b969 100644 --- a/matlab/@dynDates/isequal.m +++ b/matlab/@dates/isequal.m @@ -1,6 +1,6 @@ function C = isequal(A,B) -% Overloads isequal function for dynDates objects. +% Overloads isequal function for dates objects. % Copyright (C) 2013 Dynare Team % @@ -19,8 +19,8 @@ function C = isequal(A,B) % You should have received a copy of the GNU General Public License % along with Dynare. If not, see . -if ~isa(A,'dynDates') || ~isa(B,'dynDates') - error('dynDates::isequal: Both inputs must be dynDates objects!') +if ~isa(A,'dates') || ~isa(B,'dates') + error('dates::isequal: Both inputs must be dates objects!') end if ~isequal(A.freq, B.freq) diff --git a/matlab/@dynDates/le.m b/matlab/@dates/le.m similarity index 71% rename from matlab/@dynDates/le.m rename to matlab/@dates/le.m index f16be9ffc..228317228 100644 --- a/matlab/@dynDates/le.m +++ b/matlab/@dates/le.m @@ -1,10 +1,10 @@ function C = le(A,B) % --*-- Unitary tests --*-- -% Overloads the <= operator for dynDates objects. +% Overloads the <= operator for dates objects. % % INPUTS -% o A dynDates object with n or 1 elements. -% o B dynDates object with n or 1 elements. +% o A dates object with n or 1 elements. +% o B dates object with n or 1 elements. % % OUTPUTS % o C column vector of max(n,1) elements (zeros or ones). @@ -27,11 +27,11 @@ function C = le(A,B) % --*-- Unitary tests --*-- % along with Dynare. If not, see . if ~isequal(nargin,2) - error('dynDates::le: I need exactly two input arguments!') + error('dates::le: I need exactly two input arguments!') end -if ~isa(A,'dynDates') || ~isa(B,'dynDates') - error(['dynDates::le: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' have to be a dynDates objects!']) +if ~isa(A,'dates') || ~isa(B,'dates') + error(['dates::le: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' have to be a dates objects!']) end if ~isequal(A.freq,B.freq) @@ -71,10 +71,10 @@ end %$ date_5 = '1949Q2'; %$ %$ % Call the tested routine. -%$ d2 = dynDates(date_2); -%$ d3 = dynDates(date_3); -%$ d4 = dynDates(date_4); -%$ d5 = dynDates(date_5); +%$ d2 = dates(date_2); +%$ d3 = dates(date_3); +%$ d4 = dates(date_4); +%$ d5 = dates(date_5); %$ i1 = (d2<=d3); %$ i2 = (d3<=d4); %$ i3 = (d4<=d2); @@ -98,15 +98,15 @@ end %$ B4 = '1945Q4'; %$ B5 = '1950Q1'; %$ -%$ % Create dynDates objects. -%$ dd = dynDates(B1,B2,B3,B4); +%$ % Create dates objects. +%$ dd = dates(B1,B2,B3,B4); %$ %$ % Check the results. -%$ t(1) = dyn_assert(dynDates(B1)<=dynDates(B2),1); -%$ t(2) = dyn_assert(dynDates(B2)<=dynDates(B1),0); -%$ t(3) = dyn_assert(dynDates(B2)<=dynDates(B2),1); -%$ t(4) = dyn_assert(dd<=dynDates(B5),ones(4,1)); -%$ t(5) = dyn_assert(dynDates(B5)<=dd,zeros(4,1)); -%$ t(6) = dyn_assert(dynDates(B1)<=dd,ones(4,1)); +%$ t(1) = dyn_assert(dates(B1)<=dates(B2),1); +%$ t(2) = dyn_assert(dates(B2)<=dates(B1),0); +%$ t(3) = dyn_assert(dates(B2)<=dates(B2),1); +%$ t(4) = dyn_assert(dd<=dates(B5),ones(4,1)); +%$ t(5) = dyn_assert(dates(B5)<=dd,zeros(4,1)); +%$ t(6) = dyn_assert(dates(B1)<=dd,ones(4,1)); %$ T = all(t); %@eof:2 \ No newline at end of file diff --git a/matlab/@dynDates/length.m b/matlab/@dates/length.m similarity index 92% rename from matlab/@dynDates/length.m rename to matlab/@dates/length.m index 3a58bc315..26c24d13a 100644 --- a/matlab/@dynDates/length.m +++ b/matlab/@dates/length.m @@ -1,6 +1,6 @@ function n = length(A) -% Returns the number of elements in a dynDates object. +% Returns the number of elements in a dates object. % Copyright (C) 2013 Dynare Team % diff --git a/matlab/@dynDates/lt.m b/matlab/@dates/lt.m similarity index 70% rename from matlab/@dynDates/lt.m rename to matlab/@dates/lt.m index a2575ef88..3707b6861 100644 --- a/matlab/@dynDates/lt.m +++ b/matlab/@dates/lt.m @@ -1,10 +1,10 @@ function C = lt(A,B) % --*-- Unitary tests --*-- -% Overloads the < operator for dynDates objects. +% Overloads the < operator for dates objects. % % INPUTS -% o A dynDates object with n or 1 elements. -% o B dynDates object with n or 1 elements. +% o A dates object with n or 1 elements. +% o B dates object with n or 1 elements. % % OUTPUTS % o C column vector of max(n,1) elements (zeros or ones). @@ -27,11 +27,11 @@ function C = lt(A,B) % --*-- Unitary tests --*-- % along with Dynare. If not, see . if ~isequal(nargin,2) - error('dynDates::lt: I need exactly two input arguments!') + error('dates::lt: I need exactly two input arguments!') end -if ~isa(A,'dynDates') || ~isa(B,'dynDates') - error(['dynDates::lt: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' have to be a dynDates objects!']) +if ~isa(A,'dates') || ~isa(B,'dates') + error(['dates::lt: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' have to be a dates objects!']) end if ~isequal(A.freq,B.freq) @@ -70,10 +70,10 @@ end %$ date_5 = '1949Q2'; %$ %$ % Call the tested routine. -%$ d2 = dynDates(date_2); -%$ d3 = dynDates(date_3); -%$ d4 = dynDates(date_4); -%$ d5 = dynDates(date_5); +%$ d2 = dates(date_2); +%$ d3 = dates(date_3); +%$ d4 = dates(date_4); +%$ d5 = dates(date_5); %$ i1 = (d2. -if isa(A,'dynDates') && isa(B,'dynDates') - % Concatenate dynDates objects without removing repetitions if A and B are not disjoint sets of dates. +if isa(A,'dates') && isa(B,'dates') + % Concatenate dates objects without removing repetitions if A and B are not disjoint sets of dates. if ~isequal(A.freq,B.freq) - error(['dynDates::minus: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' must have common frequencies!']) + error(['dates::minus: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' must have common frequencies!']) end if isempty(A) || isempty(B) - error(['dynDates::minus: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' must not be empty!']) + error(['dates::minus: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' must not be empty!']) end if ~isequal(length(A),length(B)) if length(A)==1 @@ -36,7 +36,7 @@ if isa(A,'dynDates') && isa(B,'dynDates') B.time = repmat(B.time,A.ndat,1); B.ndat = A.ndat; else - error(['dynDates::minus: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' lengths are not consistent!']) + error(['dates::minus: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' lengths are not consistent!']) end end C = zeros(length(A),1); @@ -45,26 +45,26 @@ if isa(A,'dynDates') && isa(B,'dynDates') return end C(id) = A.time(id,2)-B.time(id,2) + (A.time(id,1)-B.time(id,1))*A.freq; -elseif isa(A,'dynDates') && ( (isvector(B) && isequal(length(B),A.ndat) && all(isint(B))) || isscalar(B) && isint(B) || isequal(length(A),1) && isvector(B) && all(isint(B))) - C = dynDates(); +elseif isa(A,'dates') && ( (isvector(B) && isequal(length(B),A.ndat) && all(isint(B))) || isscalar(B) && isint(B) || isequal(length(A),1) && isvector(B) && all(isint(B))) + C = dates(); C.freq = A.freq; C.time = add_periods_to_array_of_dates(A.time, A.freq, -B); C.ndat = rows(C.time); -elseif isa(B,'dynDates') && ( (isvector(A) && isequal(length(A),B.ndat) && all(isint(A))) || isscalar(A) && isint(A) ) - C = dynDates(); +elseif isa(B,'dates') && ( (isvector(A) && isequal(length(A),B.ndat) && all(isint(A))) || isscalar(A) && isint(A) ) + C = dates(); C.freq = A.freq; C.time = add_periods_to_array_of_dates(B.time, B.freq, -A); C.ndat = rows(C.time); else - error('dynDates::plus: I don''t understand what you want to do! Check the manual.') + error('dates::plus: I don''t understand what you want to do! Check the manual.') end %@test:1 -%$ % Define some dynDates objects -%$ d1 = dynDates('1950Q1','1950Q2','1960Q1'); -%$ d2 = dynDates('1950Q3','1950Q4','1960Q1'); -%$ d3 = dynDates('2000Q1'); -%$ d4 = dynDates('2002Q2'); +%$ % Define some dates objects +%$ d1 = dates('1950Q1','1950Q2','1960Q1'); +%$ d2 = dates('1950Q3','1950Q4','1960Q1'); +%$ d3 = dates('2000Q1'); +%$ d4 = dates('2002Q2'); %$ % Call the tested routine. %$ try %$ e1 = d2-d1; @@ -82,11 +82,11 @@ end %@eof:1 %@test:2 -%$ % Define some dynDates objects -%$ d1 = dynDates('1950Y','1951Y','1953Y'); -%$ d2 = dynDates('1951Y','1952Y','1953Y'); -%$ d3 = dynDates('2000Y'); -%$ d4 = dynDates('1999Y'); +%$ % Define some dates objects +%$ d1 = dates('1950Y','1951Y','1953Y'); +%$ d2 = dates('1951Y','1952Y','1953Y'); +%$ d3 = dates('2000Y'); +%$ d4 = dates('1999Y'); %$ % Call the tested routine. %$ try %$ e1 = d2-d1; @@ -104,9 +104,9 @@ end %@eof:2 %@test:3 -%$ % Define some dynDates objects -%$ d1 = dynDates('2000Y'); -%$ d2 = dynDates('1999Y'); +%$ % Define some dates objects +%$ d1 = dates('2000Y'); +%$ d2 = dates('1999Y'); %$ % Call the tested routine. %$ try %$ e1 = d1-1; @@ -124,9 +124,9 @@ end %@eof:3 %@test:4 -%$ % Define some dynDates objects -%$ d1 = dynDates('2000Q1'); -%$ e1 = dynDates('1999Q4','1999Q3','1999Q2','1999Q1','1998Q4'); +%$ % Define some dates objects +%$ d1 = dates('2000Q1'); +%$ e1 = dates('1999Q4','1999Q3','1999Q2','1999Q1','1998Q4'); %$ % Call the tested routine. %$ try %$ f1 = d1-transpose(1:5); @@ -142,9 +142,9 @@ end %@eof:4 %@test:5 -%$ % Define some dynDates objects -%$ d1 = dynDates('1999Q4','1999Q3','1999Q2','1999Q1','1998Q4'); -%$ e1 = dynDates('2000Q1')*5; +%$ % Define some dates objects +%$ d1 = dates('1999Q4','1999Q3','1999Q2','1999Q1','1998Q4'); +%$ e1 = dates('2000Q1')*5; %$ % Call the tested routine. %$ try %$ f1 = d1-(-transpose(1:5)); diff --git a/matlab/@dynDates/mtimes.m b/matlab/@dates/mtimes.m similarity index 62% rename from matlab/@dynDates/mtimes.m rename to matlab/@dates/mtimes.m index 24740b243..513915b32 100644 --- a/matlab/@dynDates/mtimes.m +++ b/matlab/@dates/mtimes.m @@ -1,18 +1,18 @@ function B = mtimes(A,n) -% Overloads the times operator (*). Returns dynDates object A replicated n times. +% Overloads the times operator (*). Returns dates object A replicated n times. % % INPUTS -% o A dynDates object with m elements. +% o A dates object with m elements. % % OUTPUTS -% o B dynDates object with m*n elements. +% o B dates object with m*n elements. % % EXAMPLE 1 -% If A = dynDates('2000Q1'), then B=A*3 is a dynDates object equal to dynDates('2000Q1','2000Q1','2000Q1') +% If A = dates('2000Q1'), then B=A*3 is a dates object equal to dates('2000Q1','2000Q1','2000Q1') % % EXAMPLE 2 -% If A = dynDates('2003Q1','2009Q2'), then B=A*2 is a dynDates object equal to dynDates('2003Q1','2009Q2','2003Q1','2009Q2') +% If A = dates('2003Q1','2009Q2'), then B=A*2 is a dates object equal to dates('2003Q1','2009Q2','2003Q1','2009Q2') % Copyright (C) 2013 Dynare Team % @@ -32,7 +32,7 @@ function B = mtimes(A,n) % along with Dynare. If not, see . if ~(isscalar(n) && isint(n)) - error('dynDates::m: First and second input arguments have to be a dynDates object and a scalar integer!') + error('dates::m: First and second input arguments have to be a dates object and a scalar integer!') end B = A; B.time = repmat(A.time,n,1); diff --git a/matlab/@dynDates/plus.m b/matlab/@dates/plus.m similarity index 58% rename from matlab/@dynDates/plus.m rename to matlab/@dates/plus.m index e2cb9472d..76e7a9919 100644 --- a/matlab/@dynDates/plus.m +++ b/matlab/@dates/plus.m @@ -1,7 +1,7 @@ function C = plus(A,B) % --*-- Unitary tests --*-- -% Overloads the plus operator. If A and B are dynDates objects the method combines A and B without removing repetitions. If -% one of the inputs is an integer or a vector of integers, the method shifts the dynDates object by X (the interger input) +% Overloads the plus operator. If A and B are dates objects the method combines A and B without removing repetitions. If +% one of the inputs is an integer or a vector of integers, the method shifts the dates object by X (the interger input) % periods forward. % Copyright (C) 2013 Dynare Team @@ -21,10 +21,10 @@ function C = plus(A,B) % --*-- Unitary tests --*-- % You should have received a copy of the GNU General Public License % along with Dynare. If not, see . -if isa(A,'dynDates') && isa(B,'dynDates') - % Concatenate dynDates objects without removing repetitions if A and B are not disjoint sets of dates. +if isa(A,'dates') && isa(B,'dates') + % Concatenate dates objects without removing repetitions if A and B are not disjoint sets of dates. if ~isequal(A.freq,B.freq) - error(['dynDates::plus: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' must have common frequencies!']) + error(['dates::plus: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' must have common frequencies!']) end if isempty(B) C = A; @@ -34,29 +34,29 @@ if isa(A,'dynDates') && isa(B,'dynDates') C = B; return end - C = dynDates(); + C = dates(); C.freq = A.freq; C.time = [A.time; B.time]; C.ndat = A.ndat+B.ndat; -elseif isa(A,'dynDates') && ( (isvector(B) && isequal(length(B),A.ndat) && all(isint(B))) || isscalar(B) && isint(B) || isequal(length(A),1) && isvector(B) && all(isint(B))) - C = dynDates(); +elseif isa(A,'dates') && ( (isvector(B) && isequal(length(B),A.ndat) && all(isint(B))) || isscalar(B) && isint(B) || isequal(length(A),1) && isvector(B) && all(isint(B))) + C = dates(); C.freq = A.freq; C.time = add_periods_to_array_of_dates(A.time, A.freq, B); C.ndat = rows(C.time); -elseif isa(B,'dynDates') && ( (isvector(A) && isequal(length(A),B.ndat) && all(isint(A))) || isscalar(A) && isint(A) ) - C = dynDates(); +elseif isa(B,'dates') && ( (isvector(A) && isequal(length(A),B.ndat) && all(isint(A))) || isscalar(A) && isint(A) ) + C = dates(); C.freq = B.freq; C.time = add_periods_to_array_of_dates(B.time, B.freq, A); C.ndat = rows(C.time); else - error('dynDates::plus: I don''t understand what you want to do! Check the manual.') + error('dates::plus: I don''t understand what you want to do! Check the manual.') end %@test:1 -%$ % Define some dynDates objects -%$ d1 = dynDates('1950Q1','1950Q2') ; -%$ d2 = dynDates('1950Q3','1950Q4') ; -%$ d3 = dynDates('1950Q1','1950Q2','1950Q3','1950Q4') ; +%$ % Define some dates objects +%$ d1 = dates('1950Q1','1950Q2') ; +%$ d2 = dates('1950Q3','1950Q4') ; +%$ d3 = dates('1950Q1','1950Q2','1950Q3','1950Q4') ; %$ %$ % Call the tested routine. %$ try @@ -69,19 +69,19 @@ end %$ %$ if t(1) %$ t(2) = dyn_assert(e1==d3,1); -%$ t(3) = dyn_assert(e2==dynDates('1950Q1','1950Q2','1950Q3','1950Q4','1950Q1','1950Q2','1950Q3','1950Q4'),1); +%$ t(3) = dyn_assert(e2==dates('1950Q1','1950Q2','1950Q3','1950Q4','1950Q1','1950Q2','1950Q3','1950Q4'),1); %$ end %$ T = all(t); %@eof:1 %@test:2 -%$ % Define some dynDates objects -%$ d1 = dynDates('1950Q1'); -%$ e1 = dynDates('1950Q2'); -%$ e2 = dynDates('1950Q3'); -%$ e3 = dynDates('1950Q4'); -%$ e4 = dynDates('1951Q1'); -%$ e5 = dynDates('1950Q2','1950Q3','1950Q4','1951Q1'); +%$ % Define some dates objects +%$ d1 = dates('1950Q1'); +%$ e1 = dates('1950Q2'); +%$ e2 = dates('1950Q3'); +%$ e3 = dates('1950Q4'); +%$ e4 = dates('1951Q1'); +%$ e5 = dates('1950Q2','1950Q3','1950Q4','1951Q1'); %$ %$ % Call the tested routine. %$ try @@ -106,13 +106,13 @@ end %@eof:2 %@test:3 -%$ % Define some dynDates objects -%$ d1 = dynDates('1950Q1'); -%$ e1 = dynDates('1949Q4'); -%$ e2 = dynDates('1949Q3'); -%$ e3 = dynDates('1949Q2'); -%$ e4 = dynDates('1949Q1'); -%$ e5 = dynDates('1948Q4'); +%$ % Define some dates objects +%$ d1 = dates('1950Q1'); +%$ e1 = dates('1949Q4'); +%$ e2 = dates('1949Q3'); +%$ e3 = dates('1949Q2'); +%$ e4 = dates('1949Q1'); +%$ e5 = dates('1948Q4'); %$ %$ % Call the tested routine. %$ try diff --git a/matlab/@dynDates/pop.m b/matlab/@dates/pop.m similarity index 72% rename from matlab/@dynDates/pop.m rename to matlab/@dates/pop.m index c75d756da..4efb7ec9e 100644 --- a/matlab/@dynDates/pop.m +++ b/matlab/@dates/pop.m @@ -1,13 +1,13 @@ function B = pop(A,a) % --*-- Unitary tests --*-- -% pop method for dynDates class (removes a date). +% pop method for dates class (removes a date). % % INPUTS -% o A dynDates object. -% o a dynDates object with one element, string which can be interpreted as a date or integer scalar. +% o A dates object. +% o a dates object with one element, string which can be interpreted as a date or integer scalar. % % OUTPUTS -% o B dynDates object (with B.ndat==A.ndat-1). +% o B dates object (with B.ndat==A.ndat-1). % % REMARKS % If a is a date appearing more than once in A, then only the last occurence is removed. If one wants to @@ -32,7 +32,7 @@ function B = pop(A,a) % --*-- Unitary tests --*-- if nargin<2 % Remove last date - B = dynDates(); + B = dates(); B.ndat = A.ndat-1; B.freq = A.freq; B.time = NaN(B.ndat,2); @@ -40,15 +40,15 @@ if nargin<2 return end -if ~(isa(a,'dynDates') || isdate(a) || (isscalar(a) && isint(a))) - error(['dynDates::pop: Input argument ' inputname(2) ' has to be a dynDates object with a single element, a string (which can be interpreted as a date) or an integer.']) +if ~(isa(a,'dates') || isdate(a) || (isscalar(a) && isint(a))) + error(['dates::pop: Input argument ' inputname(2) ' has to be a dates object with a single element, a string (which can be interpreted as a date) or an integer.']) end if ischar(a) - a = dynDates(a); + a = dates(a); end -B = dynDates(); +B = dates(); B.ndat = A.ndat-1; B.freq = A.freq; B.time = NaN(B.ndat,2); @@ -58,7 +58,7 @@ if isscalar(a) && isint(a) B.time = A.time(idx,:); else if ~isequal(A.freq,a.freq) - error('dynDates::pop: Inputs must have common frequency!') + error('dates::pop: Inputs must have common frequency!') end idx = find(A==a); jdx = find(transpose(1:A.ndat)~=idx(end)); @@ -79,8 +79,8 @@ end %$ e.ndat = 5; %$ %$ % Call the tested routine -%$ d = dynDates(B4,B3,B2,B1); -%$ d = d.append(dynDates(B5)); +%$ d = dates(B4,B3,B2,B1); +%$ d = d.append(dates(B5)); %$ f = d.pop(); %$ t(1) = dyn_assert(f.time,e.time(1:end-1,:)); %$ t(2) = dyn_assert(f.freq,e.freq); @@ -89,7 +89,7 @@ end %$ t(4) = dyn_assert(f.time,[1945 3; 1950 1; 1950 2; 2009 2]); %$ t(5) = dyn_assert(f.freq,e.freq); %$ t(6) = dyn_assert(f.ndat,e.ndat-1); -%$ f = d.pop(dynDates(B1)); +%$ f = d.pop(dates(B1)); %$ t(7) = dyn_assert(f.time,[1945 3; 1950 1; 1950 2; 2009 2]); %$ t(8) = dyn_assert(f.freq,e.freq); %$ t(9) = dyn_assert(f.ndat,e.ndat-1); @@ -107,13 +107,13 @@ end %$ B5 = '2009Q2'; %$ %$ % Call the tested routine -%$ d = dynDates(B1,B2,B3,B4); -%$ d = d.append(dynDates(B5)); +%$ d = dates(B1,B2,B3,B4); +%$ d = d.append(dates(B5)); %$ f = d.pop(); -%$ t(1) = dyn_assert(isequal(f,dynDates(B1,B2,B3,B4)),1); +%$ t(1) = dyn_assert(isequal(f,dates(B1,B2,B3,B4)),1); %$ f = d.pop(B1); -%$ t(2) = dyn_assert(isequal(f,dynDates(B1,B2,B4,B5)),1); +%$ t(2) = dyn_assert(isequal(f,dates(B1,B2,B4,B5)),1); %$ g = f.pop(1); -%$ t(3) = dyn_assert(isequal(g,dynDates(B2,B4,B5)),1); +%$ t(3) = dyn_assert(isequal(g,dates(B2,B4,B5)),1); %$ T = all(t); %@eof:2 \ No newline at end of file diff --git a/matlab/@dynDates/size.m b/matlab/@dates/size.m similarity index 100% rename from matlab/@dynDates/size.m rename to matlab/@dates/size.m diff --git a/matlab/@dynDates/sort.m b/matlab/@dates/sort.m similarity index 85% rename from matlab/@dynDates/sort.m rename to matlab/@dates/sort.m index 2a39dbd20..7f4c76417 100644 --- a/matlab/@dynDates/sort.m +++ b/matlab/@dates/sort.m @@ -1,10 +1,10 @@ function dd = sort(dd) % --*-- Unitary tests --*-- -% sort method for dynDates class. +% sort method for dates class. %@info: %! @deftypefn {Function File} {@var{a} =} sort (@var{a}) -%! @anchor{dynDates/sort} +%! @anchor{dates/sort} %! @sp 1 %! Sort method for the Dynare dates class. %! @sp 2 @@ -12,14 +12,14 @@ function dd = sort(dd) % --*-- Unitary tests --*-- %! @sp 1 %! @table @ @var %! @item a -%! Object instantiated by @ref{dynDates}. +%! Object instantiated by @ref{dates}. %! @end table %! @sp 2 %! @strong{Outputs} %! @sp 1 %! @table @ @var %! @item a -%! Object instantiated by @ref{dynDates}, with dates sorted by increasing order. +%! Object instantiated by @ref{dates}, with dates sorted by increasing order. %! @end table %! @sp 2 %! @strong{This function is called by:} @@ -46,8 +46,8 @@ function dd = sort(dd) % --*-- Unitary tests --*-- % You should have received a copy of the GNU General Public License % along with Dynare. If not, see . -if ~isa(dd,'dynDates') - error(['dynDates::sort: Input argument ' inputname(1) ' has to be a dynDates object.']) +if ~isa(dd,'dates') + error(['dates::sort: Input argument ' inputname(1) ' has to be a dates object.']) end if dd.ndat==1 @@ -69,7 +69,7 @@ dd.time = sortrows(dd.time,[1,2]); %$ e.ndat = 4; %$ %$ % Call the tested routine. -%$ d = dynDates(B1,B2,B3,B4); +%$ d = dates(B1,B2,B3,B4); %$ d = d.sort; %$ %$ % Check the results. @@ -92,7 +92,7 @@ dd.time = sortrows(dd.time,[1,2]); %$ e.ndat = 4; %$ %$ % Call the tested routine. -%$ d = dynDates(B1,B2,B3,B4); +%$ d = dates(B1,B2,B3,B4); %$ d = d.sort(); %$ %$ % Check the results. diff --git a/matlab/@dynDates/subsasgn.m b/matlab/@dates/subsasgn.m similarity index 91% rename from matlab/@dynDates/subsasgn.m rename to matlab/@dates/subsasgn.m index 483909756..4b9100704 100644 --- a/matlab/@dynDates/subsasgn.m +++ b/matlab/@dates/subsasgn.m @@ -17,4 +17,4 @@ function val = subsasgn(val, idx, rhs) % You should have received a copy of the GNU General Public License % along with Dynare. If not, see . -error('dynDates::subsasgn: Members of dynDates class are private') \ No newline at end of file +error('dates::subsasgn: Members of dates class are private') \ No newline at end of file diff --git a/matlab/@dynDates/subsref.m b/matlab/@dates/subsref.m similarity index 67% rename from matlab/@dynDates/subsref.m rename to matlab/@dates/subsref.m index 90ab8f150..789c63d3a 100644 --- a/matlab/@dynDates/subsref.m +++ b/matlab/@dates/subsref.m @@ -1,13 +1,13 @@ function B = subsref(A,S) % --*-- Unitary tests --*-- -% Overload the subsref method for dynDates objects. +% Overload the subsref method for dates objects. % % INPUTS -% o A dynDates object. +% o A dates object. % o S matlab's structure. % % OUTPUTS -% o B dynDates object. +% o B dates object. % % REMARKS % See the matlab's documentation about the subsref method. @@ -34,7 +34,7 @@ switch S(1).type switch S(1).subs case {'time','freq','ndat'}% Access public members. if length(S)>1 && isequal(S(2).type,'()') && isempty(S(2).subs) - error(['dynDates::subsref: ' S(1).subs ' is not a method but a member!']) + error(['dates::subsref: ' S(1).subs ' is not a method but a member!']) end B = builtin('subsref', A, S(1)); case {'sort','unique'}% Public methods (without arguments) @@ -47,19 +47,19 @@ switch S(1).type B = feval(S(1).subs,A,S(2).subs{:}); S = shiftS(S); else - error('dynDates::subsref: Something is wrong in your syntax!') + error('dates::subsref: Something is wrong in your syntax!') end otherwise - error('dynDates::subsref: Unknown public member or method!') + error('dates::subsref: Unknown public member or method!') end case '()' if isempty(A) if isempty(A.freq) - % Populate an empty dynDates object with time member (freq is not specified). Needs two or three inputs. First input is an integer + % Populate an empty dates object with time member (freq is not specified). Needs two or three inputs. First input is an integer % scalar specifying the frequency. Second input is either the time member (a n*2 array of integers) or a column vector with n % elements (the first column of the time member --> years). If the the second input is a row vector and if A.freq~=1 a third input % is necessary. The third input is n*1 vector of integers between 1 and A.freq (second column of the time member --> subperiods). - B = dynDates(); + B = dates(); % First input is the frequency. if isfreq(S(1).subs{1}) if ischar(S(1).subs{1}) @@ -68,103 +68,103 @@ switch S(1).type B.freq = S(1).subs{1}; end else - error('dynDates::subsref: First input must be a frequency!') + error('dates::subsref: First input must be a frequency!') end if isequal(length(S(1).subs),2) % If two inputs are provided, the second input must be a n*2 array except if frequency is annual. [n, m] = size(S(1).subs{2}); if m>2 - error('dynDates::subsref: Second input argument array cannot have more than two columns!') + error('dates::subsref: Second input argument array cannot have more than two columns!') end if ~isequal(m,2) && ~isequal(B.freq,1) - error('dynDates::subsref: Second argument has to be a n*2 array for non annual frequency!') + error('dates::subsref: Second argument has to be a n*2 array for non annual frequency!') end if ~all(all(S(1).subs{2})) - error('dynDates::subsref: Second argument has be an array of intergers!') + error('dates::subsref: Second argument has be an array of intergers!') end if m>1 && ~issubperiod(S(1).subs{2}(:,2),B.freq) - error(['dynDates::subsref: Elements in the second column of the first input argument are not legal subperiods (should be integers betwwen 1 and ' num2str(B.freq) ')!']) + error(['dates::subsref: Elements in the second column of the first input argument are not legal subperiods (should be integers betwwen 1 and ' num2str(B.freq) ')!']) end if isequal(m,2) B.time = S(1).subs{2}; elseif isequal(m,1) B.time = [S(1).subs{2}, ones(n,1)]; else - error(['dynDates::subsref: This is a bug!']) + error(['dates::subsref: This is a bug!']) end B.ndat = rows(B.time); elseif isequal(length(S(1).subs),3) % If three inputs are provided, the second and third inputs are column verctors of integers (years and subperiods). if ~iscolumn(S(1).subs{2}) && ~all(isint(S(1).subs{2})) - error('dynDates::subsref: Second input argument must be a column vector of integers!') + error('dates::subsref: Second input argument must be a column vector of integers!') end n1 = size(S(1).subs{2},1); if ~iscolumn(S(1).subs{3}) && ~issubperiod(S(1).subs{3}, B.freq) - error(['dynDates::subsref: Third input argument must be a column vector of subperiods (integers between 1 and ' num2str(B.freq) ')!']) + error(['dates::subsref: Third input argument must be a column vector of subperiods (integers between 1 and ' num2str(B.freq) ')!']) end n2 = size(S(1).subs{3},1); if ~isequal(n1,n2) - error('dynDates::subsref: Second and third input arguments must have the same number of elements!') + error('dates::subsref: Second and third input arguments must have the same number of elements!') end B.time = [S(1).subs{2}, S(1).subs{3}]; B.ndat = rows(B.time); else - error('dynDates::subsref: Wrong calling sequence!') + error('dates::subsref: Wrong calling sequence!') end else - % Populate an empty dynDates object with time member (freq is already specified). + % Populate an empty dates object with time member (freq is already specified). % Needs one (time) or two (first and second columns of time for years and subperiods) inputs. B = A; if isequal(length(S(1).subs),2) if ~iscolumn(S(1).subs{1}) && ~all(isint(S(1).subs{1})) - error('dynDates::subsref: First argument has to be a column vector of integers!') + error('dates::subsref: First argument has to be a column vector of integers!') end n1 = size(S(1).subs{1},1); if ~iscolumn(S(1).subs{2}) && ~issubperiod(S(1).subs{2}, B.freq) - error(['dynDates::subsref: Second argument has to be a column vector of subperiods (integers between 1 and ' num2str(B.freq) ')!']) + error(['dates::subsref: Second argument has to be a column vector of subperiods (integers between 1 and ' num2str(B.freq) ')!']) end n2 = size(S(1).subs{2},1); if ~isequal(n2,n1) - error('dynDates::subsref: First and second argument must have the same number of rows!') + error('dates::subsref: First and second argument must have the same number of rows!') end B.time = [S(1).subs{1}, S(1).subs{2}]; B.ndat = rows(B.time); elseif isequal(length(S(1).subs),1) [n, m] = size(S(1).subs{1}); if ~isequal(m,2) && ~isequal(B.freq,1) - error('dynDates::subsref: First argument has to be a n*2 array!') + error('dates::subsref: First argument has to be a n*2 array!') end if ~all(isint(S(1).subs{1}(:,1))) - error('dynDates::subsref: First column of the first argument has to be a column vector of integers!') + error('dates::subsref: First column of the first argument has to be a column vector of integers!') end if m>1 && issubperiod(S(1).subs{1}(:,1), B.freq) - error(['dynDates::subsref: The second column of the first input argument has to be a column vector of subperiods (integers between 1 and ' num2str(B.freq) ')!']) + error(['dates::subsref: The second column of the first input argument has to be a column vector of subperiods (integers between 1 and ' num2str(B.freq) ')!']) end if isequal(m,2) B.time = S(1).subs{1}; elseif isequal(m,1) && isequal(B.freq,1) B.time = [S(1).subs{1}, ones(n,1)]; else - error(['dynDates::subsref: This is a bug!']) + error(['dates::subsref: This is a bug!']) end B.ndat = rows(B.time); else - error('dynDates::subsref: Wrong number of inputs!') + error('dates::subsref: Wrong number of inputs!') end end else - % dynDates object A is not empty. We extract some dates + % dates object A is not empty. We extract some dates if isvector(S(1).subs{1}) && all(isint(S(1).subs{1})) && all(S(1).subs{1}>0) && all(S(1).subs{1}<=A.ndat) - B = dynDates(); + B = dates(); B.freq = A.freq; B.time = A.time(S(1).subs{1},:); B.ndat = rows(B.time); else - error(['dynDates::subsref: indices has to be a vector of positive integers less than or equal to ' int2str(A.ndat) '!']) + error(['dates::subsref: indices has to be a vector of positive integers less than or equal to ' int2str(A.ndat) '!']) end end otherwise - error('dynDates::subsref: Something is wrong in your syntax!') + error('dates::subsref: Something is wrong in your syntax!') end S = shiftS(S); @@ -173,13 +173,13 @@ if ~isempty(S) end %@test:1 -%$ % Define a dynDates object -%$ B = dynDates('1950Q1','1950Q2','1950Q3','1950Q4','1951Q1'); +%$ % Define a dates object +%$ B = dates('1950Q1','1950Q2','1950Q3','1950Q4','1951Q1'); %$ -%$ % Try to extract a sub-dynDates object. +%$ % Try to extract a sub-dates object. %$ d = B(2:3); %$ -%$ if isa(d,'dynDates') +%$ if isa(d,'dates') %$ t(1) = 1; %$ else %$ t(1) = 0; @@ -194,14 +194,14 @@ end %@eof:1 %@test:2 -%$ % Define a dynDates object -%$ B = dynDates('1950Q1'):dynDates('1960Q3'); +%$ % Define a dates object +%$ B = dates('1950Q1'):dates('1960Q3'); %$ -%$ % Try to extract a sub-dynDates object and apply a method +%$ % Try to extract a sub-dates object and apply a method %$ %$ d = B(2:3).sort ; %$ -%$ if isa(d,'dynDates') +%$ if isa(d,'dates') %$ t(1) = 1; %$ else %$ t(1) = 0; @@ -216,14 +216,14 @@ end %@eof:2 %@test:3 -%$ % Define a dynDates object -%$ B = dynDates('1950Q1'):dynDates('1960Q3'); +%$ % Define a dates object +%$ B = dates('1950Q1'):dates('1960Q3'); %$ -%$ % Try to extract a sub-dynDates object and apply a method +%$ % Try to extract a sub-dates object and apply a method %$ %$ d = B(2:3).sort() ; %$ -%$ if isa(d,'dynDates') +%$ if isa(d,'dates') %$ t(1) = 1; %$ else %$ t(1) = 0; @@ -238,13 +238,13 @@ end %@eof:3 %@test:4 -%$ % Define a dynDates object -%$ B = dynDates('1950Q1','1950Q2','1950Q3','1950Q4','1951Q1'); +%$ % Define a dates object +%$ B = dates('1950Q1','1950Q2','1950Q3','1950Q4','1951Q1'); %$ -%$ % Try to extract a sub-dynDates object. +%$ % Try to extract a sub-dates object. %$ d = B(2); %$ -%$ if isa(d,'dynDates') +%$ if isa(d,'dates') %$ t(1) = 1; %$ else %$ t(1) = 0; @@ -259,8 +259,8 @@ end %@eof:4 %@test:5 -%$ % Define an empty dynDates object with quaterly frequency. -%$ qq = dynDates('Q'); +%$ % Define an empty dates object with quaterly frequency. +%$ qq = dates('Q'); %$ %$ % Define a ranges of dates using qq. %$ try @@ -294,8 +294,8 @@ end %@eof:5 %@test:6 -%$ % Define an empty dynDates object with quaterly frequency. -%$ date = dynDates(); +%$ % Define an empty dates object with quaterly frequency. +%$ date = dates(); %$ %$ % Define a ranges of dates using qq. %$ try diff --git a/matlab/@dynDates/uminus.m b/matlab/@dates/uminus.m similarity index 67% rename from matlab/@dynDates/uminus.m rename to matlab/@dates/uminus.m index a6e464f2d..da81f8f0c 100644 --- a/matlab/@dynDates/uminus.m +++ b/matlab/@dates/uminus.m @@ -1,12 +1,12 @@ function B = uminus(A) % --*-- Unitary tests --*-- -% Overloads the unary plus operator for dynDates objects. Shifts all the elements by one period. +% Overloads the unary plus operator for dates objects. Shifts all the elements by one period. % % INPUTS -% o A dynDates object with n elements. +% o A dates object with n elements. % % OUTPUTS -% o B dynDates object with n elements. +% o B dates object with n elements. % Copyright (C) 2013 Dynare Team % @@ -25,7 +25,7 @@ function B = uminus(A) % --*-- Unitary tests --*-- % You should have received a copy of the GNU General Public License % along with Dynare. If not, see . -B = dynDates(A); +B = dates(A); B.time(:,2) = B.time(:,2)-1; idx = find(B.time(:,2)==0); B.time(idx,1) = B.time(idx,1)-1; @@ -40,16 +40,16 @@ B.time(idx,2) = B.freq; %$ date_5 = '1950M1'; %$ %$ % Call the tested routine. -%$ d1 = dynDates(date_1); d1 = -d1; -%$ d2 = dynDates(date_2); d2 = -d2; -%$ d3 = dynDates(date_3); d3 = -d3; -%$ d4 = dynDates(date_4); d4 = -d4; -%$ d5 = dynDates(date_5); d5 = -d5; -%$ i1 = (d1==dynDates('1949Y')); -%$ i2 = (d2==dynDates('1950Q1')); -%$ i3 = (d3==dynDates('1949Q4')); -%$ i4 = (d4==dynDates('1950M1')); -%$ i5 = (d5==dynDates('1949M12')); +%$ d1 = dates(date_1); d1 = -d1; +%$ d2 = dates(date_2); d2 = -d2; +%$ d3 = dates(date_3); d3 = -d3; +%$ d4 = dates(date_4); d4 = -d4; +%$ d5 = dates(date_5); d5 = -d5; +%$ i1 = (d1==dates('1949Y')); +%$ i2 = (d2==dates('1950Q1')); +%$ i3 = (d3==dates('1949Q4')); +%$ i4 = (d4==dates('1950M1')); +%$ i5 = (d5==dates('1949M12')); %$ %$ % Check the results. %$ t(1) = dyn_assert(i1,1); @@ -61,8 +61,8 @@ B.time(idx,2) = B.freq; %@eof:1 %@test:2 -%$ d1 = dynDates('1950Q1','1950Q2','1950Q3','1950Q4','1951Q1'); -%$ d2 = dynDates('1949Q4','1950Q1','1950Q2','1950Q3','1950Q4'); +%$ d1 = dates('1950Q1','1950Q2','1950Q3','1950Q4','1951Q1'); +%$ d2 = dates('1949Q4','1950Q1','1950Q2','1950Q3','1950Q4'); %$ try %$ d3 = -d1; %$ t(1) = 1; diff --git a/matlab/@dynDates/union.m b/matlab/@dates/union.m similarity index 80% rename from matlab/@dynDates/union.m rename to matlab/@dates/union.m index 59eab7e28..b9545a482 100644 --- a/matlab/@dynDates/union.m +++ b/matlab/@dates/union.m @@ -2,7 +2,7 @@ function C = union(A,varargin) % --*-- Unitary tests --*-- %@info: %! @deftypefn {Function File} {@var{C} =} union (@var{A},@var{B}) -%! @anchor{dynDates/union} +%! @anchor{dates/union} %! @sp 1 %! Union method for the Dynare dates class (removes repetitions if any). Dates in C are sorted in increasing order. %! @sp 2 @@ -10,16 +10,16 @@ function C = union(A,varargin) % --*-- Unitary tests --*-- %! @sp 1 %! @table @ @var %! @item A -%! Object instantiated by @ref{dynDates}. +%! Object instantiated by @ref{dates}. %! @item B -%! Object instantiated by @ref{dynDates}. +%! Object instantiated by @ref{dates}. %! @end table %! @sp 2 %! @strong{Outputs} %! @sp 1 %! @table @ @var %! @item C -%! Object instantiated by @ref{dynDates}. +%! Object instantiated by @ref{dates}. %! @end table %! @end deftypefn %@eod: @@ -41,8 +41,8 @@ function C = union(A,varargin) % --*-- Unitary tests --*-- % You should have received a copy of the GNU General Public License % along with Dynare. If not, see . -if ~isa(A,'dynDates') - error(['dynDates::union: Input argument ''' inputname(1) ''' has to be a dynDates object!']) +if ~isa(A,'dates') + error(['dates::union: Input argument ''' inputname(1) ''' has to be a dates object!']) end C = A; @@ -52,17 +52,17 @@ if ~length(varargin) end for i=1:length(varargin) - if isa(varargin{i},'dynDates') + if isa(varargin{i},'dates') C = C + varargin{i}; else - error(['dynDates::union: Input argument ''' inputname(i) ''' has to be a dynDates object!']) + error(['dates::union: Input argument ''' inputname(i) ''' has to be a dates object!']) end end C = sort(unique(C)); %@test:1 -%$ % Define some dynDates objects +%$ % Define some dates objects %$ d1 = dynDate('1950Q1'):dynDate('1959Q4') ; %$ d2 = dynDate('1960Q1'):dynDate('1969Q4') ; %$ d3 = dynDate('1970Q1'):dynDate('1979Q4') ; diff --git a/matlab/@dynDates/unique.m b/matlab/@dates/unique.m similarity index 85% rename from matlab/@dynDates/unique.m rename to matlab/@dates/unique.m index c800fd9b8..287dd1b8d 100644 --- a/matlab/@dynDates/unique.m +++ b/matlab/@dates/unique.m @@ -1,10 +1,10 @@ function dd = unique(dd) % --*-- Unitary tests --*-- -% unique method for dynDates class. +% unique method for dates class. %@info: %! @deftypefn {Function File} {@var{a} =} unique (@var{a}) -%! @anchor{dynDates/unique} +%! @anchor{dates/unique} %! @sp 1 %! Unique method for the Dynare dates class (removes repetitions). %! @sp 2 @@ -12,14 +12,14 @@ function dd = unique(dd) % --*-- Unitary tests --*-- %! @sp 1 %! @table @ @var %! @item a -%! Object instantiated by @ref{dynDates}. +%! Object instantiated by @ref{dates}. %! @end table %! @sp 2 %! @strong{Outputs} %! @sp 1 %! @table @ @var %! @item a -%! Object instantiated by @ref{dynDates}. +%! Object instantiated by @ref{dates}. %! @end table %! @sp 2 %! @strong{This function is called by:} @@ -46,8 +46,8 @@ function dd = unique(dd) % --*-- Unitary tests --*-- % You should have received a copy of the GNU General Public License % along with Dynare. If not, see . -if ~isa(dd,'dynDates') - error(['dynDates::unique: Input argument ' inputname(1) ' has to be a dynDates object.']) +if ~isa(dd,'dates') + error(['dates::unique: Input argument ' inputname(1) ' has to be a dates object.']) end if dd.ndat==1 @@ -72,7 +72,7 @@ dd.ndat = size(dd.time,1); %$ e.ndat = 4; %$ %$ % Call the tested routine. -%$ d = dynDates(B1,B2,B3,B4,B5); +%$ d = dates(B1,B2,B3,B4,B5); %$ d = d.unique; %$ %$ % Check the results. diff --git a/matlab/@dynDates/uplus.m b/matlab/@dates/uplus.m similarity index 67% rename from matlab/@dynDates/uplus.m rename to matlab/@dates/uplus.m index d421af9de..33bf6ff2b 100644 --- a/matlab/@dynDates/uplus.m +++ b/matlab/@dates/uplus.m @@ -1,12 +1,12 @@ function B = uplus(A) % --*-- Unitary tests --*-- -% Overloads the unary plus operator for dynDates objects. Shifts all the elements by one period. +% Overloads the unary plus operator for dates objects. Shifts all the elements by one period. % % INPUTS -% o A dynDates object with n elements. +% o A dates object with n elements. % % OUTPUTS -% o B dynDates object with n elements. +% o B dates object with n elements. % Copyright (C) 2013 Dynare Team % @@ -25,7 +25,7 @@ function B = uplus(A) % --*-- Unitary tests --*-- % You should have received a copy of the GNU General Public License % along with Dynare. If not, see . -B = dynDates(A); +B = dates(A); B.time(:,2) = B.time(:,2)+1; idx = find(B.time(:,2)>B.freq); % Happy new year! B.time(idx,1) = B.time(idx,1)+1; @@ -40,16 +40,16 @@ B.time(idx,2) = 1; %$ date_5 = '1950M12'; %$ %$ % Call the tested routine. -%$ d1 = dynDates(date_1); d1 = +d1; -%$ d2 = dynDates(date_2); d2 = +d2; -%$ d3 = dynDates(date_3); d3 = +d3; -%$ d4 = dynDates(date_4); d4 = +d4; -%$ d5 = dynDates(date_5); d5 = +d5; -%$ i1 = (d1==dynDates('1951Y')); -%$ i2 = (d2==dynDates('1950Q3')); -%$ i3 = (d3==dynDates('1951Q1')); -%$ i4 = (d4==dynDates('1950M3')); -%$ i5 = (d5==dynDates('1951M1')); +%$ d1 = dates(date_1); d1 = +d1; +%$ d2 = dates(date_2); d2 = +d2; +%$ d3 = dates(date_3); d3 = +d3; +%$ d4 = dates(date_4); d4 = +d4; +%$ d5 = dates(date_5); d5 = +d5; +%$ i1 = (d1==dates('1951Y')); +%$ i2 = (d2==dates('1950Q3')); +%$ i3 = (d3==dates('1951Q1')); +%$ i4 = (d4==dates('1950M3')); +%$ i5 = (d5==dates('1951M1')); %$ %$ % Check the results. %$ t(1) = dyn_assert(i1,1); @@ -61,8 +61,8 @@ B.time(idx,2) = 1; %@eof:1 %@test:2 -%$ d1 = dynDates('1950Q1','1950Q2','1950Q3','1950Q4','1951Q1'); -%$ d2 = dynDates('1950Q2','1950Q3','1950Q4','1951Q1','1951Q2'); +%$ d1 = dates('1950Q1','1950Q2','1950Q3','1950Q4','1951Q1'); +%$ d2 = dates('1950Q2','1950Q3','1950Q4','1951Q1','1951Q2'); %$ try %$ d3 = +d1; %$ t(1) = 1; diff --git a/matlab/@dynSeries/dynSeries.m b/matlab/@dynSeries/dynSeries.m index 87afc0421..9bba45f52 100644 --- a/matlab/@dynSeries/dynSeries.m +++ b/matlab/@dynSeries/dynSeries.m @@ -85,7 +85,7 @@ ts.name = {}; ts.tex = {}; ts.freq = []; ts.init = dynDate(); -ts.time = dynDates(); +ts.time = dates(); ts = class(ts,'dynSeries'); diff --git a/matlab/@dynSeries/eq.m b/matlab/@dynSeries/eq.m index 2906f1c90..fb55941b1 100644 --- a/matlab/@dynSeries/eq.m +++ b/matlab/@dynSeries/eq.m @@ -42,7 +42,7 @@ function C = eq(A,B) % --*-- Unitary tests --*-- % along with Dynare. If not, see . if nargin~=2 - error('dynDates::eq: I need exactly two input arguments!') + error('dates::eq: I need exactly two input arguments!') end C = isequal(A,B); diff --git a/matlab/@dynSeries/subsasgn.m b/matlab/@dynSeries/subsasgn.m index fe655bd85..5c3a51612 100644 --- a/matlab/@dynSeries/subsasgn.m +++ b/matlab/@dynSeries/subsasgn.m @@ -105,7 +105,7 @@ switch length(S) A.freq = A.init.freq; A.time = A.init:A.init+(A.nobs-1); return - elseif isequal(S(1).subs,'time') && isa(B,'dynDates') + elseif isequal(S(1).subs,'time') && isa(B,'dates') % Overwrite the time member... A.time = B; % ... and update the freq and init members. @@ -131,7 +131,7 @@ switch length(S) end end case '()' % Date(s) selection - if isa(S(1).subs{1},'dynDates') || isa(S(1).subs{1},'dynDate') + if isa(S(1).subs{1},'dates') || isa(S(1).subs{1},'dynDate') [junk, tdx] = intersect(A.time.time,S(1).subs{1}.time,'rows'); if isa(B,'dynSeries') [junk, tdy] = intersect(B.time.time,S(1).subs{1}.time,'rows'); @@ -172,7 +172,7 @@ switch length(S) sA = extract(A,S(1).subs); end if (isa(B,'dynSeries') && isequal(sA.vobs,B.vobs)) || (isnumeric(B) && isequal(sA.vobs,columns(B))) || (isnumeric(B) && isequal(columns(B),1)) - if isa(S(2).subs{1},'dynDates') || isa(S(2).subs{1},'dynDate') + if isa(S(2).subs{1},'dates') || isa(S(2).subs{1},'dynDate') [junk, tdx] = intersect(sA.time.time,S(2).subs{1}.time,'rows'); if isa(B,'dynSeries') [junk, tdy] = intersect(B.time.time,S(2).subs{1}.time,'rows'); diff --git a/matlab/@dynSeries/subsref.m b/matlab/@dynSeries/subsref.m index 72ffd4adf..6e4d17e0a 100644 --- a/matlab/@dynSeries/subsref.m +++ b/matlab/@dynSeries/subsref.m @@ -184,8 +184,8 @@ switch S(1).type % Do nothing. B = A; end - elseif isa(S(1).subs{1},'dynDates') - % Extract a subsample using a dynDates object + elseif isa(S(1).subs{1},'dates') + % Extract a subsample using a dates object [junk,tdx] = intersect(A.time.time,S(1).subs{1}.time,'rows'); B = dynSeries(); B.data = A.data(tdx,:); @@ -199,7 +199,7 @@ switch S(1).type elseif isvector(S(1).subs{1}) && all(isint(S(1).subs{1})) % Extract a subsample using a vector of integers (observation index). % Note that this does not work if S(1).subs is an integer scalar... In which case S(1).subs is interpreted as a lead/lag operator (as in the Dynare syntax). - % To extract one observation, a dynDates with one element or a dynDate input must be used. + % To extract one observation, a dates with one element or a dynDate input must be used. if all(S(1).subs{1}>0) && all(S(1).subs{1}<=A.nobs) if size(A.data,2)>1 S(1).subs = [S(1).subs, ':']; @@ -216,7 +216,7 @@ switch S(1).type error('dynSeries::subsref: Indices are out of bounds!') end elseif isa(S(1).subs{1},'dynDate') - % Extract a subsample using a dynDates object + % Extract a subsample using a dates object [junk,tdx] = intersect(A.time.time,S(1).subs{1}.time,'rows'); B = dynSeries(); B.data = A.data(tdx,:); diff --git a/matlab/reports/@graph/graph.m b/matlab/reports/@graph/graph.m index 72273c7f9..bc1a610fe 100644 --- a/matlab/reports/@graph/graph.m +++ b/matlab/reports/@graph/graph.m @@ -115,12 +115,12 @@ valid_legend_orientations = {'vertical', 'horizontal'}; assert(any(strcmp(o.legendOrientation, valid_legend_orientations)), ... ['@graph.graph: legendOrientation must be one of ' strjoin(valid_legend_orientations, ' ')]); -assert(isempty(o.shade) || (isa(o.shade, 'dynDates') && o.shade.ndat >= 2), ... - ['@graph.graph: shade is specified as a dynDates range, e.g. ' ... - '''dynDates(''1999q1''):dynDates(''1999q3'')''.']); -assert(isempty(o.xrange) || (isa(o.xrange, 'dynDates') && o.xrange.ndat >= 2), ... - ['@graph.graph: xrange is specified as a dynDates range, e.g. ' ... - '''dynDates(''1999q1''):dynDates(''1999q3'')''.']); +assert(isempty(o.shade) || (isa(o.shade, 'dates') && o.shade.ndat >= 2), ... + ['@graph.graph: shade is specified as a dates range, e.g. ' ... + '''dates(''1999q1''):dates(''1999q3'')''.']); +assert(isempty(o.xrange) || (isa(o.xrange, 'dates') && o.xrange.ndat >= 2), ... + ['@graph.graph: xrange is specified as a dates range, e.g. ' ... + '''dates(''1999q1''):dates(''1999q3'')''.']); assert(isempty(o.yrange) || (isfloat(o.yrange) && length(o.yrange) == 2 && ... o.yrange(1) < o.yrange(2)), ... ['@graph.graph: yrange is specified an array with two float entries, ' ... diff --git a/matlab/reports/@series/getData.m b/matlab/reports/@series/getData.m index 7323f0756..6c992fa75 100644 --- a/matlab/reports/@series/getData.m +++ b/matlab/reports/@series/getData.m @@ -18,6 +18,6 @@ function ds = getData(o, dates) % You should have received a copy of the GNU General Public License % along with Dynare. If not, see . -assert(~isempty(o.data) && size(o.data, 2) == 1 && isa(dates, 'dynDates')); +assert(~isempty(o.data) && size(o.data, 2) == 1 && isa(dates, 'dates')); ds = o.data(dates); end \ No newline at end of file diff --git a/matlab/reports/@series/getLine.m b/matlab/reports/@series/getLine.m index 829bf8222..0885d904f 100644 --- a/matlab/reports/@series/getLine.m +++ b/matlab/reports/@series/getLine.m @@ -4,7 +4,7 @@ function h = getLine(o, xrange) % % INPUTS % o [series] series object -% xrange [dynDates] range of x values for line +% xrange [dates] range of x values for line % % OUTPUTS % h [handle] handle to line @@ -58,7 +58,7 @@ assert(~(strcmp(o.graphLineStyle, 'none') && isempty(o.graphMarker)), ['@series. 'you must provide at least one of graphLineStyle and graphMarker']); % Validate xrange -assert(isempty(xrange) || isa(xrange, 'dynDates')); +assert(isempty(xrange) || isa(xrange, 'dates')); % Zero tolerance assert(isfloat(o.zerotol), '@series.write: zerotol must be a float'); diff --git a/matlab/reports/@series/write.m b/matlab/reports/@series/write.m index eb2b6f277..84486fa75 100644 --- a/matlab/reports/@series/write.m +++ b/matlab/reports/@series/write.m @@ -5,7 +5,7 @@ function o = write(o, fid, dates, precision, yrsForAvgs) % INPUTS % o [series] series object % fid [int] file id -% dates [dynDates] dates for series slice +% dates [dates] dates for series slice % precision [float] precision with which to print the data % yrsForAvgs [bool] the years for which to compute averages % @@ -35,7 +35,7 @@ function o = write(o, fid, dates, precision, yrsForAvgs) %% Validate options passed to function assert(fid ~= -1); -assert(isa(dates, 'dynDates')); +assert(isa(dates, 'dates')); assert(isint(precision)); %% Validate options provided by user diff --git a/matlab/reports/@table/table.m b/matlab/reports/@table/table.m index eb742409c..3fe55b151 100644 --- a/matlab/reports/@table/table.m +++ b/matlab/reports/@table/table.m @@ -79,9 +79,9 @@ assert(islogical(o.annualAverages), '@table.table: annualAverages must be true o assert(islogical(o.showHlines), '@table.table: showHlines must be true or false'); assert(islogical(o.showVlines), '@table.table: showVlines must be true or false'); assert(isint(o.precision), '@table.table: precision must be an int'); -assert(isempty(o.range) || (isa(o.range, 'dynDates') && o.range.ndat >= 2), ... - ['@table.table: range is specified as a dynDates range, e.g. ' ... - '''dynDates(''1999q1''):dynDates(''1999q3'')''.']); +assert(isempty(o.range) || (isa(o.range, 'dates') && o.range.ndat >= 2), ... + ['@table.table: range is specified as a dates range, e.g. ' ... + '''dates(''1999q1''):dates(''1999q3'')''.']); assert(isempty(o.data) || isa(o.data, 'dynSeries'), ... '@table.table: data must be a dynSeries'); assert(isempty(o.seriesToUse) || iscellstr(o.seriesToUse), ... diff --git a/matlab/reports/reporting_object_display.m b/matlab/reports/reporting_object_display.m index a69b749c5..965110ee5 100644 --- a/matlab/reports/reporting_object_display.m +++ b/matlab/reports/reporting_object_display.m @@ -66,8 +66,8 @@ for i=1:length(fields) fprintf('false'); end elseif isobject(val) - if isa(val, 'dynDates') - fprintf('', ... + if isa(val, 'dates') + fprintf('', ... val(1).format, val(end).format); elseif isa(val, 'dynSeries') if numel(val) == 1 diff --git a/matlab/utilities/dates/date2string.m b/matlab/utilities/dates/date2string.m index bc3233925..26358ee23 100644 --- a/matlab/utilities/dates/date2string.m +++ b/matlab/utilities/dates/date2string.m @@ -3,7 +3,7 @@ function s = date2string(varargin) % Returns date as a string. % % INPUTS -% o varargin{1} + dynDates object with one element, if nargin==1. +% o varargin{1} + dates object with one element, if nargin==1. % + 1*2 vector of integers (first element is the year, second element is the subperiod), if nargin==2. % o varargin{2} integer scalar equal to 1, 4, 12 or 52 (frequency). % @@ -28,8 +28,8 @@ function s = date2string(varargin) % along with Dynare. If not, see . if isequal(nargin,1) - if ~(isa(varargin{1},'dynDates') && isequal(length(varargin{1}),1)) - error(['dynDates::format: Input argument ' inputname(1) ' has to be a dynDates object with one element!']) + if ~(isa(varargin{1},'dates') && isequal(length(varargin{1}),1)) + error(['dates::format: Input argument ' inputname(1) ' has to be a dates object with one element!']) else time = varargin{1}.time; freq = varargin{1}.freq; @@ -38,7 +38,7 @@ end if isequal(nargin,2) if ~(isvector(varargin{1}) && isequal(length(varargin{1}),2) && all(isint(varargin{1})) && isscalar(varargin{2} && ismember(varargin{2},[1 4 12 52]))) - error(['dynDates::format: First input must be a 1*2 vector of integers and second input must be a scalar integer (1, 4, 12 or 52)!']) + error(['dates::format: First input must be a 1*2 vector of integers and second input must be a scalar integer (1, 4, 12 or 52)!']) else time = varargin{1}; freq = varargin{2}; diff --git a/matlab/utilities/dates/freq2string.m b/matlab/utilities/dates/freq2string.m index 2ef00da9f..2d12f8def 100644 --- a/matlab/utilities/dates/freq2string.m +++ b/matlab/utilities/dates/freq2string.m @@ -33,5 +33,5 @@ switch freq case 52 s = 'W'; otherwise - error('dynDates::freq2string: Unknown frequency!') + error('dates::freq2string: Unknown frequency!') end \ No newline at end of file diff --git a/matlab/utilities/dates/string2date.m b/matlab/utilities/dates/string2date.m index 7237c90e3..139b65dbf 100644 --- a/matlab/utilities/dates/string2date.m +++ b/matlab/utilities/dates/string2date.m @@ -20,7 +20,7 @@ function date = string2date(a) % --*-- Unitary tests --*-- date = struct('freq', NaN, 'time', NaN(1,2)); if ~ischar(a) || ~isdate(a) - error('dynDates::string2date: Input must be a string that can be interpreted as a date!'); + error('dates::string2date: Input must be a string that can be interpreted as a date!'); end if isyearly(a) diff --git a/matlab/utilities/dates/string2freq.m b/matlab/utilities/dates/string2freq.m index 569908da6..ea04c3964 100644 --- a/matlab/utilities/dates/string2freq.m +++ b/matlab/utilities/dates/string2freq.m @@ -33,5 +33,5 @@ switch upper(s) case 'W' freq = 52; otherwise - error('dynDates::freq2string: Unknown frequency!') + error('dates::freq2string: Unknown frequency!') end \ No newline at end of file