1function b = isauxiliary(var, type)
2
3% Returns true if var is an auxiliary variable.
4%
5% INPUTS
6% - var       [string]    Name of the variable.
7% - type      [integer]   Type of auxiliary variable.
8%
9% OUTPUTS
10% - b         [logical]
11%
12% REMARKS
13%
14% Types for auxiliary variables are as follows:
15%
16%   -  0,    Lead on endogenous variable (substitute for endo leads >= 2)
17%   -  1,    Lag on endogenous variable (ubstitute for endo lags >= 2)
18%   -  2,    Lead on exogenous variable  (ubstitute for exo leads >= 1)
19%   -  3,    Lag on exogenous variable (substitute for exo lags >= 1)
20%   -  4     Expectation (substitute for Expectation Operator)
21%   -  5,    Diff forward (substitute for the differentiate of a forward variable)
22%   -  6,    Multipliers for FOC of Ramsey Problem
23%   -  7,    Variable for var_model with order > abs(min_lag()) present in model
24%   -  8,    Variable for Diff operator
25%   -  9,    Lag on Diff
26%   - 10,    Unary operator (log, exp)
27%   - 11,    Lead on Diff
28
29% Copyright (C) 2018-2019 Dynare Team
30%
31% This file is part of Dynare.
32%
33% Dynare is free software: you can redistribute it and/or modify
34% it under the terms of the GNU General Public License as published by
35% the Free Software Foundation, either version 3 of the License, or
36% (at your option) any later version.
37%
38% Dynare is distributed in the hope that it will be useful,
39% but WITHOUT ANY WARRANTY; without even the implied warranty of
40% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
41% GNU General Public License for more details.
42%
43% You should have received a copy of the GNU General Public License
44% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
45
46global M_
47
48b = false;
49
50id = find(strcmp(var, M_.endo_names));
51
52if isempty(id)
53    return
54end
55
56if id<=M_.orig_endo_nbr
57    return
58else
59    b = true;
60    if nargin<2
61        return
62    end
63end
64
65auxinfo = M_.aux_vars(get_aux_variable_id(id));
66
67if ~isequal(auxinfo.type, type)
68    b = false;
69end