Skip to content

Instantly share code, notes, and snippets.

@weilinear
Created August 29, 2012 03:17
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save weilinear/3506461 to your computer and use it in GitHub Desktop.
Save weilinear/3506461 to your computer and use it in GitHub Desktop.
Make for PROPACK Matlab Interface under Linux
% Compile the PROPACK package
% Copyright LI, Wei(@kuantkid)
% detect gfortran
switch (lower(computer))
case 'glnxa64'
fc = 'gfortran';
suffix = 'mexa64';
case 'glnxa32'
fc = 'gfortran';
suffix ='mexa32';
otherwise
error('Work Only on Linux');
% ('Please define the location of gfortran/fortran77 location');
end
% clear the package
system(['rm *.' suffix]);
display([ repmat(' ',[1 10]) 'Compiling Fortran Subroutines']);
system([fc ' -c -lblas -fPIC -o tqlb.o tqlb.f']);
system([fc ' -c -lblas -fPIC -o dbdqr.o dbdqr.f']);
system([fc ' -c -lblas -fPIC -o reorth.o reorth.f']);
display('Done');
% lapack
% lapack = [matlabroot '/bin/glnxa64/libmwlapack.so'];
lapack = [matlabroot '/bin/glnxa64/mkl.so']; % mkl
% blas = [matlabroot '/bin/glnxa64/libmwblas.so'];
blas = [matlabroot '/bin/glnxa64/mkl.so']; % mkl
eval(['mex bdsqr_mex.c dbdqr.o ' lapack]);
eval(['mex reorth_mex.c reorth.o ' blas]);
eval('mex tqlb_mex.c tqlb.o');
% rename the mex files
system(['mv bdsqr_mex.' suffix ' bdsqr.' suffix]);
system(['mv reorth_mex.' suffix ' reorth.' suffix]);
system(['mv tqlb_mex.' suffix ' tqlb.' suffix]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment