v4.1: fixed build_matlab.m and mjdgges.c for Matlab (7.8) r2009a

added new macro NWSIGNEDINDEX_NOT_DEFINED (necessary in 64bit environments)


git-svn-id: https://www.dynare.org/svn/dynare/trunk@2539 ac1d8469-bf42-47a9-8791-bf33cf982152
time-shift
michel 2009-03-30 20:13:22 +00:00
parent ec4cc46845
commit adc5d60e23
2 changed files with 11 additions and 5 deletions

View File

@ -52,6 +52,8 @@ end
% mwSize and mwIndex appeared in Matlab 7.3
if matlab_ver_less_than('7.3')
COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -DMWTYPES_NOT_DEFINED' ];
elseif matlab_ver_less_than('7.8')
COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -DMWSIGNEDINDEX_NOT_DEFINED' ];
end
% Large array dims for 64 bits platforms appeared in Matlab 7.3

View File

@ -20,6 +20,10 @@
#include <string.h>
#include "mex.h"
#ifdef MWSIGNEDINDEX_NOT_DEFINED
# define mwSignedIndex int
#endif
#ifdef NO_LAPACK_H
# if defined(__linux__) || defined(OCTAVE)
# define dgges dgges_
@ -32,26 +36,26 @@ void dgges(char *, char *, char *, int (*)(), int *, double *, int *, double *,
double criterium;
int my_criteria(double *alphar, double *alphai, double *beta)
mwSignedIndex my_criteria(double *alphar, double *alphai, double *beta)
{
return( (*alphar * *alphar + *alphai * *alphai) < criterium * *beta * *beta);
}
void mjdgges(double *a, double *b, double *z, double *n, double *sdim, double *eval_r, double *eval_i, double *info)
{
int i_n, i_info, i_sdim, one, lwork;
mwSignedIndex i_n, i_info, i_sdim, one, lwork;
double *alphar, *alphai, *beta, *work, *par, *pai, *pb, *per, *pei;
double *junk;
int *bwork;
mwSignedIndex *bwork;
one = 1;
i_n = (int)*n;
i_n = (mwSignedIndex)*n;
alphar = mxCalloc(i_n,sizeof(double));
alphai = mxCalloc(i_n,sizeof(double));
beta = mxCalloc(i_n,sizeof(double));
lwork = 16*i_n+16;
work = mxCalloc(lwork,sizeof(double));
bwork = mxCalloc(i_n,sizeof(int));
bwork = mxCalloc(i_n,sizeof(mwSignedIndex));
/* made necessary by bug in Lapack */
junk = mxCalloc(i_n*i_n,sizeof(double));