mjdgges: remove instances of mexErrMsgTxt

time-shift
Houtan Bastani 2010-09-20 17:51:25 +02:00
parent 2c38a1913c
commit 7b0d6da920
4 changed files with 29 additions and 38 deletions

View File

@ -32,7 +32,7 @@ function [dr,info,M_,options_,oo_] = dr1(dr,task,M_,options_,oo_)
% none.
%
% Copyright (C) 1996-2009 Dynare Team
% Copyright (C) 1996-2010 Dynare Team
%
% This file is part of Dynare.
%
@ -338,7 +338,8 @@ else % use original Dynare solver
% 2) In global_initialization.m, if mjdgges.m is visible exist(...)==2,
% this means that the DLL isn't avaiable and use_qzdiv is set to 1
[ss,tt,w,sdim,dr.eigval,info1] = mjdgges(e,d,options_.qz_criterium);
[err,ss,tt,w,sdim,dr.eigval,info1] = mjdgges(e,d,options_.qz_criterium);
mexErrCheck('mjdgges', err);
if info1
info(1) = 2;

View File

@ -1,7 +1,7 @@
function [dr,info,M_,options_,oo_] = dr11_sparse(dr,task,M_,options_,oo_, jacobia_, hessian)
%function [dr,info,M_,options_,oo_] = dr11_sparse(dr,task,M_,options_,oo_, jacobia_, hessian)
% Copyright (C) 2008 Dynare Team
% Copyright (C) 2008-2010 Dynare Team
%
% This file is part of Dynare.
%
@ -104,8 +104,8 @@ end
%e
%d
[ss,tt,w,sdim,dr.eigval,info1] = mjdgges(e,d,options_.qz_criterium);
[err,ss,tt,w,sdim,dr.eigval,info1] = mjdgges(e,d,options_.qz_criterium);
mexErrCheck('mjdgges', err);
if info1
info(1) = 2;

View File

@ -1,5 +1,5 @@
function [ss,tt,w,sdim,eigval,info] = mjdgges(e,d,qz_criterium)
%function [ss,tt,w,sdim,eigval,info] = mjdgges(e,d,qz_criterium)
function [err,ss,tt,w,sdim,eigval,info] = mjdgges(e,d,qz_criterium)
%function [err,ss,tt,w,sdim,eigval,info] = mjdgges(e,d,qz_criterium)
% QZ decomposition, Sims' codes are used.
%
% INPUTS
@ -8,6 +8,7 @@ function [ss,tt,w,sdim,eigval,info] = mjdgges(e,d,qz_criterium)
% qz_criterium [double] scalar (1+epsilon).
%
% OUTPUTS
% err [double] scalar: 1 indicates failure, 0 indicates success
% ss [complex] (n*n) matrix.
% tt [complex] (n*n) matrix.
% w [complex] (n*n) matrix.
@ -38,12 +39,9 @@ function [ss,tt,w,sdim,eigval,info] = mjdgges(e,d,qz_criterium)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
% Chek number of inputs and outputs.
if nargin>3 || nargin<2
error('Three or two input arguments required!')
end
if nargout>6
error('No more than six output arguments!')
% Check number of inputs and outputs.
if nargin>3 || nargin<2 || nargout>7 || nargout==0
error('MJDGGES: takes 2 or 3 input arguments and between 1 and 7 output arguments.')
end
% Check the first two inputs.
[me,ne] = size(e);
@ -91,3 +89,4 @@ else
info = 1;% Not as precise as lapack's info!
end
end
err = 0;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2006-2008 Dynare Team
* Copyright (C) 2006-2010 Dynare Team
*
* This file is part of Dynare.
*
@ -84,14 +84,8 @@ mexFunction(int nlhs, mxArray *plhs[],
/* Check for proper number of arguments */
if (nrhs < 2 || nrhs > 3)
{
mexErrMsgTxt("MJDGGES: two or three input arguments are required.");
}
else if (nlhs > 6)
{
mexErrMsgTxt("MJDGGES: too many output arguments.");
}
if (nrhs < 2 || nrhs > 3 || nlhs == 0 || nlhs > 7)
DYN_MEX_FUNC_ERR_MSG_TXT("MJDGGES: takes 2 or 3 input arguments and between 1 and 7 output arguments.");
/* Check that A and B are real matrices of the same dimension.*/
@ -102,26 +96,24 @@ mexFunction(int nlhs, mxArray *plhs[],
if (!mxIsDouble(prhs[0]) || mxIsComplex(prhs[0])
|| !mxIsDouble(prhs[1]) || mxIsComplex(prhs[1])
|| (m1 != n1) || (m2 != n1) || (m2 != n2))
{
mexErrMsgTxt("MJDGGES requires two square real matrices of the same dimension.");
}
DYN_MEX_FUNC_ERR_MSG_TXT("MJDGGES requires two square real matrices of the same dimension.");
/* Create a matrix for the return argument */
plhs[0] = mxCreateDoubleMatrix(n1, n1, mxREAL);
plhs[1] = mxCreateDoubleMatrix(n1, n1, mxREAL);
plhs[2] = mxCreateDoubleMatrix(n1, n1, mxREAL);
plhs[3] = mxCreateDoubleMatrix(1, 1, mxREAL);
plhs[4] = mxCreateDoubleMatrix(n1, 1, mxCOMPLEX);
plhs[5] = mxCreateDoubleMatrix(1, 1, mxREAL);
plhs[3] = mxCreateDoubleMatrix(n1, n1, mxREAL);
plhs[4] = mxCreateDoubleMatrix(1, 1, mxREAL);
plhs[5] = mxCreateDoubleMatrix(n1, 1, mxCOMPLEX);
plhs[6] = mxCreateDoubleMatrix(1, 1, mxREAL);
/* Assign pointers to the various parameters */
s = mxGetPr(plhs[0]);
t = mxGetPr(plhs[1]);
z = mxGetPr(plhs[2]);
sdim = mxGetPr(plhs[3]);
eval_r = mxGetPr(plhs[4]);
eval_i = mxGetPi(plhs[4]);
info = mxGetPr(plhs[5]);
s = mxGetPr(plhs[1]);
t = mxGetPr(plhs[2]);
z = mxGetPr(plhs[3]);
sdim = mxGetPr(plhs[4]);
eval_r = mxGetPr(plhs[5]);
eval_i = mxGetPi(plhs[5]);
info = mxGetPr(plhs[6]);
a = mxGetPr(prhs[0]);
b = mxGetPr(prhs[1]);
@ -145,8 +137,7 @@ mexFunction(int nlhs, mxArray *plhs[],
/* Do the actual computations in a subroutine */
mjdgges(s, t, z, &n, sdim, eval_r, eval_i, info);
return;
plhs[0] = mxCreateDoubleScalar(0);
}
/*