Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Johannes Pfeifer
dynare
Commits
fdf6821d
Commit
fdf6821d
authored
Sep 11, 2019
by
Stéphane Adjemian
Browse files
Generalized isconst routine.
parent
c4ddd986
Changes
1
Hide whitespace changes
Inline
Side-by-side
matlab/utilities/general/isconst.m
View file @
fdf6821d
function
aa
=
isconst
(
y
)
% Returns 1 if vector y is constant, 0 otherwise.
function
A
=
isconst
(
B
)
% Returns an array of logicals, i-th element is `true` if column i of B is constant, `false` otherwise.
%
% INPUTS:
%
yy
[double] n
*1 vector
.
%
- B
[double] n
×m matrix
.
%
% OUTPUTS
% aa [integer] scalar equal to 1 or 0.
%
% SPECIAL REQUIREMENTS
% none
% - A [logical] 1×m vector.
% Copyright
(C)
2008-201
7
Dynare Team
% Copyright
©
2008-201
9
Dynare Team
%
% This file is part of Dynare.
%
...
...
@@ -26,7 +24,11 @@ function aa = isconst(y)
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>
aa
=
0
;
if
all
(
abs
(
y
(
2
:
end
)
-
y
(
1
:
end
-
1
))
<
1e-10
)
aa
=
1
;
A
=
false
(
1
,
size
(
B
,
2
));
for
i
=
1
:
size
(
B
,
2
)
if
all
(
abs
(
B
(
2
:
end
,
i
)
-
B
(
1
:
end
-
1
,
i
))
<
1e-12
)
A
(
i
)
=
true
;
end
end
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment