-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathREADME_Matlab
138 lines (102 loc) · 6.06 KB
/
README_Matlab
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
NAME
README_Matlab - Installation instructions for OOQP Matlab support
INSTALLATION
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 BUILD THE OOQP-MATLAB INTERFACE
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.
BUILDING THE OOQP-MATLAB INTERFACE
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.
TROUBLESHOOTING
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.
* If the configure file reports problems compiling or running mex
files, and you are running under linux, you may be running into a
known problem with the mex file compiler being incompatible with
your version of linux. Contact Mathworks for more information.
* Building under Solaris:
* If you are running under Solaris and are getting the message
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".
* If you are running on Solaris, and it looks suspiciously like
you aren't getting linked against the C++ runtime libraries, add
-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.
* For Matlab 5, all files must be compiled with "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.