Skip to content
Snippets Groups Projects
Commit 32a1243a authored by michel's avatar michel
Browse files

4.0 merged r2565 changeset from trunk (again fixe for mjdgges on Matlab before...

4.0 merged r2565 changeset from trunk (again fixe for mjdgges on Matlab before and after v.7.8 on 64 bits plateforms)

git-svn-id: https://www.dynare.org/svn/dynare/branches/4.0@2566 ac1d8469-bf42-47a9-8791-bf33cf982152
parent 2c2dcaaa
No related branches found
No related tags found
No related merge requests found
...@@ -54,6 +54,11 @@ if matlab_ver_less_than('7.3') ...@@ -54,6 +54,11 @@ if matlab_ver_less_than('7.3')
COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -DMWTYPES_NOT_DEFINED' ]; COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -DMWTYPES_NOT_DEFINED' ];
end end
% Matlab Lapack expects mwSignedIndex arguments only starting with Matlab 7.8
if ~matlab_ver_less_than('7.8')
COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -DLAPACK_USE_MWSIGNEDINDEX' ];
end
% Large array dims for 64 bits platforms appeared in Matlab 7.3 % Large array dims for 64 bits platforms appeared in Matlab 7.3
if (strcmpi('GLNXA64', computer) || strcmpi('PCWIN64', computer)) ... if (strcmpi('GLNXA64', computer) || strcmpi('PCWIN64', computer)) ...
&& ~matlab_ver_less_than('7.3') && ~matlab_ver_less_than('7.3')
......
...@@ -20,8 +20,10 @@ ...@@ -20,8 +20,10 @@
#include <string.h> #include <string.h>
#include "mex.h" #include "mex.h"
#if defined(MWTYPES_NOT_DEFINED) || defined(OCTAVE) #if !defined(LAPACK_USE_MWSIGNEDINDEX) || defined(OCTAVE)
typedef int mwSignedIndex; typedef int lapack_int;
#else
typedef mwSignedIndex lapack_int;
#endif #endif
#ifdef NO_LAPACK_H #ifdef NO_LAPACK_H
...@@ -36,26 +38,26 @@ void dgges(char *, char *, char *, int (*)(), int *, double *, int *, double *, ...@@ -36,26 +38,26 @@ void dgges(char *, char *, char *, int (*)(), int *, double *, int *, double *,
double criterium; double criterium;
mwSignedIndex my_criteria(double *alphar, double *alphai, double *beta) lapack_int my_criteria(double *alphar, double *alphai, double *beta)
{ {
return( (*alphar * *alphar + *alphai * *alphai) < criterium * *beta * *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) void mjdgges(double *a, double *b, double *z, double *n, double *sdim, double *eval_r, double *eval_i, double *info)
{ {
mwSignedIndex i_n, i_info, i_sdim, one, lwork; lapack_int i_n, i_info, i_sdim, one, lwork;
double *alphar, *alphai, *beta, *work, *par, *pai, *pb, *per, *pei; double *alphar, *alphai, *beta, *work, *par, *pai, *pb, *per, *pei;
double *junk; double *junk;
mwSignedIndex *bwork; lapack_int *bwork;
one = 1; one = 1;
i_n = (mwSignedIndex)*n; i_n = (lapack_int)*n;
alphar = mxCalloc(i_n,sizeof(double)); alphar = mxCalloc(i_n,sizeof(double));
alphai = mxCalloc(i_n,sizeof(double)); alphai = mxCalloc(i_n,sizeof(double));
beta = mxCalloc(i_n,sizeof(double)); beta = mxCalloc(i_n,sizeof(double));
lwork = 16*i_n+16; lwork = 16*i_n+16;
work = mxCalloc(lwork,sizeof(double)); work = mxCalloc(lwork,sizeof(double));
bwork = mxCalloc(i_n,sizeof(mwSignedIndex)); bwork = mxCalloc(i_n,sizeof(lapack_int));
/* made necessary by bug in Lapack */ /* made necessary by bug in Lapack */
junk = mxCalloc(i_n*i_n,sizeof(double)); junk = mxCalloc(i_n*i_n,sizeof(double));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment