1function b = ne(o, p) % --*-- Unitary tests --*--
2
3% Overloads ne (~=) operator.
4%
5% INPUTS
6%  o A      dseries object (T periods, N variables).
7%  o B      dseries object (T periods, N variables).
8%
9% OUTPUTS
10%  o C      T*N matrix of zeros and ones. Element C(t,n) is nonzero iff observation t of variable n in A and B are different.
11%
12% REMARKS
13%  If the number of variables, the number of observations or the frequencies are different in A and B, the function returns one.
14
15% Copyright (C) 2013-2017 Dynare Team
16%
17% This file is part of Dynare.
18%
19% Dynare is free software: you can redistribute it and/or modify
20% it under the terms of the GNU General Public License as published by
21% the Free Software Foundation, either version 3 of the License, or
22% (at your option) any later version.
23%
24% Dynare is distributed in the hope that it will be useful,
25% but WITHOUT ANY WARRANTY; without even the implied warranty of
26% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27% GNU General Public License for more details.
28%
29% You should have received a copy of the GNU General Public License
30% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
31
32if nargin~=2
33    error('dseries::ne: I need exactly two input arguments!')
34end
35
36if ~(isdseries(o) && isdseries(p))
37    error('dseries::ne: Both input arguments must be dseries objects!')
38end
39
40if ~isequal(nobs(o), nobs(p))
41    warning('dseries::ne: Both input arguments should have the same number of observations!')
42    b = 1;
43    return
44end
45
46if ~isequal(vobs(o), vobs(p))
47    warning('dseries::ne: Both input arguments should have the same number of observations!')
48    b = 1;
49    return
50end
51
52if ~isequal(frequency(o), frequency(p))
53    warning('dseries::ne: Both input arguments should have the same frequencies!')
54    b = 1;
55    return
56end
57
58if ~isequal(firstdate(o), firstdate(p))
59    warning('dseries::ne: Both input arguments should have the same initial period!')
60    b = 1;
61    return
62end
63
64if ~isequal(o.name, p.name)
65    warning('dseries::ne: Both input arguments do not have the same variables!')
66end
67
68if ~isequal(o.tex, p.tex)
69    warning('dseries::ne: Both input arguments do not have the same tex names!')
70end
71
72if ~isequal(o.tags, p.tags)
73    warning('dseries::ne: Both input arguments do not have the same tags!')
74end
75
76b = ne(o.data, p.data);
77
78%@test:1
79%$ % Define a datasets.
80%$ A = rand(10,3);
81%$ B = A;
82%$ B(:,3) = rand(10,1);
83%$
84%$ % Define names
85%$ A_name = {'A1';'A2';'A3'}; B_name = A_name;
86%$
87%$ t = zeros(2,1);
88%$
89%$ % Instantiate a time series object.
90%$ try
91%$    ts1 = dseries(A,[],A_name,[]);
92%$    ts2 = dseries(B,[],B_name,[]);
93%$    ts2 = ts1;
94%$    a = eq(ts1,ts2);
95%$    t(1) = 1;
96%$ catch
97%$    t = 0;
98%$ end
99%$
100%$ if t(1)
101%$    t(2) = dassert(a,logical([ones(10,2), ones(10,1)]));
102%$ end
103%$ T = all(t);
104%@eof:1