2) open Matlab and run:
>> mex -setup
then choosing option 1 for the gcc compiler options.
3) copy ~/.matlab/R2011a/mexopts.sh to algencan-2.3.7/sources/interfaces/matlab/
4) in the maci64 block of algencan-2.3.7/sources/interfaces/matlab/mexopts.sh change FC='gfortran' to FC=/usr/local/bin/gfortran and add the flag -xf77-cpp-input to FFLAGS (which now reads FFLAGS='-fexceptions -m64 -fbackslash -xf77-cpp-input')
5) from Matlab change the directory to algencan-2.3.7/sources/interfaces/matlab/ and run the command:
>> mex -largeArrayDims -I../../algencan ../../algencan/algencan.f ../../algencan/auglag.f ../../algencan/backtrack.f ../../algencan/betra.f ../../algencan/calc.f ../../algencan/cgm.f ../../algencan/dogleg.f ../../algencan/drand.f ../../algencan/evalal.f ../../algencan/extrap.f ../../algencan/gencan.f ../../algencan/happrox.f ../../algencan/lss.f ../../algencan/moresor.f ../../algencan/newtd.f ../../algencan/newtonkkt.f ../../algencan/scl.f ../../algencan/setpoint.f ../../algencan/sevalus.f ../../algencan/spgls.f ../../algencan/tevalus.f ../../algencan/tnls.f ../../algencan/uevalus.f ../../algencan/vevalus.f ./checkderm64.f ./fparamm64.f ./matlabwrapper64.f
My system is a MacBook Pro with an Intel Core 2 Duo CPU running Snow Leopard (version 10.6.8) and Matlab R2011a with the Xcode (version 3.2.6) gcc and the gfortran build (version 4.2.3) provided by the R-project in
http://cran.r-project.org/bin/macosx/tools/
To make people's life easier, I've attached the files I've changed (mexopts.sh and matlabwrapper64.f which should overwrite those in algencan-2.3.7/sources/interfaces/matlab/) and the line above in a .m file which should be ran inside Matlab from the directory algencan-2.3.7/sources/interfaces/matlab/
That's how it worked for me. One note, I was able to successfully run the script algencanma.m even though the compilation flags the 3 warnings below:
./fparamm64.f:470: warning: no newline at end of file
ld: warning: in /Developer/SDKs/MacOSX10.6.sdk/usr/local/lib/gcc/i686-apple-darwin8/4.2.3/libgfortranbegin.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
ld: warning: in /Developer/SDKs/MacOSX10.6.sdk/usr/local/lib/gcc/i686-apple-darwin8/4.2.3/libgcc.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
The first one is really nothing, but the other two seem to indicate some sort of mismatch with the gfortran build from the R-project and the code generated by gfortran itself. But again, algencanma.m called the FORTRAN code and didn't crash...
Hope that helps other people...
Best,
Ives
P.S.: Thanks a lot for making ALGENCAN available! :)