Commit 374d5908 authored by michel's avatar michel
Browse files

v4: adapted kroneker dlls for Matlab versions < 7.5 (Windows) Linux versions < 7.5 still to be done

git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1500 ac1d8469-bf42-47a9-8791-bf33cf982152
parent 13241ddc
......@@ -9,9 +9,18 @@
*/
#include <string.h>
#include "mex.h"
#include "blas.h"
#include "matrix.h"
#ifdef MWTYPES_NOT_DEFINED
typedef unsigned int mwIndex;
typedef unsigned int mwSize;
// dgemm(transpose, transpose, &mA, &nC, &mC, &B[mB*col+row], &A[ka], &mA, &C[0], &mC, &one, &D[kd], &mA);
extern "C"{
int dgemm(char*, char*, mwSize*, mwSize*, mwSize*, double*, double*, mwSize*, double*, mwSize*, double*, double*, mwSize*);
}
#elif
#include "blas.h"
#endif
void full_A_times_kronecker_B_C(double *A, double *B, double *C, double *D,
mwSize mA, mwSize nA, mwSize mB, mwSize nB, mwSize mC, mwSize nC)
......
......@@ -6,6 +6,9 @@ function build()
SOURCE1 = 'sparse_hessian_times_B_kronecker_C.cc ' ;
SOURCE2 = 'A_times_B_kronecker_C.cc ';
MATLAB = ver('matlab');
VERSION = str2num(MATLAB.Version);
MATLAB_PATH = matlabroot;
if strcmpi('GLNX86',computer)%linux (32 bits).
......@@ -26,12 +29,20 @@ function build()
CLEAN_COMMAND = 'rm *.mexa64';
elseif strcmpi('PCWIN',computer)%windows (32 bits).
MATLAB_PATH = ['"' matlabroot '\bin'];
LIB_PATH = ['"' matlabroot '\extern\lib\win32\microsoft"'];
LIB_NAME = '\libmwblas.lib';
COPY_COMMAND = 'cp *.mexw32 ../../dynare_v4/matlab/';
COMPILE_COMMAND = '\mex" ';
if VERSION <= 7.4
COMPILE_COMMAND = '\win32\mex" -DMWTYPES_NOT_DEFINED ';
LIB_PATH = '';
LIB_NAME = '';
COPY_COMMAND = 'cp *.dll ../../2007a/';
CLEAN_COMMAND = 'del *.dll';
else
COMPILE_COMMAND = '\mex" ';
LIB_PATH = ['"' matlabroot '\extern\lib\win32\microsoft"'];
LIB_NAME = '\libmwblas.lib';
COPY_COMMAND = 'cp *.mexw32 ../../2007b';
CLEAN_COMMAND = 'del *.mexw32';
end
COMPILE_OPTIONS = '-v ';
CLEAN_COMMAND = 'del *.mexw32';
end
system([MATLAB_PATH COMPILE_COMMAND COMPILE_OPTIONS SOURCE1]);
......
......@@ -12,6 +12,11 @@
#include "matrix.h"
#include "mex.h"
#ifdef MWTYPES_NOT_DEFINED
typedef unsigned int mwIndex;
typedef unsigned int mwSize;
#endif
void sparse_hessian_times_B_kronecker_B(mwIndex *isparseA, mwIndex *jsparseA, double *vsparseA,
double *B, double *D, mwSize mA, mwSize nA, mwSize mB, mwSize nB)
{
......@@ -152,8 +157,8 @@ void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
C = mxGetPr(prhs[2]);
}
// Sparse (dynare) hessian matrix.
mwIndex *isparseA = mxGetIr(prhs[0]);
mwIndex *jsparseA = mxGetJc(prhs[0]);
mwIndex *isparseA = (mwIndex*)mxGetIr(prhs[0]);
mwIndex *jsparseA = (mwIndex*)mxGetJc(prhs[0]);
double *vsparseA = mxGetPr(prhs[0]);
// Initialization of the ouput:
double *D;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment