README_Matlab - Installation instructions for OOQP Matlab support
This page is part of the OOQP documentation .
OOQP may be invoked from within the Matlab environment. Instructions for installing this feature are given here. (This feature is not installed by the standard installation process described in the INSTALL file of the OOQP distribution.)
Before you attempt to build this interface yourself, we recommend that you search the OOQP web site for a pre-compiled distribution of the required files.
On some machines, it may not be possible to build the OOQP-Matlab interface. The compiler suite and/or libraries available on some systems are simply not compatible with the Matlab executable, and little can be done to fix this other than upgrading some of your software. On other systems, the mex files may be built, but it may require a specific combination of compiler flags and options. See the TROUBLESHOOTING section below for more info.
The Matlab interface requires two types of files: compiled (``Mex'') files and Matlab function (``.m'') files. To compile the required files, first configure and install the OOQP package. Detailed instructions for this procedure are given in the INSTALL file of the OOQP distribution. Briefly, one must invoke the configure script like so.
./configure --with-matlab
The option --with-matlab
is necessary for configuring Matlab
support. If the configure script is unable to configure the Matlab
interface, it will print appropriate error messages an create the file
src/Mex/DISABLED. If this file is created, you will need to take some
further action to configure this module. See the TROUBLESHOOTING
section below for details.
Now type
make all_matlab
to compile all files necessary for the Matlab interface.
The files related to Matlab will be placed in the top-level OOQP directory and will have suffices of the form .mexZZZ where ZZZ are several additional characters that represent the machine type and operating system. For instance, under Linux on an Intel processor, the solver will be named ooqp_mex.mexglx. Several Matlab functions with the suffix .m will also be copied into the top level directory.
Invoke Matlab from within the OOQP directory and type
help OOQP
at the Matlab prompt to get a listing of available functions. If your OOQP directory isn't named 'OOQP', substitute the appropriate directory name. Help is available for each supplied functions. For instance, help for the default QP solver may be obtained by typing
help ooqp
To install the Matlab interface in another directory, simply copy all ``.mexZZZ'' and ``.m'' files to the desired directory, and run Matlab from that location.
On all systems, if you are having trouble you should type
mex -v
to learn which compilers and compiler flags the mex
script is using
to build mex files. It is often worthwhile to set appropriate
environment variables before running configure
so that all source
files are compiled in the same way. For instance the CXX
environment variable can be set to the name of an alternate C++
compiler. The names of these variables loosely follow the naming
conventions used by GNU make. See the ``Variables Used by Implicit
Rules'' section of the online manual for GNU make that
may be found at http://www.gnu.org/manual/.
If you have already run configure
delete the config.cache
file. It is never harmful to remove this file, but is only necessary
when you are making major changes to the configuration such as
changing the C++ compiler.
mex: -xlic_lib=sunperf not a valid option.
then you will need to compile a copy of the BLAS and use the compiled version rather than sunperf. See the INSTALL file for information on how to do so.
On some versions of Solaris, C++ files are compiled using the-compat
option. Type mex -v
to see the actually compile options
used. If -compat
is being used, it must be used to compile all C++
files. Set the environment variable CXX
to
CC -compat
before running configure
.
-lCstd -lCrun
to the link lines in src/Mex/MakefileTargets.inc.
Building on an SGI: On a SGI, you need to consider the ABI, i.e. the format of the compiled files. Matlab 5 and 6 use different formats and the mex files generated by one version of matlab won't be compatible with the other version.The format of the compiled files is controlled by the SGI_ABI
environment variable. Be sure to set the SGI_ABI
before running
configure
. Otherwise, some aspects of the package may be configured
for a different ABI.
SGI_ABI
set to -64
. If
your machine or OS doesn't support the -64
option, you are
out-of-luck. The alternative -o32
C++ compiler doesn't support modern
C++ constructs used in OOQP.
For Matlab 6, all files must be compiled using the n32
option. This
is probably the default, but to be on the safe side, set SGI_ABI
to
n32
To configure this package, you may need to set the MEX and/or MATLABEXE environment variables before running configure.
Back to the Documentation Roadmap .