Changed name of dynDates class to dynDate. dynDates will be used latter for irregular and unsorted sequence of dates.

time-shift
Stéphane Adjemian (Charybdis) 2011-10-03 16:34:44 +02:00
parent ead128eec8
commit 01bfd371d2
17 changed files with 203 additions and 203 deletions

View File

@ -2,17 +2,17 @@ function sp = colon(a,b)
%@info:
%! @deftypefn {Function File} {@var{sp} =} colon (@var{a},@var{b})
%! @anchor{@dynDates/colon}
%! @anchor{@dynDate/colon}
%! @sp 1
%! Overloads the colon operator for the Dynare Dates class (@ref{dynDates}). Creates a @ref{dynTime} object.
%! Overloads the colon operator for the Dynare Dates class (@ref{dynDate}). Creates a @ref{dynTime} object.
%! @sp 2
%! @strong{Inputs}
%! @sp 1
%! @table @ @var
%! @item a
%! Dynare date object instantiated by @ref{dynDates}, initial date.
%! Dynare date object instantiated by @ref{dynDate}, initial date.
%! @item b
%! Dynare date object instantiated by @ref{dynDates}, last date.
%! Dynare date object instantiated by @ref{dynDate}, last date.
%! @end table
%! @sp 1
%! @strong{Outputs}
@ -52,8 +52,8 @@ if nargin~=2
error('dynTime::colon: I need exactly two input arguments!')
end
if ~( isa(a,'dynDates') && isa(b,'dynDates'))
error(['dynTime::colon: Input arguments ' inputname(1) 'and ' inputname(2) ' have to be a dynDates objects!'])
if ~( isa(a,'dynDate') && isa(b,'dynDate'))
error(['dynTime::colon: Input arguments ' inputname(1) 'and ' inputname(2) ' have to be a dynDate objects!'])
end
if a.freq~=b.freq
@ -93,8 +93,8 @@ end
%$ 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 = dynDate(date_1);
%$ d2 = dynDate(date_2);
%$ d3 = d1:d2;
%$
%$ % Check the results.

View File

@ -1,8 +1,8 @@
function date = dynDates(a)
function date = dynDate(a)
%@info:
%! @deftypefn {Function File} {@var{date} =} dynDate (@var{a})
%! @anchor{dynDates}
%! @anchor{dynDate}
%! @sp 1
%! Constructor for the Dynare dates class.
%! @sp 2
@ -11,8 +11,8 @@ function date = dynDates(a)
%! @table @ @var
%! @item a
%! Date. For Quaterly, Monthly or Weekly data, a must be a string. For yearly data or if the frequence is not
%! defined must be an integer. If @var{a} is a dynDates object, then date will be a copy of this object. If
%! the constructor is called without input argument, it will return an empty dynDates object.
%! defined must be an integer. If @var{a} is a dynDate object, then date will be a copy of this object. If
%! the constructor is called without input argument, it will return an empty dynDate object.
%! @end table
%! @sp 1
%! @strong{Outputs}
@ -66,7 +66,7 @@ date = struct;
date.freq = NaN;
date.time = NaN(1,2);
date = class(date,'dynDates');
date = class(date,'dynDate');
switch nargin
case 0
@ -93,7 +93,7 @@ switch nargin
end
if isempty(quaterly) && isempty(monthly) && isempty(weekly)
if any(isletter(a))
error('dynDates:: Using a string as an input argument, I can only handle weekly (W), monthly (M) or quaterly (Q) data!');
error('dynDate:: Using a string as an input argument, I can only handle weekly (W), monthly (M) or quaterly (Q) data!');
else
% Yearly data declared with a string
date.freq = 1;
@ -101,7 +101,7 @@ switch nargin
date.time(2) = 1;
end
end
elseif isa(a,'dynDates') % If input argument is a dynDates object then do a copy.
elseif isa(a,'dynDate') % If input argument is a dynDate object then do a copy.
date = a;
else% If b is not a string then yearly data are assumed.
date.freq = 1;
@ -109,7 +109,7 @@ switch nargin
date.time(2) = 1;
end
otherwise
error('dynDates:: Can''t instantiate the class, wrong calling sequence!')
error('dynDate:: Can''t instantiate the class, wrong calling sequence!')
end
%@test:1
@ -135,11 +135,11 @@ end
%$ e_freq_5 = 1;
%$
%$ % Call the tested routine.
%$ d1 = dynDates(date_1);
%$ d2 = dynDates(date_2);
%$ d3 = dynDates(date_3);
%$ d4 = dynDates(date_4);
%$ d5 = dynDates(date_5);
%$ d1 = dynDate(date_1);
%$ d2 = dynDate(date_2);
%$ d3 = dynDate(date_3);
%$ d4 = dynDate(date_4);
%$ d5 = dynDate(date_5);
%$
%$ % Check the results.
%$ t(1) = dyn_assert(d1.time,e_date_1);

View File

@ -2,17 +2,17 @@ function c = eq(a,b)
%@info:
%! @deftypefn {Function File} {@var{c} =} eq (@var{a},@var{b})
%! @anchor{@dynDates/eq}
%! @anchor{@dynDate/eq}
%! @sp 1
%! Overloads the eq (equal) operator for the Dynare dates class (@ref{dynDates}).
%! Overloads the eq (equal) operator for the Dynare dates class (@ref{dynDate}).
%! @sp 2
%! @strong{Inputs}
%! @sp 1
%! @table @ @var
%! @item a
%! Dynare date object instantiated by @ref{dynDates}.
%! Dynare date object instantiated by @ref{dynDate}.
%! @item b
%! Dynare date object instantiated by @ref{dynDates}.
%! Dynare date object instantiated by @ref{dynDate}.
%! @end table
%! @sp 1
%! @strong{Outputs}
@ -50,15 +50,15 @@ function c = eq(a,b)
verbose = 0;
if nargin~=2
error('dynDates::eq: I need exactly two input arguments!')
error('dynDate::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,'dynDate') && isa(b,'dynDate'))
error(['dynDate::eq: Input arguments ' inputname(1) 'and ' inputname(2) ' have to be a dynDate objects!'])
end
if verbose && a.freq~=b.freq
disp(['dynDates::eq: Input arguments ' inputname(1) 'and ' inputname(2) ' have no common frequencies!'])
disp(['dynDate::eq: Input arguments ' inputname(1) 'and ' inputname(2) ' have no common frequencies!'])
c = 0;
end
@ -75,11 +75,11 @@ c = isequal(a.time,b.time);
%$ date_5 = '1950W32';
%$
%$ % Call the tested routine.
%$ d1 = dynDates(date_1);
%$ d2 = dynDates(date_2);
%$ d3 = dynDates(date_3);
%$ d4 = dynDates(date_4);
%$ d5 = dynDates(date_5);
%$ d1 = dynDate(date_1);
%$ d2 = dynDate(date_2);
%$ d3 = dynDate(date_3);
%$ d4 = dynDate(date_4);
%$ d5 = dynDate(date_5);
%$ i1 = (d1==d2);
%$ i2 = (d2==d2);
%$ i3 = (d4==d5);

View File

@ -2,15 +2,15 @@ function p = format(date)
%@info:
%! @deftypefn {Function File} {@var{p} =} format (@var{date})
%! @anchor{@dynDates/format}
%! @anchor{@dynDate/format}
%! @sp 1
%! Produces a formatted date from a Dynare date object instantiated by @ref{dynDates}.
%! Produces a formatted date from a Dynare date object instantiated by @ref{dynDate}.
%! @sp 2
%! @strong{Inputs}
%! @sp 1
%! @table @ @var
%! @item date
%! Dynare date object, instantiated by @ref{dynDates}.
%! Dynare date object, instantiated by @ref{dynDate}.
%! @end table
%! @sp 1
%! @strong{Outputs}
@ -47,11 +47,11 @@ function p = format(date)
if nargin~=1
error('dynDates::format: I need exactly one input argument!')
error('dynDate::format: I need exactly one input argument!')
end
if ~isa(date,'dynDates')
error(['dynDates::format: Input argument ' inputname(1) ' has to be a dynDates object!'])
if ~isa(date,'dynDate')
error(['dynDate::format: Input argument ' inputname(1) ' has to be a dynDate object!'])
end
switch date.freq
@ -64,7 +64,7 @@ switch date.freq
case 52
p = [num2str(date.time(1)) 'W' num2str(date.time(2))];
otherwise
error('dynDates::format: Unkonwn frequency!')
error('dynDate::format: Unkonwn frequency!')
end
%@test:1
@ -77,10 +77,10 @@ end
%$ date_4 = '1950W50';
%$
%$ % Call the tested routine.
%$ d1 = dynDates(date_1); DATE_1 = format(d1);
%$ d2 = dynDates(date_2); DATE_2 = format(d2);
%$ d3 = dynDates(date_3); DATE_3 = format(d3);
%$ d4 = dynDates(date_4); DATE_4 = format(d4);
%$ d1 = dynDate(date_1); DATE_1 = format(d1);
%$ d2 = dynDate(date_2); DATE_2 = format(d2);
%$ d3 = dynDate(date_3); DATE_3 = format(d3);
%$ d4 = dynDate(date_4); DATE_4 = format(d4);
%$
%$ % Check the results.
%$ t(1) = dyn_assert(num2str(date_1),DATE_1);

View File

@ -2,17 +2,17 @@ function c = ge(a,b)
%@info:
%! @deftypefn {Function File} {@var{c} =} ge (@var{a},@var{b})
%! @anchor{@dynDates/ge}
%! @anchor{@dynDate/ge}
%! @sp 1
%! Overloads the ge (greater or equal) operator for the Dynare dates class (@ref{dynDates}).
%! Overloads the ge (greater or equal) operator for the Dynare dates class (@ref{dynDate}).
%! @sp 2
%! @strong{Inputs}
%! @sp 1
%! @table @ @var
%! @item a
%! Dynare date object instantiated by @ref{dynDates}.
%! Dynare date object instantiated by @ref{dynDate}.
%! @item b
%! Dynare date object instantiated by @ref{dynDates}.
%! Dynare date object instantiated by @ref{dynDate}.
%! @end table
%! @sp 1
%! @strong{Outputs}
@ -25,7 +25,7 @@ function c = ge(a,b)
%! @strong{This function is called by:}
%! @sp 2
%! @strong{This function calls:}
%! @ref{@@dynDates/gt}, @ref{@@dynDates/eq}
%! @ref{@@dynDate/gt}, @ref{@@dynDate/eq}
%!
%! @end deftypefn
%@eod:
@ -68,10 +68,10 @@ end
%$ date_4 = '1949Q2';
%$
%$ % Call the tested routine.
%$ d1 = dynDates(date_1);
%$ d2 = dynDates(date_2);
%$ d3 = dynDates(date_3);
%$ d4 = dynDates(date_4);
%$ d1 = dynDate(date_1);
%$ d2 = dynDate(date_2);
%$ d3 = dynDate(date_3);
%$ d4 = dynDate(date_4);
%$ i1 = (d1>=d2);
%$ i2 = (d3>=d4);
%$ i3 = (d4>=d2);

View File

@ -2,17 +2,17 @@ function c = gt(a,b)
%@info:
%! @deftypefn {Function File} {@var{c} =} gt (@var{a},@var{b})
%! @anchor{@dynDates/gt}
%! @anchor{@dynDate/gt}
%! @sp 1
%! Overloads the gt (greater than) operator for the Dynare dates class (@ref{dynDates}).
%! Overloads the gt (greater than) operator for the Dynare dates class (@ref{dynDate}).
%! @sp 2
%! @strong{Inputs}
%! @sp 1
%! @table @ @var
%! @item a
%! Dynare date object instantiated by @ref{dynDates}.
%! Dynare date object instantiated by @ref{dynDate}.
%! @item b
%! Dynare date object instantiated by @ref{dynDates}.
%! Dynare date object instantiated by @ref{dynDate}.
%! @end table
%! @sp 1
%! @strong{Outputs}
@ -50,15 +50,15 @@ function c = gt(a,b)
verbose = 0;
if nargin~=2
error('dynDates::eq: I need exactly two input arguments!')
error('dynDate::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,'dynDate') && isa(b,'dynDate'))
error(['dynDate::eq: Input arguments ' inputname(1) 'and ' inputname(2) ' have to be a dynDate objects!'])
end
if verbose && a.freq~=b.freq
error(['dynDates::eq: Input arguments ' inputname(1) 'and ' inputname(2) ' have no common frequencies!'])
error(['dynDate::eq: Input arguments ' inputname(1) 'and ' inputname(2) ' have no common frequencies!'])
end
if a.time(1)>b.time(1)
@ -84,11 +84,11 @@ end
%$ date_5 = '1949Q2';
%$
%$ % Call the tested routine.
%$ d1 = dynDates(date_1);
%$ d2 = dynDates(date_2);
%$ d3 = dynDates(date_3);
%$ d4 = dynDates(date_4);
%$ d5 = dynDates(date_5);
%$ d1 = dynDate(date_1);
%$ d2 = dynDate(date_2);
%$ d3 = dynDate(date_3);
%$ d4 = dynDate(date_4);
%$ d5 = dynDate(date_5);
%$ i1 = (d2>d3);
%$ i2 = (d3>d4);
%$ i3 = (d4>d2);

View File

@ -2,17 +2,17 @@ function c = le(a,b)
%@info:
%! @deftypefn {Function File} {@var{c} =} le (@var{a},@var{b})
%! @anchor{@dynDates/le}
%! @anchor{@dynDate/le}
%! @sp 1
%! Overloads the le (less or equal) operator for the Dynare dates class (@ref{dynDates}).
%! Overloads the le (less or equal) operator for the Dynare dates class (@ref{dynDate}).
%! @sp 2
%! @strong{Inputs}
%! @sp 1
%! @table @ @var
%! @item a
%! Dynare date object instantiated by @ref{dynDates}.
%! Dynare date object instantiated by @ref{dynDate}.
%! @item b
%! Dynare date object instantiated by @ref{dynDates}.
%! Dynare date object instantiated by @ref{dynDate}.
%! @end table
%! @sp 1
%! @strong{Outputs}
@ -25,7 +25,7 @@ function c = le(a,b)
%! @strong{This function is called by:}
%! @sp 2
%! @strong{This function calls:}
%! @ref{@@dynDates/lt}, @ref{@@dynDates/eq}
%! @ref{@@dynDate/lt}, @ref{@@dynDate/eq}
%!
%! @end deftypefn
%@eod:
@ -68,10 +68,10 @@ end
%$ date_4 = '1949Q2';
%$
%$ % Call the tested routine.
%$ d1 = dynDates(date_1);
%$ d2 = dynDates(date_2);
%$ d3 = dynDates(date_3);
%$ d4 = dynDates(date_4);
%$ d1 = dynDate(date_1);
%$ d2 = dynDate(date_2);
%$ d3 = dynDate(date_3);
%$ d4 = dynDate(date_4);
%$ i1 = (d1<=d2);
%$ i2 = (d3<=d4);
%$ i3 = (d4<=d2);

View File

@ -2,17 +2,17 @@ function c = lt(a,b)
%@info:
%! @deftypefn {Function File} {@var{c} =} lt (@var{a},@var{b})
%! @anchor{@dynDates/lt}
%! @anchor{@dynDate/lt}
%! @sp 1
%! Overloads the lt (less than) operator for the Dynare dates class (@ref{dynDates}).
%! Overloads the lt (less than) operator for the Dynare dates class (@ref{dynDate}).
%! @sp 2
%! @strong{Inputs}
%! @sp 1
%! @table @ @var
%! @item a
%! Dynare date object instantiated by @ref{dynDates}.
%! Dynare date object instantiated by @ref{dynDate}.
%! @item b
%! Dynare date object instantiated by @ref{dynDates}.
%! Dynare date object instantiated by @ref{dynDate}.
%! @end table
%! @sp 1
%! @strong{Outputs}
@ -50,15 +50,15 @@ function c = lt(a,b)
verbose = 0;
if nargin~=2
error('dynDates::eq: I need exactly two input arguments!')
error('dynDate::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,'dynDate') && isa(b,'dynDate'))
error(['dynDate::eq: Input arguments ' inputname(1) 'and ' inputname(2) ' have to be a dynDate objects!'])
end
if verbose && a.freq~=b.freq
error(['dynDates::eq: Input arguments ' inputname(1) 'and ' inputname(2) ' have no common frequencies!'])
error(['dynDate::eq: Input arguments ' inputname(1) 'and ' inputname(2) ' have no common frequencies!'])
end
if a.time(1)<b.time(1)
@ -84,11 +84,11 @@ end
%$ date_5 = '1949Q2';
%$
%$ % Call the tested routine.
%$ d1 = dynDates(date_1);
%$ d2 = dynDates(date_2);
%$ d3 = dynDates(date_3);
%$ d4 = dynDates(date_4);
%$ d5 = dynDates(date_5);
%$ d1 = dynDate(date_1);
%$ d2 = dynDate(date_2);
%$ d3 = dynDate(date_3);
%$ d4 = dynDate(date_4);
%$ d5 = dynDate(date_5);
%$ i1 = (d2<d3);
%$ i2 = (d3<d4);
%$ i3 = (d4<d2);

View File

@ -2,24 +2,24 @@ function c = max(a,b)
%@info:
%! @deftypefn {Function File} {@var{c} =} max (@var{a},@var{b})
%! @anchor{@dynDates/gt}
%! @anchor{@dynDate/gt}
%! @sp 1
%! Overloads the max function for the Dynare dates class @ref{dynDates}.
%! Overloads the max function for the Dynare dates class @ref{dynDate}.
%! @sp 2
%! @strong{Inputs}
%! @sp 1
%! @table @ @var
%! @item a
%! Dynare date object instantiated by @ref{dynDates}.
%! Dynare date object instantiated by @ref{dynDate}.
%! @item b
%! Dynare date object instantiated by @ref{dynDates}.
%! Dynare date object instantiated by @ref{dynDate}.
%! @end table
%! @sp 1
%! @strong{Outputs}
%! @sp 1
%! @table @ @var
%! @item c
%! Dynare date object instantiated by @ref{dynDates}. @var{c} is a copy of @var{a} if @var{a}>=@var{b}, a copy of @var{b} otherwise.
%! Dynare date object instantiated by @ref{dynDate}. @var{c} is a copy of @var{a} if @var{a}>=@var{b}, a copy of @var{b} otherwise.
%! @end table
%! @sp 2
%! @strong{This function is called by:}
@ -50,15 +50,15 @@ function c = max(a,b)
verbose = 0;
if nargin~=2
error('dynDates::min: I need exactly two input arguments!')
error('dynDate::min: I need exactly two input arguments!')
end
if ~( isa(a,'dynDates') && isa(b,'dynDates'))
error(['dynDates::min: Input arguments ' inputname(1) 'and ' inputname(2) ' have to be a dynDates objects!'])
if ~( isa(a,'dynDate') && isa(b,'dynDate'))
error(['dynDate::min: Input arguments ' inputname(1) 'and ' inputname(2) ' have to be a dynDate objects!'])
end
if verbose && a.freq~=b.freq
error(['dynDates::min: Input arguments ' inputname(1) 'and ' inputname(2) ' have no common frequencies!'])
error(['dynDate::min: Input arguments ' inputname(1) 'and ' inputname(2) ' have no common frequencies!'])
end
if a>=b
@ -79,12 +79,12 @@ end
%$ date_6 = '1948M6';
%$
%$ % Call the tested routine.
%$ d1 = dynDates(date_1);
%$ d2 = dynDates(date_2);
%$ d3 = dynDates(date_3);
%$ d4 = dynDates(date_4);
%$ d5 = dynDates(date_5);
%$ d6 = dynDates(date_6);
%$ d1 = dynDate(date_1);
%$ d2 = dynDate(date_2);
%$ d3 = dynDate(date_3);
%$ d4 = dynDate(date_4);
%$ d5 = dynDate(date_5);
%$ d6 = dynDate(date_6);
%$ m1 = max(d1,d2);
%$ i1 = (m1==d2);
%$ m2 = max(d3,d4);

View File

@ -2,24 +2,24 @@ function c = min(a,b)
%@info:
%! @deftypefn {Function File} {@var{c} =} min (@var{a},@var{b})
%! @anchor{@dynDates/gt}
%! @anchor{@dynDate/gt}
%! @sp 1
%! Overloads the min function for the Dynare dates class (@ref{dynDates}).
%! Overloads the min function for the Dynare dates class (@ref{dynDate}).
%! @sp 2
%! @strong{Inputs}
%! @sp 1
%! @table @ @var
%! @item a
%! Dynare date object instantiated by @ref{dynDates}.
%! Dynare date object instantiated by @ref{dynDate}.
%! @item b
%! Dynare date object instantiated by @ref{dynDates}.
%! Dynare date object instantiated by @ref{dynDate}.
%! @end table
%! @sp 1
%! @strong{Outputs}
%! @sp 1
%! @table @ @var
%! @item c
%! Dynare date object instantiated by @ref{dynDates}. @var{c} is a copy of @var{a} if @var{a}<=@var{b}, a copy of @var{b} otherwise.
%! Dynare date object instantiated by @ref{dynDate}. @var{c} is a copy of @var{a} if @var{a}<=@var{b}, a copy of @var{b} otherwise.
%! @end table
%! @sp 2
%! @strong{This function is called by:}
@ -50,15 +50,15 @@ function c = min(a,b)
verbose = 0;
if nargin~=2
error('dynDates::min: I need exactly two input arguments!')
error('dynDate::min: I need exactly two input arguments!')
end
if ~( isa(a,'dynDates') && isa(b,'dynDates'))
error(['dynDates::min: Input arguments ' inputname(1) 'and ' inputname(2) ' have to be a dynDates objects!'])
if ~( isa(a,'dynDate') && isa(b,'dynDate'))
error(['dynDate::min: Input arguments ' inputname(1) 'and ' inputname(2) ' have to be a dynDate objects!'])
end
if verbose && a.freq~=b.freq
error(['dynDates::min: Input arguments ' inputname(1) 'and ' inputname(2) ' have no common frequencies!'])
error(['dynDate::min: Input arguments ' inputname(1) 'and ' inputname(2) ' have no common frequencies!'])
end
if a<=b
@ -79,12 +79,12 @@ end
%$ date_6 = '1948M6';
%$
%$ % Call the tested routine.
%$ d1 = dynDates(date_1);
%$ d2 = dynDates(date_2);
%$ d3 = dynDates(date_3);
%$ d4 = dynDates(date_4);
%$ d5 = dynDates(date_5);
%$ d6 = dynDates(date_6);
%$ d1 = dynDate(date_1);
%$ d2 = dynDate(date_2);
%$ d3 = dynDate(date_3);
%$ d4 = dynDate(date_4);
%$ d5 = dynDate(date_5);
%$ d6 = dynDate(date_6);
%$ m1 = min(d1,d2);
%$ i1 = (m1==d1);
%$ m2 = min(d3,d4);

View File

@ -2,18 +2,18 @@ function c = minus(a,b)
%@info:
%! @deftypefn {Function File} {@var{c} =} minus (@var{a},@var{b})
%! @anchor{@dynDates/minus}
%! @anchor{@dynDate/minus}
%! @sp 1
%! Overloads the minus (soustraction) operator for the Dynare dates class (@ref{dynDates}). Depending on the frequency, computes the number
%! Overloads the minus (soustraction) operator for the Dynare dates class (@ref{dynDate}). Depending on the frequency, computes the number
%! of years, quarters, months, weeks between two dates @var{a} and @var{b} (it is assumed that @var{a}>@var{B}).
%! @sp 2
%! @strong{Inputs}
%! @sp 1
%! @table @ @var
%! @item a
%! Dynare date object instantiated by @ref{dynDates}.
%! Dynare date object instantiated by @ref{dynDate}.
%! @item b
%! Dynare date object instantiated by @ref{dynDates}.
%! Dynare date object instantiated by @ref{dynDate}.
%! @end table
%! @sp 1
%! @strong{Outputs}
@ -26,7 +26,7 @@ function c = minus(a,b)
%! @strong{This function is called by:}
%! @sp 2
%! @strong{This function calls:}
%! @ref{@@dynDates/eq},@ref{@@dynDates/lt}
%! @ref{@@dynDate/eq},@ref{@@dynDate/lt}
%!
%! @end deftypefn
%@eod:
@ -49,16 +49,16 @@ function c = minus(a,b)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if ~( isa(a,'dynDates') && isa(b,'dynDates') )
error(['dynDates::minus: Input arguments ' inputname(1) ' and ' inputname(2) ' must be dynDates objects!'])
if ~( isa(a,'dynDate') && isa(b,'dynDate') )
error(['dynDate::minus: Input arguments ' inputname(1) ' and ' inputname(2) ' must be dynDate objects!'])
end
if a.freq~=b.freq
error(['dynDates::minus: ' inputname(1) ' and ' inputname(2) ' must have common frequency!'])
error(['dynDate::minus: ' inputname(1) ' and ' inputname(2) ' must have common frequency!'])
end
if a<b
error(['dynDates::minus: ' inputname(1) ' must be posterior to ' inputname(2) '!'])
error(['dynDate::minus: ' inputname(1) ' must be posterior to ' inputname(2) '!'])
end
if a==b
@ -72,7 +72,7 @@ switch a.freq
case {4,12,52}
c = a.time(2)-b.time(2) + (a.time(1)-b.time(1))*a.freq;
otherwise
error('dynDates::minus: Unknown frequency!')
error('dynDate::minus: Unknown frequency!')
end
%@test:1
@ -89,14 +89,14 @@ end
%$ date_2_2 = '1998M8';
%$
%$ % Call the tested routine.
%$ d_0_1 = dynDates(date_0_1);
%$ d_0_2 = dynDates(date_0_2);
%$ d_0_3 = dynDates(date_0_3);
%$ d_1_1 = dynDates(date_1_1);
%$ d_1_2 = dynDates(date_1_2);
%$ d_1_3 = dynDates(date_1_3);
%$ d_2_1 = dynDates(date_2_1);
%$ d_2_2 = dynDates(date_2_2);
%$ d_0_1 = dynDate(date_0_1);
%$ d_0_2 = dynDate(date_0_2);
%$ d_0_3 = dynDate(date_0_3);
%$ d_1_1 = dynDate(date_1_1);
%$ d_1_2 = dynDate(date_1_2);
%$ d_1_3 = dynDate(date_1_3);
%$ d_2_1 = dynDate(date_2_1);
%$ d_2_2 = dynDate(date_2_2);
%$ e1 = d_0_1-d_0_2;
%$ e2 = d_0_1-d_0_3;
%$ e3 = d_1_1-d_1_2;

View File

@ -2,17 +2,17 @@ function c = ne(a,b)
%@info:
%! @deftypefn {Function File} {@var{c} =} ne (@var{a},@var{b})
%! @anchor{@dynDates/ne}
%! @anchor{@dynDate/ne}
%! @sp 1
%! Overloads the ne (not equal) operator for the Dynare dates class (@ref{dynDates}).
%! Overloads the ne (not equal) operator for the Dynare dates class (@ref{dynDate}).
%! @sp 2
%! @strong{Inputs}
%! @sp 1
%! @table @ @var
%! @item a
%! Dynare date object instantiated by @ref{dynDates}.
%! Dynare date object instantiated by @ref{dynDate}.
%! @item b
%! Dynare date object instantiated by @ref{dynDates}.
%! Dynare date object instantiated by @ref{dynDate}.
%! @end table
%! @sp 1
%! @strong{Outputs}
@ -50,15 +50,15 @@ function c = ne(a,b)
verbose = 0;
if nargin~=2
error('dynDates::ne: I need exactly two input arguments!')
error('dynDate::ne: I need exactly two input arguments!')
end
if ~( isa(a,'dynDates') && isa(b,'dynDates'))
error(['dynDates::ne: Input arguments ' inputname(1) 'and ' inputname(2) ' have to be a dynDates objects!'])
if ~( isa(a,'dynDate') && isa(b,'dynDate'))
error(['dynDate::ne: Input arguments ' inputname(1) 'and ' inputname(2) ' have to be a dynDate objects!'])
end
if verbose && a.freq~=b.freq
disp(['dynDates::ne: Input arguments ' inputname(1) 'and ' inputname(2) ' have no common frequencies!'])
disp(['dynDate::ne: Input arguments ' inputname(1) 'and ' inputname(2) ' have no common frequencies!'])
c = 1;
end
@ -75,11 +75,11 @@ c = ~isequal(a.time,b.time);
%$ date_5 = '1950W32';
%$
%$ % Call the tested routine.
%$ d1 = dynDates(date_1);
%$ d2 = dynDates(date_2);
%$ d3 = dynDates(date_3);
%$ d4 = dynDates(date_4);
%$ d5 = dynDates(date_5);
%$ d1 = dynDate(date_1);
%$ d2 = dynDate(date_2);
%$ d3 = dynDate(date_3);
%$ d4 = dynDate(date_4);
%$ d5 = dynDate(date_5);
%$ i1 = (d1~=d2);
%$ i2 = (d2~=d2);
%$ i3 = (d4~=d5);

View File

@ -2,16 +2,16 @@ function c = plus(a,b)
%@info:
%! @deftypefn {Function File} {@var{c} =} plus (@var{a},@var{b})
%! @anchor{@dynDates/plus}
%! @anchor{@dynDate/plus}
%! @sp 1
%! Overloads the plus (addition) operator for the Dynare dates class (@ref{dynDates}). Given an initial date @var{a},
%! Overloads the plus (addition) operator for the Dynare dates class (@ref{dynDate}). Given an initial date @var{a},
%! computes a new date @var{c} by adding the number of periods @var{b}.
%! @sp 2
%! @strong{Inputs}
%! @sp 1
%! @table @ @var
%! @item a
%! Dynare date object instantiated by @ref{dynDates}.
%! Dynare date object instantiated by @ref{dynDate}.
%! @item b
%! Positive scalar integer, the number of periods
%! @end table
@ -20,13 +20,13 @@ function c = plus(a,b)
%! @sp 1
%! @table @ @var
%! @item c
%! Dynare date object instantiated by @ref{dynDates}.
%! Dynare date object instantiated by @ref{dynDate}.
%! @end table
%! @sp 2
%! @strong{This function is called by:}
%! @sp 2
%! @strong{This function calls:}
%! @ref{@@dynDates/eq}
%! @ref{@@dynDate/eq}
%!
%! @end deftypefn
%@eod:
@ -50,12 +50,12 @@ function c = plus(a,b)
% AUTHORS(S) stephane DOT adjemian AT univ DASH lemans DOT fr
if ~isa(a,'dynDates')
error(['dynDates::plus: Input argument ' inputname(1) ' must be a dynDates object!'])
if ~isa(a,'dynDate')
error(['dynDate::plus: Input argument ' inputname(1) ' must be a dynDate object!'])
end
if b<0 || ~isint(b)
error(['dynDates::plus: Input argument ' inputname(2) ' must be a positive integer'])
error(['dynDate::plus: Input argument ' inputname(2) ' must be a positive integer'])
end
@ -76,7 +76,7 @@ switch a.freq
c.time(2) = c.time(2)+n3-1;
c.time(1) = c.time(1)+n2;
otherwise
error('dynDates::plus: Unknown frequency!')
error('dynDate::plus: Unknown frequency!')
end
%@test:1
@ -88,9 +88,9 @@ end
%$ date_3 = '2000M3';
%$
%$ % Call the tested routine.
%$ d_1 = dynDates(date_1);
%$ d_2 = dynDates(date_2);
%$ d_3 = dynDates(date_3);
%$ d_1 = dynDate(date_1);
%$ d_2 = dynDate(date_2);
%$ d_3 = dynDate(date_3);
%$
%$ d1 = d_1+3;
%$ d2 = d_2+5;
@ -98,10 +98,10 @@ end
%$ d4 = d_3+10;
%$
%$ % Expected results.
%$ e1 = dynDates(1952);
%$ e2 = dynDates('1951Q4');
%$ e3 = dynDates('2001M5');
%$ e4 = dynDates('2000M12');
%$ e1 = dynDate(1952);
%$ e2 = dynDate('1951Q4');
%$ e3 = dynDate('2001M5');
%$ e4 = dynDate('2000M12');
%$
%$ % Check the results.
%$ t(1) = dyn_assert(e1.time,d1.time);

View File

@ -2,15 +2,15 @@ function B = subsref(A,S)
%@info:
%! @deftypefn {Function File} {@var{us} =} subsref (@var{ts},S)
%! @anchor{@dynDates/subsref}
%! @anchor{@dynDate/subsref}
%! @sp 1
%! Overloads the subsref method for the Dynare dates class (@ref{dynDates}).
%! Overloads the subsref method for the Dynare dates class (@ref{dynDate}).
%! @sp 2
%! @strong{Inputs}
%! @sp 1
%! @table @ @var
%! @item A
%! Dynare date object instantiated by @ref{dynDates}.
%! Dynare date object instantiated by @ref{dynDate}.
%! @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
@ -21,7 +21,7 @@ function B = subsref(A,S)
%! @sp 1
%! @table @ @var
%! @item B
%! A matlab object (public member of the @ref{dynDates} object).
%! A matlab object (public member of the @ref{dynDate} object).
%! @end table
%! @sp 2
%! @strong{This function is called by:}

View File

@ -2,29 +2,29 @@ function b = uminus(a)
%@info:
%! @deftypefn {Function File} {@var{b} =} uminus (@var{a})
%! @anchor{@dynDates/uplus}
%! @anchor{@dynDate/uplus}
%! @sp 1
%! Overloads the uminus (unary soustraction) operator for the Dynare dates class (@ref{dynDates}). Decrement the date by one year, quarter,
%! Overloads the uminus (unary soustraction) operator for the Dynare dates class (@ref{dynDate}). Decrement the date by one year, quarter,
%! month or week depending on the frequency.
%! @sp 2
%! @strong{Inputs}
%! @sp 1
%! @table @ @var
%! @item a
%! Dynare date object instantiated by @ref{dynDates}.
%! Dynare date object instantiated by @ref{dynDate}.
%! @end table
%! @sp 1
%! @strong{Outputs}
%! @sp 1
%! @table @ @var
%! @item b
%! Dynare date object instantiated by @ref{dynDates}.
%! Dynare date object instantiated by @ref{dynDate}.
%! @end table
%! @sp 2
%! @strong{This function is called by:}
%! @sp 2
%! @strong{This function calls:}
%! @ref{dynDates}
%! @ref{dynDate}
%!
%! @end deftypefn
%@eod:
@ -47,11 +47,11 @@ function b = uminus(a)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if ~isa(a,'dynDates')
error(['dynDates::uminus: Input argument ' inputname(1) ' must be a dynDates object.'])
if ~isa(a,'dynDate')
error(['dynDate::uminus: Input argument ' inputname(1) ' must be a dynDate object.'])
end
b = dynDates(a);
b = dynDate(a);
switch b.freq
case 1
@ -78,7 +78,7 @@ switch b.freq
b.time(2) = b.time(2)-1;
end
otherwise
error('dynDates::minus: Unknown frequency!')
error('dynDate::minus: Unknown frequency!')
end
%@test:1
@ -94,13 +94,13 @@ end
%$ date_7 = 2000;
%$
%$ % Call the tested routine.
%$ d1 = dynDates(date_1);
%$ d2 = dynDates(date_2);
%$ d3 = dynDates(date_3);
%$ d4 = dynDates(date_4);
%$ d5 = dynDates(date_5);
%$ d6 = dynDates(date_6);
%$ d7 = dynDates(date_7);
%$ d1 = dynDate(date_1);
%$ d2 = dynDate(date_2);
%$ d3 = dynDate(date_3);
%$ d4 = dynDate(date_4);
%$ d5 = dynDate(date_5);
%$ d6 = dynDate(date_6);
%$ d7 = dynDate(date_7);
%$ e1 = -d1;
%$ e2 = -d2;
%$ e3 = -d3;

View File

@ -2,29 +2,29 @@ function b = uplus(a)
%@info:
%! @deftypefn {Function File} {@var{b} =} uplus (@var{a})
%! @anchor{@dynDates/uplus}
%! @anchor{@dynDate/uplus}
%! @sp 1
%! Overloads the uplus (unary addition) operator for the Dynare dates class (@ref{dynDates}). Increment the date by one year, quarter,
%! Overloads the uplus (unary addition) operator for the Dynare dates class (@ref{dynDate}). Increment the date by one year, quarter,
%! month or week depending on the frequency.
%! @sp 2
%! @strong{Inputs}
%! @sp 1
%! @table @ @var
%! @item a
%! Dynare date object instantiated by @ref{dynDates}.
%! Dynare date object instantiated by @ref{dynDate}.
%! @end table
%! @sp 1
%! @strong{Outputs}
%! @sp 1
%! @table @ @var
%! @item b
%! Dynare date object instantiated by @ref{dynDates}.
%! Dynare date object instantiated by @ref{dynDate}.
%! @end table
%! @sp 2
%! @strong{This function is called by:}
%! @sp 2
%! @strong{This function calls:}
%! @ref{dynDates}
%! @ref{dynDate}
%!
%! @end deftypefn
%@eod:
@ -47,11 +47,11 @@ function b = uplus(a)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if ~isa(a,'dynDates')
error(['dynDates::uplus: Input argument ' inputname(1) ' must be a dynDates object.'])
if ~isa(a,'dynDate')
error(['dynDate::uplus: Input argument ' inputname(1) ' must be a dynDate object.'])
end
b = dynDates(a);
b = dynDate(a);
switch b.freq
case 1
@ -78,7 +78,7 @@ switch b.freq
b.time(2) = b.time(2)+1;
end
otherwise
error('dynDates::uplus: Unknown frequency!')
error('dynDate::uplus: Unknown frequency!')
end
%@test:1
@ -94,13 +94,13 @@ end
%$ date_7 = 2000;
%$
%$ % Call the tested routine.
%$ d1 = dynDates(date_1);
%$ d2 = dynDates(date_2);
%$ d3 = dynDates(date_3);
%$ d4 = dynDates(date_4);
%$ d5 = dynDates(date_5);
%$ d6 = dynDates(date_6);
%$ d7 = dynDates(date_7);
%$ d1 = dynDate(date_1);
%$ d2 = dynDate(date_2);
%$ d3 = dynDate(date_3);
%$ d4 = dynDate(date_4);
%$ d5 = dynDate(date_5);
%$ d6 = dynDate(date_6);
%$ d7 = dynDate(date_7);
%$ e1 = +d1;
%$ e2 = +d2;
%$ e3 = +d3;

View File

@ -131,7 +131,7 @@ switch nargin
ts.freq = 1;
end
ts.Time = ts.Time.setFreq(ts.freq);
ts.Time = ts.Time.setTime(dynDates(b):dynDates(b)+ts.nobs);
ts.Time = ts.Time.setTime(dynDate(b):dynDate(b)+ts.nobs);
else% If b is empty.
ts.freq = 1;
ts.Time = ts.Time.setFreq(1);