This guide was made using different solutions shared at the CVX forums and experimentation, to successfuly install the CVX tools into Octave running in Ubuntu 16.10 and 18.04.
OpenBLAS
$ sudo apt-get install libopenblas-dev
$ mkdir ~/your/path/to/Octave_dir/ && cd ~/your/path/to/Octave_dir/
$ git clone -b rework https://github.com/cvxr/CVX.git/
$ cd CVX
4. The "git clone..." command will not copy the content in directories sedumi and sdpt3, since they are a link, they should be deleted
$ rmdir sedumi sdpt3
$ git clone https://github.com/sqlp/sdpt3.git
$ git clone https://github.com/sqlp/sedumi.git
Using the Octave's Command Window:
cd ~/your/path/to/Octave_dir/CVX
Change the function octave_config_info by _octave_config_info_ at cvx_version (line 50). Octave Ref
cvx_compile
NOTE: If there are problems with the compilation just add the parameter '-rebuild'
cd ~/your/path/to/Octave_dir/CVX/sdpt3
install_sdpt3 -nopath
NOTE: If there are problems with the compilation just add the parameter '-rebuild'
cd ~/your/path/to/Octave_dir/CVX/sedumi
install_sedumi -nopath
NOTE: It may be posible that this solver will be unable to compile due to the f77blas.h file, jump to ALTERNATIVE METHODS section and rebuild (add parameter '-rebuild')
install_sedumi -nopath -rebuild
cd ~/your/path/to/Octave_dir/CVX
cvx_setup
If you are having problems with the f77blas.h file try the following:
#include <f77blas.h>
#include <openblas/f77blas.h>
install_sedumi -nopath -rebuild
#include <f77blas.h>
#include "cblas.h"
#define FORT(x) BLASFUNC(x)
#define FORT(x) cblas_ ## x
typedef int blasint;
You may need to modify other files like sdmauxScalarmul.c at the same directory, pay attention to the compiler's messages.
Remove ampersand from functions like:
FORT(dscal)(&n,&alpha,x,&one);
to become
FORT(dscal)(n,alpha,x,one);
install_sedumi -nopath -rebuild
These are the solutions by the moment. Feel free to ask anything about this procedure to the forum or to me. Best wishes and good luck!
References:
Hi,
After following your guide and seemingly installing everything correctly, when I try to run CVX (whether my own code which works perfectly under Matlab, or the built-in CVX examples), I get
Successive approximation method to be employed.
SDPT3 will be called several times to refine the solution.
Original size: 140 variables, 72 equality constraints
32 exponentials add 224 variables, 128 equality constraints
Cones | Errors |
Mov/Act | Centering Exp cone Poly cone | Status
--------+---------------------------------+---------
21/ 21 | 8.000e+00 1.500e+01 0.000e+00 | Solved
20/ 20 | 8.000e+00 1.727e+00 0.000e+00 | Solved
15/ 16 | 8.000e+00 3.928e-02 0.000e+00 | Solved
1/ 1 | 1.627e+00 9.941e-08 0.000e+00 | Solved
0/ 0 | 1.359e+00 0.000e+00 0.000e+00 | Solved
Status: Solved
Optimal value (cvx_optval): +0.367178
error: cellfun: all values must be scalars when UniformOutput = true
So it calls the solver once, and then hits this cellfun error. This error is not in my own code, it is somewhere inside CVX. When I try to run CVX again (the same script, or some other), I get just:
error: cellfun: all values must be scalars when UniformOutput = true
I am running Octave 4.2.2 on Pop!_OS 18.04 LTS 4.18.0-18-generic.
Any idea what is going on? Thanks!