Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • dynare-4.6
  • dynare-5.x
  • dynare-6.x
  • master
  • master-dist
  • master-with-fame-io
  • old-oop-style
  • path_setting
8 results

Target

Select target project
  • Dynare/dseries
  • sebastien/dseries
  • houtanb/dseries
  • DoraK/dseries
  • wmutschl/dseries
  • JohannesPfeifer/dseries
6 results
Select Git revision
  • dynare-4.6
  • dynare-4.7
  • fractional_ticks
  • master
  • master-dist
  • master-with-fame-io
  • old-oop-style
  • path_setting
  • xls_range
9 results
Show changes
Showing
with 73 additions and 73 deletions
function o = sort_(o) % --*-- Unitary tests --*--
function o = sort_(o)
% Sort method for dates class (in place modification).
%
......@@ -8,7 +8,7 @@ function o = sort_(o) % --*-- Unitary tests --*--
% OUTPUTS
% - o [dates] with dates sorted by increasing order.
% Copyright © 2015-2021 Dynare Team
% Copyright © 2015-2023 Dynare Team
%
% This code is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
......@@ -29,7 +29,7 @@ end
o.time = sort(o.time);
return
return % --*-- Unit tests --*--
%@test:1
% Define some dates
......@@ -101,4 +101,4 @@ if t(1)
t(2) = isequal(d,dates('1999-01-02', '2000-01-01', '2001-01-01'));
end
T = all(t);
%@eof:3
\ No newline at end of file
%@eof:3
function m = strings(o) % --*-- Unitary tests --*--
function m = strings(o)
% Returns a cell array of strings containing the dates
%
......@@ -8,7 +8,7 @@ function m = strings(o) % --*-- Unitary tests --*--
% OUTPUTS
% - m [cell of char] object with n elements.
% Copyright © 2013-2021 Dynare Team
% Copyright © 2013-2022 Dynare Team
%
% This code is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
......@@ -29,7 +29,7 @@ for i = 1:o.length()
m(i) = { date2string(o.time(i), o.freq) };
end
return
return % --*-- Unit tests --*--
%@test:1
% Define a dates objects
......
function val = subsasgn(val, idx, rhs) % --*-- Unitary tests --*--
function val = subsasgn(val, idx, rhs)
% Copyright © 2013-2021 Dynare Team
% Copyright © 2013-2023 Dynare Team
%
% This code is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
......@@ -17,7 +17,7 @@ function val = subsasgn(val, idx, rhs) % --*-- Unitary tests --*--
error('dates::subsasgn: Members of dates class are private')
return
return % --*-- Unit tests --*--
%@test:1
% Define a dates objects
......@@ -32,4 +32,4 @@ catch
end
T = all(t);
%@eof:1
\ No newline at end of file
%@eof:1
function B = subsref(A,S) % --*-- Unitary tests --*--
function B = subsref(A,S)
% Overloads the subsref method for dates objects.
%
......@@ -13,7 +13,7 @@ function B = subsref(A,S) % --*-- Unitary tests --*--
% 1. The type of the returned argument depends on the content of S.
% 2. See the matlab's documentation about the subsref method.
% Copyright © 2011-2021 Dynare Team
% Copyright © 2011-2023 Dynare Team
%
% This code is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
......@@ -256,7 +256,7 @@ if ~isempty(S)
B = subsref(B, S);
end
return
return % --*-- Unit tests --*--
%@test:1
% Define a dates object
......@@ -465,4 +465,4 @@ if t(1)
t(4) = isequal(d.ndat(),1);
end
T = all(t);
%@eof:9
\ No newline at end of file
%@eof:9
function o = uminus(o) % --*-- Unitary tests --*--
function o = uminus(o)
% Overloads the unary minus operator for dates objects. Shifts all the elements by one period.
%
......@@ -8,7 +8,7 @@ function o = uminus(o) % --*-- Unitary tests --*--
% OUTPUTS
% - o [dates]
% Copyright © 2013-2021 Dynare Team
% Copyright © 2013-2022 Dynare Team
%
% This code is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
......@@ -25,7 +25,7 @@ function o = uminus(o) % --*-- Unitary tests --*--
o.time(:) = o.time(:)-1;
return
return % --*-- Unit tests --*--
%@test:1
% Define some dates
......@@ -89,4 +89,4 @@ if t(1)
end
T = all(t);
%@eof:3
\ No newline at end of file
%@eof:3
function o = union(varargin) % --*-- Unitary tests --*--
function o = union(varargin)
% Overloads union function for dates objects (removes repetitions if any).
%
......@@ -11,7 +11,7 @@ function o = union(varargin) % --*-- Unitary tests --*--
% REMARKS
% 1. Elements in o are sorted by increasing order.
% Copyright © 2013-2021 Dynare Team
% Copyright © 2013-2023 Dynare Team
%
% This code is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
......@@ -32,12 +32,12 @@ end
if isequal(nargin, 1)
o = sort(unique(varargin{1}));
return;
return
end
o = sort(unique(horzcat(varargin{:})));
return
return % --*-- Unit tests --*--
%@test:1
% Define some dates objects
......@@ -75,4 +75,4 @@ e2 = union(d1,d2);
t(1) = isequal(e1, d1);
t(2) = isequal(e2, d3);
T = all(t);
%@eof:1
\ No newline at end of file
%@eof:1
function o = unique(o) % --*-- Unitary tests --*--
function o = unique(o)
% Overloads the unique function for dates objects.
%
......@@ -11,7 +11,7 @@ function o = unique(o) % --*-- Unitary tests --*--
% REMARKS
% 1. Only the last occurence of a date is kept.
% Copyright © 2013-2021 Dynare Team
% Copyright © 2013-2022 Dynare Team
%
% This code is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
......@@ -33,7 +33,7 @@ end
o = copy(o);
o.unique_();
return
return % --*-- Unit tests --*--
%@test:1
% Define some dates
......@@ -141,4 +141,4 @@ if t(1)
t(2) = isequal(d2, dates('2000-01-02', '2000-01-01'));
end
T = all(t);
%@eof:4
\ No newline at end of file
%@eof:4
function o = unique_(o) % --*-- Unitary tests --*--
function o = unique_(o)
% Overloads the unique function for dates objects (in place modification).
%
......@@ -11,7 +11,7 @@ function o = unique_(o) % --*-- Unitary tests --*--
% REMARKS
% 1. Only the last occurence of a date is kept.
% Copyright © 2013-2021 Dynare Team
% Copyright © 2013-2022 Dynare Team
%
% This code is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
......@@ -34,7 +34,7 @@ end
o.time = o.time(sort(id));
return
return % --*-- Unit tests --*--
%@test:1
% Define some dates
......
function o = uplus(o) % --*-- Unitary tests --*--
function o = uplus(o)
% Overloads the unary plus operator for dates objects. Shifts all the elements by one period.
%
......@@ -8,7 +8,7 @@ function o = uplus(o) % --*-- Unitary tests --*--
% OUTPUTS
% - o [dates]
% Copyright © 2013-2021 Dynare Team
% Copyright © 2013-2023 Dynare Team
%
% This code is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
......@@ -25,7 +25,7 @@ function o = uplus(o) % --*-- Unitary tests --*--
o.time = o.time+1;
return
return % --*-- Unit tests --*--
%@test:1
% Define some dates
......@@ -90,4 +90,4 @@ if t(1)
end
T = all(t);
%@eof:3
\ No newline at end of file
%@eof:3
function o = vertcat(varargin) % --*-- Unitary tests --*--
function o = vertcat(varargin)
% Overloads the vertcat method for dates objects.
%
......@@ -15,7 +15,7 @@ function o = vertcat(varargin) % --*-- Unitary tests --*--
%
% Defines a dates object D containing the dates appearing in A, B and C.
% Copyright © 2013-2021 Dynare Team
% Copyright © 2013-2022 Dynare Team
%
% This code is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
......@@ -36,7 +36,7 @@ end
o = horzcat(varargin{:});
return
return % --*-- Unit tests --*--
%@test:1
% Define some dates
......
function y = year(d) % --*-- Unitary tests --*--
function y = year(d)
% Returns the year.
% Copyright © 2016-2021 Dynare Team
% Copyright © 2016-2022 Dynare Team
%
% This code is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
......@@ -29,7 +29,7 @@ else
y = d.time;
end
return
return % --*-- Unit tests --*--
%@test:1
try
......
function o = abs(o) % --*-- Unitary tests --*--
function o = abs(o)
% Apply the absolute value to all the variables in a dseries object (without in place modification).
%
......@@ -8,7 +8,7 @@ function o = abs(o) % --*-- Unitary tests --*--
% OUTPUTS
% - o [dseries]
% Copyright © 2011-2021 Dynare Team
% Copyright © 2011-2023 Dynare Team
%
% This file is part of Dynare.
%
......@@ -28,7 +28,7 @@ function o = abs(o) % --*-- Unitary tests --*--
o = copy(o);
o.abs_;
return
return % --*-- Unit tests --*--
%@test:1
% Define a dates object
......
function o = abs_(o) % --*-- Unitary tests --*--
function o = abs_(o)
% Apply the absolute value to all the variables in a dseries object (in place modification).
%
......@@ -8,7 +8,7 @@ function o = abs_(o) % --*-- Unitary tests --*--
% OUTPUTS
% - o [dseries]
% Copyright © 2017-2021 Dynare Team
% Copyright © 2017-2023 Dynare Team
%
% This file is part of Dynare.
%
......@@ -35,7 +35,7 @@ end
o.data = abs(o.data);
return
return % --*-- Unit tests --*--
%@test:1
% Define a dates object
......@@ -99,4 +99,4 @@ if t(1)
end
T = all(t);
%@eof:2
\ No newline at end of file
%@eof:2
function [o, p] = align(o, p) % --*-- Unitary tests --*--
function [o, p] = align(o, p)
% If necessay completes dseries object o and p so that they are defined on the same time range
% (in place modification).
......@@ -11,7 +11,7 @@ function [o, p] = align(o, p) % --*-- Unitary tests --*--
% - o [dseries]
% - p [dseries]
% Copyright © 2013-2021 Dynare Team
% Copyright © 2013-2023 Dynare Team
%
% This file is part of Dynare.
%
......@@ -32,7 +32,7 @@ o = copy(o);
p = copy(p);
align_(o, p);
return
return % --*-- Unit tests --*--
%@test:1
% Define a datasets.
......@@ -128,4 +128,4 @@ if t(1)
t(5) = dassert(ts2.data,[B; NaN(1,2)], 1e-15);
end
T = all(t);
%@eof:3
\ No newline at end of file
%@eof:3
function [o, p] = align_(o, p) % --*-- Unitary tests --*--
function [o, p] = align_(o, p)
% If necessay completes dseries object o and p so that they are defined on the same time range
% (in place modification).
......@@ -11,7 +11,7 @@ function [o, p] = align_(o, p) % --*-- Unitary tests --*--
% - o [dseries]
% - p [dseries]
% Copyright © 2013-2021 Dynare Team
% Copyright © 2013-2023 Dynare Team
%
% This file is part of Dynare.
%
......@@ -62,7 +62,7 @@ end
o.dates = init:init+(nobs(o)-1);
p.dates = init:init+(nobs(p)-1);
return
return % --*-- Unit tests --*--
%@test:1
% Define a datasets.
......@@ -161,4 +161,4 @@ if t(1)
t(6) = dassert(ts1.dates, ts2.dates);
end
T = all(t);
%@eof:3
\ No newline at end of file
%@eof:3
function q = backcast(o, p, diff) % --*-- Unitary tests --*--
function q = backcast(o, p, diff)
% Chains two dseries objects.
%
......@@ -13,7 +13,7 @@ function q = backcast(o, p, diff) % --*-- Unitary tests --*--
% The two dseries objects must have common frequency and the same number of variables. Also the
% two samples must overlap.
% Copyright © 2019-2020 Dynare Team
% Copyright © 2019-2023 Dynare Team
%
% This file is part of Dynare.
%
......@@ -38,7 +38,7 @@ else
q.backcast_(p);
end
return
return % --*-- Unit tests --*--
%@test:1
y = ones(10,1);
......@@ -66,4 +66,4 @@ return
end
T = all(t);
%@eof:1
\ No newline at end of file
%@eof:1
function o = backcast_(o, p, diff) % --*-- Unitary tests --*--
function o = backcast_(o, p, diff)
% Copyright © 2019-2020 Dynare Team
% Copyright © 2019-2023 Dynare Team
%
% This file is part of Dynare.
%
......@@ -65,7 +65,7 @@ for i=1:o.vobs
end
end
return
return % --*-- Unit tests --*--
%@test:1
y = ones(10,1);
......@@ -121,4 +121,4 @@ return
end
T = all(t);
%@eof:2
\ No newline at end of file
%@eof:2
function o = baxter_king_filter(o, high_frequency, low_frequency, K) % --*-- Unitary tests --*--
function o = baxter_king_filter(o, high_frequency, low_frequency, K)
% Implementation of Baxter and King (1999) band pass filter for dseries objects. The code is adapted from
% the one provided by Baxter and King. This filter isolates business cycle fluctuations with a period of length
......@@ -17,7 +17,7 @@ function o = baxter_king_filter(o, high_frequency, low_frequency, K) % --*-- Uni
% This filter use a (symmetric) moving average smoother, so that K observations at the beginning and at the end of the
% sample are lost in the computation of the filter.
% Copyright © 2013-2021 Dynare Team
% Copyright © 2013-2023 Dynare Team
%
% This file is part of Dynare.
%
......@@ -59,7 +59,7 @@ end
o = copy(o);
o.baxter_king_filter_(high_frequency, low_frequency, K);
return
return % --*-- Unit tests --*--
%@test:1
plot_flag = false;
......
function o = baxter_king_filter_(o, high_frequency, low_frequency, K) % --*-- Unitary tests --*--
function o = baxter_king_filter_(o, high_frequency, low_frequency, K)
% Implementation of Baxter and King (1999) band pass filter for dseries objects. The code is adapted from
% the one provided by Baxter and King. This filter isolates business cycle fluctuations with a period of length
......@@ -17,7 +17,7 @@ function o = baxter_king_filter_(o, high_frequency, low_frequency, K) % --*-- Un
% This filter use a (symmetric) moving average smoother, so that K observations at the beginning and at the end of the
% sample are lost in the computation of the filter.
% Copyright © 2013-2021 Dynare Team
% Copyright © 2013-2023 Dynare Team
%
% This file is part of Dynare.
%
......@@ -109,7 +109,7 @@ for i=1:vobs(o)
end
end
return
return % --*-- Unit tests --*--
%@test:1
plot_flag = false;
......
function o = center(o, geometric) % --*-- Unitary tests --*--
function o = center(o, geometric)
% Centers dseries object o around its mean (arithmetic or geometric).
%
......@@ -9,7 +9,7 @@ function o = center(o, geometric) % --*-- Unitary tests --*--
% OUTPUTS
% - o dseries object.
% Copyright © 2016-2021 Dynare Team
% Copyright © 2016-2023 Dynare Team
%
% This file is part of Dynare.
%
......@@ -33,7 +33,7 @@ end
o = copy(o);
o.center_(geometric);
return
return % --*-- Unit tests --*--
%@test:1
% Define a dataset.
......