


@info:
! @deftypefn {Function File} {@var{c} =} eq (@var{a},@var{b})
! @anchor{@dynDate/eq}
! @sp 1
! 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{dynDate}.
! @item b
! Dynare date object instantiated by @ref{dynDate}.
! @end table
! @sp 1
! @strong{Outputs}
! @sp 1
! @table @ @var
! @item c
! scalar integer equal to one if a==b, 0 otherwise.
! @end table
! @sp 2
! @strong{This function is called by:}
! @sp 2
! @strong{This function calls:}
!
! @end deftypefn
@eod:

0001 function c = eq(a,b) 0002 0003 %@info: 0004 %! @deftypefn {Function File} {@var{c} =} eq (@var{a},@var{b}) 0005 %! @anchor{@dynDate/eq} 0006 %! @sp 1 0007 %! Overloads the eq (equal) operator for the Dynare dates class (@ref{dynDate}). 0008 %! @sp 2 0009 %! @strong{Inputs} 0010 %! @sp 1 0011 %! @table @ @var 0012 %! @item a 0013 %! Dynare date object instantiated by @ref{dynDate}. 0014 %! @item b 0015 %! Dynare date object instantiated by @ref{dynDate}. 0016 %! @end table 0017 %! @sp 1 0018 %! @strong{Outputs} 0019 %! @sp 1 0020 %! @table @ @var 0021 %! @item c 0022 %! scalar integer equal to one if a==b, 0 otherwise. 0023 %! @end table 0024 %! @sp 2 0025 %! @strong{This function is called by:} 0026 %! @sp 2 0027 %! @strong{This function calls:} 0028 %! 0029 %! @end deftypefn 0030 %@eod: 0031 0032 % Copyright (C) 2011 Dynare Team 0033 % stephane DOT adjemian AT univ DASH lemans DOT fr 0034 % 0035 % This file is part of Dynare. 0036 % 0037 % Dynare is free software: you can redistribute it and/or modify 0038 % it under the terms of the GNU General Public License as published by 0039 % the Free Software Foundation, either version 3 of the License, or 0040 % (at your option) any later version. 0041 % 0042 % Dynare is distributed in the hope that it will be useful, 0043 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0044 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0045 % GNU General Public License for more details. 0046 % 0047 % You should have received a copy of the GNU General Public License 0048 % along with Dynare. If not, see <http://www.gnu.org/licenses/>. 0049 0050 verbose = 0; 0051 0052 if nargin~=2 0053 error('dynDate::eq: I need exactly two input arguments!') 0054 end 0055 0056 if ~( isa(a,'dynDate') && isa(b,'dynDate')) 0057 error(['dynDate::eq: Input arguments ' inputname(1) 'and ' inputname(2) ' have to be a dynDate objects!']) 0058 end 0059 0060 if verbose && a.freq~=b.freq 0061 disp(['dynDate::eq: Input arguments ' inputname(1) 'and ' inputname(2) ' have no common frequencies!']) 0062 c = 0; 0063 end 0064 0065 c = isequal(a.time,b.time); 0066 0067 %@test:1 0068 %$ addpath ../matlab 0069 %$ 0070 %$ % Define some dates 0071 %$ date_1 = 1950; 0072 %$ date_2 = '1950Q2'; 0073 %$ date_3 = '1950M10'; 0074 %$ date_4 = '1950W50'; 0075 %$ date_5 = '1950W32'; 0076 %$ 0077 %$ % Call the tested routine. 0078 %$ d1 = dynDate(date_1); 0079 %$ d2 = dynDate(date_2); 0080 %$ d3 = dynDate(date_3); 0081 %$ d4 = dynDate(date_4); 0082 %$ d5 = dynDate(date_5); 0083 %$ i1 = (d1==d2); 0084 %$ i2 = (d2==d2); 0085 %$ i3 = (d4==d5); 0086 %$ 0087 %$ % Check the results. 0088 %$ t(1) = dyn_assert(i1,0); 0089 %$ t(2) = dyn_assert(i2,1); 0090 %$ t(3) = dyn_assert(i3,0); 0091 %$ T = all(t); 0092 %@eof:1 0093