Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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';
error('Work Only on Linux');
% ('Please define the location of gfortran/fortran77 location');
% 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']);
% lapack
% lapack = [matlabroot '/bin/glnxa64/'];
lapack = [matlabroot '/bin/glnxa64/']; % mkl
% blas = [matlabroot '/bin/glnxa64/'];
blas = [matlabroot '/bin/glnxa64/']; % 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