next up previous contents
Next: Adding a new tool Up: Interfacing CUTEr and Matlab Previous: CUTEr and MEX-Files   Contents

Using CUTEr from within Matlab

Compiling and linking the CUTEr tools with a solver written in C or Fortran, and to be used in Matlab is done by creating the corresponding MEX-File. This is the purpose of the two scripts sdmx and mx, found under $MYCUTER/bin. The purpose of these two scripts shadows that of the other scripts; sdmx first SIF-decodes the problem it is given as an argument and leaves the creation of the MEX-Files to mx. mx invokes the C or Fortran compiler distributed with Matlab, links all the object files and libraries together and finally creates the MEX-File, which can be called as a regular Matlab function.

Versions of Matlab older than 6.0 used to have separate C and Fortran compilers, often called respectively cmex and fmex. Recent versions have merged the two compilers into one, mex, making the other two obsolete. You should update your file $MYCUTER/precision/config/cmds to reflect your local instance of Matlab. Please also update $CUTER/build/arch/system.your_system accordingly, to make your modifications system-wide. For the above reason, the CUTEr interfaces to Matlab are no longer called sdmex and mex, but sdmx and mx.

For instance, to compile and link all the unconstrained CUTEr tools with the problem MSQRTALS.SIF, use

prompt% sdmx -u MSQRTALS

Note the use of the -u command-line option to sdmx in order to use the unconstrained tools. To use the constrained tools, simply omit the -u option. Also note that Matlab MEX-Files always use double precision and therefore, a double-precision SIF decoder should have been installed on the system.

Place the MEX-File thus generated in the same directory as the files produced by the SIF decoder, and in particular OUTSDIF.d, and the interfaces described in §1.3.2 are ready to be called from Matlab.

If your problem has already been decoded, the MEX-File can be regenerated using the command

prompt% mx -u


next up previous contents
Next: Adding a new tool Up: Interfacing CUTEr and Matlab Previous: CUTEr and MEX-Files   Contents
Dominique Orban 2005-03-24