Squashed 'third_party/osqp/' content from commit 33454b3e23
Change-Id: I056df0582ca06664e86554c341a94c47ab932001
git-subtree-dir: third_party/osqp
git-subtree-split: 33454b3e236f1f44193bfbbb6b8c8e71f8f04e9a
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/docs/interfaces/C.rst b/docs/interfaces/C.rst
new file mode 100644
index 0000000..ef574fe
--- /dev/null
+++ b/docs/interfaces/C.rst
@@ -0,0 +1,127 @@
+.. _c_interface:
+
+C
+=====
+
+
+
+
+.. _C_main_API:
+
+Main solver API
+---------------
+
+The main C API is imported from the header :code:`osqp.h` and provides the following functions
+
+
+.. doxygenfunction:: osqp_setup
+
+.. doxygenfunction:: osqp_solve
+
+.. doxygenfunction:: osqp_cleanup
+
+
+.. _C_sublevel_API:
+
+Sublevel API
+------------
+Sublevel C API is also imported from the header :code:`osqp.h` and provides the following functions
+
+Warm start
+^^^^^^^^^^
+OSQP automatically warm starts primal and dual variables from the previous QP solution. If you would like to warm start their values manually, you can use
+
+.. doxygenfunction:: osqp_warm_start
+
+.. doxygenfunction:: osqp_warm_start_x
+
+.. doxygenfunction:: osqp_warm_start_y
+
+
+.. _c_cpp_update_data :
+
+Update problem data
+^^^^^^^^^^^^^^^^^^^
+Problem data can be updated without executing the setup again using the following functions.
+
+.. doxygenfunction:: osqp_update_lin_cost
+
+.. doxygenfunction:: osqp_update_lower_bound
+
+.. doxygenfunction:: osqp_update_upper_bound
+
+.. doxygenfunction:: osqp_update_bounds
+
+.. doxygenfunction:: osqp_update_P
+
+.. doxygenfunction:: osqp_update_A
+
+.. doxygenfunction:: osqp_update_P_A
+
+
+
+.. _c_cpp_data_types :
+
+Data types
+----------
+
+The most basic used datatypes are
+
+* :code:`c_int`: can be :code:`long` or :code:`int` if the compiler flag :code:`DLONG` is set or not
+* :code:`c_float`: can be a :code:`float` or a :code:`double` if the compiler flag :code:`DFLOAT` is set or not.
+
+
+
+The relevant structures used in the API are
+
+Data
+^^^^
+
+.. doxygenstruct:: OSQPData
+ :members:
+
+The matrices are defined in `Compressed Sparse Column (CSC) format <https://people.sc.fsu.edu/~jburkardt/data/cc/cc.html>`_ using zero-based indexing.
+
+.. doxygenstruct:: csc
+ :members:
+
+Settings
+^^^^^^^^
+
+.. doxygenstruct:: OSQPSettings
+ :members:
+
+Solution
+^^^^^^^^
+
+.. doxygenstruct:: OSQPSolution
+ :members:
+
+Info
+^^^^^
+
+.. doxygenstruct:: OSQPInfo
+ :members:
+
+Workspace
+^^^^^^^^^
+
+.. doxygenstruct:: OSQPWorkspace
+ :members:
+
+
+Scaling
+^^^^^^^
+
+.. doxygenstruct:: OSQPScaling
+ :members:
+
+Polish
+^^^^^^
+.. doxygenstruct:: OSQPPolish
+ :members:
+
+
+
+.. TODO: Add sublevel API
+.. TODO: Add using your own linear system solver
diff --git a/docs/interfaces/cutest.rst b/docs/interfaces/cutest.rst
new file mode 100644
index 0000000..3b6ce63
--- /dev/null
+++ b/docs/interfaces/cutest.rst
@@ -0,0 +1,22 @@
+.. _cutest_interface:
+
+CUTEst
+======
+
+The command to solve a problem in SIF format contained in the file
+probname.SIF is
+
+.. code::
+
+ runcutest -p osqp -D probname.SIF
+
+See the man page for runcutest for more details or other options.
+
+The default OSQP settings used in CUTEst appear in the `OSQP.SPC <https://github.com/ralna/CUTEst/blob/master/src/osqp/OSQP.SPC>`_ file.
+Optionally, new parameter values to overwrite the default values can be stored in a file :code:`OSQP.SPC` in the directory where the :code:`runcutest` command is executed.
+The format of the file :code:`OSQP.SPC` is the parameter name starting in the first column followed by one or more spaces and then the parameter value.
+The parameter names are case sensitive.
+If the parameter value is :code:`true` or :code:`false`, then use :code:`1` for true and :code:`0` for :code:`false`.
+
+For more details see the `README.osqp <https://github.com/ralna/CUTEst/blob/master/src/osqp/README.osqp>`_ file in the CUTEst repository.
+
diff --git a/docs/interfaces/eigen_google.rst b/docs/interfaces/eigen_google.rst
new file mode 100644
index 0000000..73f466d
--- /dev/null
+++ b/docs/interfaces/eigen_google.rst
@@ -0,0 +1,6 @@
+.. _eigen_google:
+
+C++ Eigen interface (osqp-cpp)
+================================
+
+The Eigen interface developed at Google is documented `here <https://github.com/google/osqp-cpp>`_.
diff --git a/docs/interfaces/eigen_robotology.rst b/docs/interfaces/eigen_robotology.rst
new file mode 100644
index 0000000..876f201
--- /dev/null
+++ b/docs/interfaces/eigen_robotology.rst
@@ -0,0 +1,6 @@
+.. _eigen_robotology:
+
+C++ Eigen interface (osqp-eigen)
+================================
+
+The Eigen interface by Robotology group is documented `here <https://robotology.github.io/osqp-eigen/doxygen/doc/html/index.html>`_.
diff --git a/docs/interfaces/fortran.rst b/docs/interfaces/fortran.rst
new file mode 100644
index 0000000..7d2c465
--- /dev/null
+++ b/docs/interfaces/fortran.rst
@@ -0,0 +1,8 @@
+.. _fortran_interface:
+
+
+Fortran
+========
+
+The interface is still experimental.
+You can find a demo of how it works in the `osqp/osqp-fortran <https://github.com/osqp/osqp-fortran/blob/master/demo/osqp_demo_fortran.F90>`_ repository.
diff --git a/docs/interfaces/index.rst b/docs/interfaces/index.rst
new file mode 100644
index 0000000..800d422
--- /dev/null
+++ b/docs/interfaces/index.rst
@@ -0,0 +1,104 @@
+Interfaces
+============
+
+OSQP has several interfaces. The information about settings, status values and how to assign different linear system solvers appear in the following links
+
+* :ref:`Solver settings <solver_settings>`
+* :ref:`Linear system solvers <linear_system_solvers_setting>`
+* :ref:`Status values <status_values>`
+
+
+
+.. toctree::
+ :maxdepth: 1
+ :glob:
+ :hidden:
+
+ solver_settings.rst
+ linear_systems_solvers.rst
+ status_values.rst
+
+
+Official
+----------
+
++------------------------------------+----------------------------------------------------------+------------------------------------------------------------------------------------------+
+| Language | Maintainers | Repository |
++====================================+==========================================================+==========================================================================================+
+| :ref:`C <c_interface>` | | `Bartolomeo Stellato <bartolomeo.stellato@gmail.com>`_ | `github.com/osqp/osqp <https://github.com/osqp/osqp>`_ |
+| | | `Goran Banjac <gbanjac@control.ee.ethz.ch>`_ | |
+| | | `Paul Goulart <paul.goulart@eng.ox.ac.uk>`_ | |
++------------------------------------+----------------------------------------------------------+------------------------------------------------------------------------------------------+
+| :ref:`Python <python_interface>` | | `Bartolomeo Stellato <bartolomeo.stellato@gmail.com>`_ | `github.com/osqp/osqp-python <https://github.com/osqp/osqp-python>`_ |
+| | | `Goran Banjac <gbanjac@control.ee.ethz.ch>`_ | |
++------------------------------------+----------------------------------------------------------+------------------------------------------------------------------------------------------+
+| :ref:`Matlab <matlab_interface>` | | `Bartolomeo Stellato <bartolomeo.stellato@gmail.com>`_ | `github.com/osqp/osqp-matlab <https://github.com/osqp/osqp-matlab>`_ |
+| | | `Goran Banjac <gbanjac@control.ee.ethz.ch>`_ | |
+| | | `Paul Goulart <paul.goulart@eng.ox.ac.uk>`_ | |
++------------------------------------+----------------------------------------------------------+------------------------------------------------------------------------------------------+
+| :ref:`Julia <julia_interface>` | | `Twan Koolen <tkoolen@mit.edu>`_ | `github.com/osqp/OSQP.jl <https://github.com/osqp/OSQP.jl>`_ |
+| | | `Benoît Legat <benoit.legat@uclouvain.be>`_ | |
+| | | `Bartolomeo Stellato <bartolomeo.stellato@gmail.com>`_ | |
++------------------------------------+----------------------------------------------------------+------------------------------------------------------------------------------------------+
+| :ref:`R <rlang_interface>` | | `Bartolomeo Stellato <bartolomeo.stellato@gmail.com>`_ | `github.com/osqp/osqp-r <https://github.com/osqp/osqp-r>`_ |
+| | | `Paul Goulart <paul.goulart@eng.ox.ac.uk>`_ | |
++------------------------------------+----------------------------------------------------------+------------------------------------------------------------------------------------------+
+
+
+
+.. toctree::
+ :maxdepth: 1
+ :glob:
+ :hidden:
+
+ C.rst
+ python.rst
+ matlab.rst
+ julia.rst
+ rlang.rst
+
+
+
+
+
+
+
+
+
+Community Maintained
+--------------------
+
+
++------------------------------------------------+----------------------------------------------------------+------------------------------------------------------------------------------------------+
+| Language | Maintainers | Repository |
++================================================+==========================================================+==========================================================================================+
+| :ref:`C++/Eigen Google <eigen_google>` | | `Miles Lubin <miles.lubin@gmail.com>`_ | `github.com/google/osqp-cpp <https://github.com/google/osqp-cpp>`_ |
++------------------------------------------------+----------------------------------------------------------+------------------------------------------------------------------------------------------+
+| :ref:`C++/Eigen Robotology <eigen_robotology>` | | `Giulio Romualdi <giulio.romualdi@gmail.com>`_ | `github.com/robotology/osqp-eigen <https://github.com/robotology/osqp-eigen>`_ |
++------------------------------------------------+----------------------------------------------------------+------------------------------------------------------------------------------------------+
+| :ref:`Rust <rust_interface>` | | `Ed Barnard <eabarnard@gmail.com>`_ | `github.com/osqp/osqp.rs <https://github.com/osqp/osqp.rs>`_ |
++------------------------------------------------+----------------------------------------------------------+------------------------------------------------------------------------------------------+
+| :ref:`Ruby <ruby_interface>` | | `Andrew Kane <andrew@chartkick.com>`_ | `https://github.com/ankane/osqp <https://github.com/ankane/osqp>`_ |
++------------------------------------------------+----------------------------------------------------------+------------------------------------------------------------------------------------------+
+| :ref:`Fortran <fortran_interface>` | | `Nick Gould <nick.gould@stfc.ac.uk>`_ | `github.com/osqp/osqp-fortran <https://github.com/osqp/osqp-fortran>`_ |
+| | | `Bartolomeo Stellato <bartolomeo.stellato@gmail.com>`_ | |
+| | | `Paul Goulart <paul.goulart@eng.ox.ac.uk>`_ | |
++------------------------------------------------+----------------------------------------------------------+------------------------------------------------------------------------------------------+
+| :ref:`Cutest <cutest_interface>` | | `Nick Gould <nick.gould@stfc.ac.uk>`_ | `github.com/ralna/CUTEst <https://github.com/ralna/CUTEst/tree/master/src/osqp>`_ |
++------------------------------------------------+----------------------------------------------------------+------------------------------------------------------------------------------------------+
+
+
+
+.. toctree::
+ :maxdepth: 1
+ :glob:
+ :hidden:
+
+ eigen_google.rst
+ eigen_robotology.rst
+ rust.rst
+ ruby.rst
+ fortran.rst
+ cutest.rst
+
+
diff --git a/docs/interfaces/julia.rst b/docs/interfaces/julia.rst
new file mode 100644
index 0000000..37d08e1
--- /dev/null
+++ b/docs/interfaces/julia.rst
@@ -0,0 +1,167 @@
+.. _julia_interface:
+
+Julia
+======
+
+Load the module
+---------------
+The OSQP module can be load with
+
+.. code:: julia
+
+ using OSQP
+
+
+.. _julia_setup:
+
+Setup
+-----
+
+The solver is initialized by creating an OSQP Model
+
+.. code:: julia
+
+ m = OSQP.Model()
+
+The problem is specified in the setup phase by running
+
+.. code:: julia
+
+ OSQP.setup!(m; P=P, q=q, A=A, l=l, u=u, settings...)
+
+
+The arguments :code:`q`, :code:`l` and :code:`u` are :code:`Vector{Float64}`.
+The elements of :code:`l` and :code:`u` can be :math:`\pm \infty` ( using :code:`Inf`).
+
+The arguments :code:`P` and :code:`A` are sparse matrices of type :code:`SparseMatrixCSC`.
+Matrix :code:`P` can be either complete or just the upper triangular
+part. OSQP will make use of only the upper triangular part.
+If they are sparse matrices are in another format, the interface will attempt to convert them.
+There is no need to specify all the arguments.
+
+The argument :code:`settings` specifies the solver settings.
+Settings can also be passed as indipendent keyword arguments such as :code:`max_iter=1000`.
+The allowed parameters are defined in :ref:`solver_settings`.
+
+Solve
+-----
+
+The problem can be solved by
+
+.. code:: julia
+
+ results = OSQP.solve!(m)
+
+
+The output :code:`results` contains the primal solution :code:`x`, the dual solution :code:`y`, certificate of primal infeasibility :code:`prim_inf_cert`, certificate of dual infeasibility :code:`dual_inf_cert` and the :code:`info` object containing the solver statistics defined in the following table
+
+
++-----------------------+------------------------------------------------+
+| Member | Description |
++=======================+================================================+
+| :code:`iter` | Number of iterations |
++-----------------------+------------------------------------------------+
+| :code:`status` | Solver status |
++-----------------------+------------------------------------------------+
+| :code:`status_val` | Solver status value as in :ref:`status_values` |
++-----------------------+------------------------------------------------+
+| :code:`status_polish` | Polishing status |
++-----------------------+------------------------------------------------+
+| :code:`obj_val` | Objective value |
++-----------------------+------------------------------------------------+
+| :code:`pri_res` | Primal residual |
++-----------------------+------------------------------------------------+
+| :code:`dua_res` | Dual residual |
++-----------------------+------------------------------------------------+
+| :code:`setup_time` | Setup time |
++-----------------------+------------------------------------------------+
+| :code:`solve_time` | Solve time |
++-----------------------+------------------------------------------------+
+| :code:`update_time` | Update time |
++-----------------------+------------------------------------------------+
+| :code:`polish_time` | Polish time |
++-----------------------+------------------------------------------------+
+| :code:`run_time` | Total run time: setup/update + solve + polish |
++-----------------------+------------------------------------------------+
+| :code:`rho_estimate` | Optimal rho estimate |
++-----------------------+------------------------------------------------+
+| :code:`rho_updates` | Number of rho updates |
++-----------------------+------------------------------------------------+
+
+Note that if multiple solves are executed from single setup, then after the
+first one :code:`run_time` includes :code:`update_time` + :code:`solve_time`
++ :code:`polish_time`.
+
+
+Update
+------
+Part of problem data and settings can be updated without requiring a new problem setup.
+
+Update problem vectors
+^^^^^^^^^^^^^^^^^^^^^^
+Vectors :code:`q`, :code:`l` and :code:`u` can be updated with new values :code:`q_new`, :code:`l_new` and :code:`u_new` by just running
+
+.. code:: julia
+
+ OSQP.update!(m; q=q_new, l=l_new, u=u_new)
+
+
+The user does not have to specify all the keyword arguments.
+
+
+Update problem matrices
+^^^^^^^^^^^^^^^^^^^^^^^^
+Matrices :code:`A` and :code:`P` can be updated by changing the value of their elements but not their sparsity pattern. The interface is designed to mimic the :ref:`C/C++ counterpart <c_cpp_update_data>` with the Julia 1-based indexing. Note that the new values of :code:`P` represent only the upper triangular part while :code:`A` is always represented as a full matrix.
+
+You can update the values of all the elements of :code:`P` by executing
+
+.. code:: julia
+
+ OSQP.update!(m, Px=Px_new)
+
+
+If you want to update only some elements, you can pass
+
+.. code:: julia
+
+ OSQP.update!(m, Px=Px_new, Px_idx=Px_new_idx)
+
+where :code:`Px_new_idx` is the vector of indices of mapping the elements of :code:`Px_new` to the original vector :code:`Px` representing the data of the sparse matrix :code:`P`.
+
+Matrix :code:`A` can be changed in the same way. You can also change both matrices at the same time by running, for example
+
+
+.. code:: julia
+
+ OSQP.update!(m, Px=Px_new, Px_idx=Px_new_idx, Ax=Ax_new, Ax=Ax_new_idx)
+
+
+
+
+
+.. _julia_update_settings:
+
+Update settings
+^^^^^^^^^^^^^^^
+
+Settings can be updated by running
+
+.. code:: julia
+
+ OSQP.update_settings!(m; new_settings)
+
+
+where :code:`new_settings` are the new settings specified as keyword arguments that can be updated which are marked with an * in :ref:`solver_settings`.
+
+
+Warm start
+----------
+
+OSQP automatically warm starts primal and dual variables from the previous QP solution. If you would like to warm start their values manually, you can use
+
+.. code:: julia
+
+ OSQP.warm_start!(m; x=x0, y=y0)
+
+
+where :code:`x0` and :code:`y0` are the new primal and dual variables.
diff --git a/docs/interfaces/linear_systems_solvers.rst b/docs/interfaces/linear_systems_solvers.rst
new file mode 100644
index 0000000..1aa8475
--- /dev/null
+++ b/docs/interfaces/linear_systems_solvers.rst
@@ -0,0 +1,22 @@
+.. _linear_system_solvers_setting :
+
+Linear Systems Solvers
+-----------------------
+The settings parameter :code:`linsys_solver` defines the solver for the linear system.
+In C it corresponds to an integer :code:`c_int` (see :ref:`c_cpp_data_types`) and in the other high level languages to a string.
+
+
++-----------------+-------------------+--------------------------------+---------------+
+| Solver | String option | C Constant | Integer value |
++=================+===================+================================+===============+
+| QDLDL | "qdldl" | :code:`QDLDL_SOLVER` | :code:`0` |
++-----------------+-------------------+--------------------------------+---------------+
+| MKL Pardiso | "mkl pardiso" | :code:`MKL_PARDISO_SOLVER` | :code:`1` |
++-----------------+-------------------+--------------------------------+---------------+
+
+
+
+To add new linear system solvers see :ref:`interfacing_new_linear_system_solvers`.
+
+
+
diff --git a/docs/interfaces/matlab.rst b/docs/interfaces/matlab.rst
new file mode 100644
index 0000000..81e7027
--- /dev/null
+++ b/docs/interfaces/matlab.rst
@@ -0,0 +1,168 @@
+.. _matlab_interface:
+
+Matlab
+======
+
+.. _matlab_setup:
+
+Setup
+-----
+The solver is initialized by creating an OSQP object
+
+.. code:: matlab
+
+ m = osqp;
+
+The problem is specified in the setup phase by running
+
+.. code:: matlab
+
+ m.setup(P, q, A, l, u, varargin)
+
+
+The arguments :code:`q`, :code:`l` and :code:`u` are arrays. The elements of :code:`l` and :code:`u` can be :math:`\pm \infty` ( using :code:`Inf`). The arguments :code:`P` and :code:`A` are sparse matrices.
+Matrix :code:`P` can be either complete or just the upper triangular
+part. OSQP will make use of only the upper triangular part.
+
+There is no need to specify all the problem data. They can be omitted by writing :code:`[]`.
+
+The last argument :code:`varargin` specifies the solver options. You can pass the options in two ways. You can either set the individual parameters as field-value pairs, e.g.,
+
+.. code:: matlab
+
+ m.setup(P, q, A, l, u, 'eps_abs', 1e-04, 'eps_rel', 1e-04);
+
+
+Alternatively, you can create a structure containing all the settings, change some of the fields and then pass it as the last argument
+
+.. code:: matlab
+
+ settings = m.default_settings();
+ settings.eps_abs = 1e-04;
+ settings.eps_rel = 1e-04;
+ m.setup(P, q, A, l, u, settings);
+
+The allowed settings are defined in :ref:`solver_settings`.
+
+
+Solve
+-----
+
+The problem can be solved by
+
+.. code:: matlab
+
+ results = m.solve();
+
+The :code:`results` structure contains the primal solution :code:`x`, the dual solution :code:`y`, certificate of primal infeasibility :code:`prim_inf_cert`, certificate of dual infeasibility :code:`dual_inf_cert` and the :code:`info` structure containing the solver statistics defined in the following table
+
+
++-----------------------+------------------------------------------------+
+| Member | Description |
++=======================+================================================+
+| :code:`iter` | Number of iterations |
++-----------------------+------------------------------------------------+
+| :code:`status` | Solver status |
++-----------------------+------------------------------------------------+
+| :code:`status_val` | Solver status value as in :ref:`status_values` |
++-----------------------+------------------------------------------------+
+| :code:`status_polish` | Polishing status |
++-----------------------+------------------------------------------------+
+| :code:`obj_val` | Objective value |
++-----------------------+------------------------------------------------+
+| :code:`pri_res` | Primal residual |
++-----------------------+------------------------------------------------+
+| :code:`dua_res` | Dual residual |
++-----------------------+------------------------------------------------+
+| :code:`setup_time` | Setup time |
++-----------------------+------------------------------------------------+
+| :code:`solve_time` | Solve time |
++-----------------------+------------------------------------------------+
+| :code:`update_time` | Update time |
++-----------------------+------------------------------------------------+
+| :code:`polish_time` | Polish time |
++-----------------------+------------------------------------------------+
+| :code:`run_time` | Total run time: setup/update + solve + polish |
++-----------------------+------------------------------------------------+
+| :code:`rho_estimate` | Optimal rho estimate |
++-----------------------+------------------------------------------------+
+| :code:`rho_updates` | Number of rho updates |
++-----------------------+------------------------------------------------+
+
+Note that if multiple solves are executed from single setup, then after the
+first one :code:`run_time` includes :code:`update_time` + :code:`solve_time`
++ :code:`polish_time`.
+
+
+Update
+------
+Part of problem data and settings can be updated without requiring a new problem setup.
+
+
+
+Update problem vectors
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+Vectors :code:`q`, :code:`l` and :code:`u` can be updated with new values :code:`q_new`, :code:`l_new` and :code:`u_new` by just running
+
+.. code:: python
+
+ m.update('q', q_new, 'l', l_new, 'u', u_new);
+
+
+The user does not have to specify all the arguments.
+
+
+Update problem matrices
+^^^^^^^^^^^^^^^^^^^^^^^^
+Matrices :code:`A` and :code:`P` can be updated by changing the value of their elements but not their sparsity pattern.
+The interface is designed to mimic the :ref:`C counterpart <c_cpp_update_data>` with the Matlab 1-based indexing.
+Note that the new values of :code:`P` represent only the upper triangular part while :code:`A` is always represented as a full matrix.
+
+You can update the values of all the elements of :code:`P` by executing
+
+.. code:: matlab
+
+ m.update('Px', Px_new)
+
+
+If you want to update only some elements, you can pass
+
+.. code:: matlab
+
+ m.update('Px', Px_new, 'Px_idx', Px_new_idx)
+
+where :code:`Px_new_idx` is the vector of indices of mapping the elements of :code:`Px_new` to the original vector :code:`Px` representing the data of the sparse matrix :code:`P`.
+
+Matrix :code:`A` can be changed in the same way. You can also change both matrices at the same time by running, for example
+
+
+.. code:: matlab
+
+ m.update('Px', Px_new, 'Px_idx', Px_new_idx, 'Ax' Ax_new, 'Ax', Ax_new_idx)
+
+
+Update settings
+^^^^^^^^^^^^^^^
+
+Settings can be updated by running
+
+.. code:: python
+
+ m.update_settings(varargin);
+
+
+where :code:`varargin` argument is described in :ref:`matlab_setup`. The allowed settings that can be updated are marked with an * in :ref:`solver_settings`.
+
+
+
+
+Warm start
+----------
+OSQP automatically warm starts primal and dual variables from the previous QP solution. If you would like to warm start their values manually, you can use
+
+.. code:: matlab
+
+ m.warm_start('x', x0, 'y', y0)
+
+where :code:`x0` and :code:`y0` are the new primal and dual variables.
diff --git a/docs/interfaces/python.rst b/docs/interfaces/python.rst
new file mode 100644
index 0000000..86b228e
--- /dev/null
+++ b/docs/interfaces/python.rst
@@ -0,0 +1,175 @@
+.. _python_interface:
+
+Python
+======
+
+Import
+------
+The OSQP module can be imported with
+
+.. code:: python
+
+ import osqp
+
+
+.. _python_setup:
+
+Setup
+-----
+
+The solver is initialized by creating an OSQP object
+
+.. code:: python
+
+ m = osqp.OSQP()
+
+The problem is specified in the setup phase by running
+
+.. code:: python
+
+ m.setup(P=P, q=q, A=A, l=l, u=u, **settings)
+
+
+The arguments :code:`q`, :code:`l` and :code:`u` are numpy arrays. The elements of :code:`l` and :code:`u` can be :math:`\pm \infty` ( using :code:`numpy.inf`).
+
+The arguments :code:`P` and :code:`A` are scipy sparse matrices in CSC format.
+Matrix :code:`P` can be either complete or just the upper triangular
+part. OSQP will make use of only the upper triangular part.
+If they are sparse matrices are in another format, the interface will attempt to convert them. There is no need to specify all the arguments.
+
+
+The keyword arguments :code:`**settings` specify the solver settings. The allowed parameters are defined in :ref:`solver_settings`.
+
+Solve
+-----
+
+The problem can be solved by
+
+.. code:: python
+
+ results = m.solve()
+
+
+The :code:`results` object contains the primal solution :code:`x`, the dual solution :code:`y`, certificate of primal infeasibility :code:`prim_inf_cert`, certificate of dual infeasibility :code:`dual_inf_cert` and the :code:`info` object containing the solver statistics defined in the following table
+
+
++-----------------------+------------------------------------------------+
+| Member | Description |
++=======================+================================================+
+| :code:`iter` | Number of iterations |
++-----------------------+------------------------------------------------+
+| :code:`status` | Solver status |
++-----------------------+------------------------------------------------+
+| :code:`status_val` | Solver status value as in :ref:`status_values` |
++-----------------------+------------------------------------------------+
+| :code:`status_polish` | Polishing status |
++-----------------------+------------------------------------------------+
+| :code:`obj_val` | Objective value |
++-----------------------+------------------------------------------------+
+| :code:`pri_res` | Primal residual |
++-----------------------+------------------------------------------------+
+| :code:`dua_res` | Dual residual |
++-----------------------+------------------------------------------------+
+| :code:`setup_time` | Setup time |
++-----------------------+------------------------------------------------+
+| :code:`solve_time` | Solve time |
++-----------------------+------------------------------------------------+
+| :code:`update_time` | Update time |
++-----------------------+------------------------------------------------+
+| :code:`polish_time` | Polish time |
++-----------------------+------------------------------------------------+
+| :code:`run_time` | Total run time: setup/update + solve + polish |
++-----------------------+------------------------------------------------+
+| :code:`rho_estimate` | Optimal rho estimate |
++-----------------------+------------------------------------------------+
+| :code:`rho_updates` | Number of rho updates |
++-----------------------+------------------------------------------------+
+
+Note that if multiple solves are executed from single setup, then after the
+first one :code:`run_time` includes :code:`update_time` + :code:`solve_time`
++ :code:`polish_time`.
+
+
+Solve in just one function (with GIL disabled)
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+We have a dedicated solve function that performs :code:`setup` and :code:`solve` operations for you. It also disables the GIL in case you
+need it. Just run it from the main module without creating the object as follows
+
+
+.. code:: python
+
+ results = osqp.solve(P=P, q=q, A=A, l=l, u=u, **settings)
+
+
+Update
+------
+Part of problem data and settings can be updated without requiring a new problem setup.
+
+Update problem vectors
+^^^^^^^^^^^^^^^^^^^^^^
+Vectors :code:`q`, :code:`l` and :code:`u` can be updated with new values :code:`q_new`, :code:`l_new` and :code:`u_new` by just running
+
+.. code:: python
+
+ m.update(q=q_new, l=l_new, u=u_new)
+
+
+The user does not have to specify all the keyword arguments.
+
+
+.. _python_update_settings:
+
+Update problem matrices
+^^^^^^^^^^^^^^^^^^^^^^^^
+Matrices :code:`A` and :code:`P` can be updated by changing the value of their elements but not their sparsity pattern.
+The interface is designed to mimic the :ref:`C counterpart <c_cpp_update_data>`.
+Note that the new values of :code:`P` represent only the upper triangular part while :code:`A` is always represented as a full matrix.
+
+You can update the values of all the elements of :code:`P` by executing
+
+.. code:: python
+
+ m.update(Px=Px_new)
+
+
+If you want to update only some elements, you can pass
+
+.. code:: python
+
+ m.update(Px=Px_new, Px_idx=Px_new_idx)
+
+where :code:`Px_new_idx` is the vector of indices of mapping the elements of :code:`Px_new` to the original vector :code:`Px` representing the data of the sparse matrix :code:`P`.
+
+Matrix :code:`A` can be changed in the same way. You can also change both matrices at the same time by running, for example
+
+
+.. code:: python
+
+ m.update(Px=Px_new, Px_idx=Px_new_idx, Ax=Ax_new, Ax=Ax_new_idx)
+
+
+Update settings
+^^^^^^^^^^^^^^^
+
+Settings can be updated by running
+
+.. code:: python
+
+ m.update_settings(**kwargs)
+
+
+where :code:`kwargs` are the settings that can be updated which are marked with an * in :ref:`solver_settings`.
+
+
+Warm start
+----------
+
+OSQP automatically warm starts primal and dual variables from the previous QP solution. If you would like to warm start their values manually, you can use
+
+.. code:: python
+
+ m.warm_start(x=x0, y=y0)
+
+
+where :code:`x0` and :code:`y0` are the new primal and dual variables.
diff --git a/docs/interfaces/rlang.rst b/docs/interfaces/rlang.rst
new file mode 100644
index 0000000..50ddf74
--- /dev/null
+++ b/docs/interfaces/rlang.rst
@@ -0,0 +1,7 @@
+.. _rlang_interface:
+
+
+R
+==
+
+The R interface is officially on CRAN and documented `here <https://cran.r-project.org/web/packages/osqp/>`_.
diff --git a/docs/interfaces/ruby.rst b/docs/interfaces/ruby.rst
new file mode 100644
index 0000000..195cf19
--- /dev/null
+++ b/docs/interfaces/ruby.rst
@@ -0,0 +1,7 @@
+.. _ruby_interface:
+
+
+Ruby
+========
+
+The ruby interface can be installed as a Ruby gem and is documented `here <https://www.rubydoc.info/gems/osqp/>`_.
diff --git a/docs/interfaces/rust.rst b/docs/interfaces/rust.rst
new file mode 100644
index 0000000..52956a3
--- /dev/null
+++ b/docs/interfaces/rust.rst
@@ -0,0 +1,6 @@
+.. _rust_interface:
+
+Rust
+======
+
+The Rust interface is documented `here <https://docs.rs/osqp/>`_.
diff --git a/docs/interfaces/solver_settings.rst b/docs/interfaces/solver_settings.rst
new file mode 100644
index 0000000..ba3abc8
--- /dev/null
+++ b/docs/interfaces/solver_settings.rst
@@ -0,0 +1,73 @@
+.. _solver_settings :
+
+Solver settings
+---------------
+
+The solver settings are displayed in the following table. The settings marked with * can be changed without running the setup method again.
+
+.. tabularcolumns:: |p{4.5cm}|p{3.5cm}|p{6.5cm}|L|
+
++--------------------------------+-------------------------------------------------------------+--------------------------------------------------------------+-----------------+
+| Argument | Description | Allowed values | Default value |
++================================+=============================================================+==============================================================+=================+
+| :code:`rho` * | ADMM rho step | 0 < :code:`rho` | 0.1 |
++--------------------------------+-------------------------------------------------------------+--------------------------------------------------------------+-----------------+
+| :code:`sigma` | ADMM sigma step | 0 < :code:`sigma` | 1e-06 |
++--------------------------------+-------------------------------------------------------------+--------------------------------------------------------------+-----------------+
+| :code:`max_iter` * | Maximum number of iterations | 0 < :code:`max_iter` (integer) | 4000 |
++--------------------------------+-------------------------------------------------------------+--------------------------------------------------------------+-----------------+
+| :code:`eps_abs` * | Absolute tolerance | 0 <= :code:`eps_abs` | 1e-03 |
++--------------------------------+-------------------------------------------------------------+--------------------------------------------------------------+-----------------+
+| :code:`eps_rel` * | Relative tolerance | 0 <= :code:`eps_rel` | 1e-03 |
++--------------------------------+-------------------------------------------------------------+--------------------------------------------------------------+-----------------+
+| :code:`eps_prim_inf` * | Primal infeasibility tolerance | 0 <= :code:`eps_prim_inf` | 1e-04 |
++--------------------------------+-------------------------------------------------------------+--------------------------------------------------------------+-----------------+
+| :code:`eps_dual_inf` * | Dual infeasibility tolerance | 0 <= :code:`eps_dual_inf` | 1e-04 |
++--------------------------------+-------------------------------------------------------------+--------------------------------------------------------------+-----------------+
+| :code:`alpha` * | ADMM overrelaxation parameter | 0 < :code:`alpha` < 2 | 1.6 |
++--------------------------------+-------------------------------------------------------------+--------------------------------------------------------------+-----------------+
+| :code:`linsys_solver` | Linear systems solver type | See :ref:`linear_system_solvers_setting` | qdldl |
++--------------------------------+-------------------------------------------------------------+--------------------------------------------------------------+-----------------+
+| :code:`delta` * | Polishing regularization parameter | 0 < :code:`delta` | 1e-06 |
++--------------------------------+-------------------------------------------------------------+--------------------------------------------------------------+-----------------+
+| :code:`polish` * | Perform polishing | True/False | False |
++--------------------------------+-------------------------------------------------------------+--------------------------------------------------------------+-----------------+
+| :code:`polish_refine_iter` * | Refinement iterations in polish | 0 < :code:`polish_refine_iter` (integer) | 3 |
++--------------------------------+-------------------------------------------------------------+--------------------------------------------------------------+-----------------+
+| :code:`verbose` * | Print output | True/False | True |
++--------------------------------+-------------------------------------------------------------+--------------------------------------------------------------+-----------------+
+| :code:`scaled_termination` * | Scaled termination conditions | True/False | False |
++--------------------------------+-------------------------------------------------------------+--------------------------------------------------------------+-----------------+
+| :code:`check_termination` * | Check termination interval | 0 (disabled) or 0 < :code:`check_termination` (integer) | 25 |
++--------------------------------+-------------------------------------------------------------+--------------------------------------------------------------+-----------------+
+| :code:`warm_start` * | Perform warm starting | True/False | True |
++--------------------------------+-------------------------------------------------------------+--------------------------------------------------------------+-----------------+
+| :code:`scaling` | Number of scaling iterations | 0 (disabled) or 0 < :code:`scaling` (integer) | 10 |
++--------------------------------+-------------------------------------------------------------+--------------------------------------------------------------+-----------------+
+| :code:`adaptive_rho` | Adaptive rho | True/False | True |
++--------------------------------+-------------------------------------------------------------+--------------------------------------------------------------+-----------------+
+| :code:`adaptive_rho_interval` | Adaptive rho interval | 0 (automatic) or 0 < :code:`adaptive_rho_interval` (integer) | 0 |
++--------------------------------+-------------------------------------------------------------+--------------------------------------------------------------+-----------------+
+| :code:`adaptive_rho_tolerance` | Tolerance for adapting rho | 1 <= :code:`adaptive_rho_tolerance` | 5 |
++--------------------------------+-------------------------------------------------------------+--------------------------------------------------------------+-----------------+
+| :code:`adaptive_rho_fraction` | Adaptive rho interval as fraction of setup time (auto mode) | 0 < :code:`adaptive_rho_fraction` | 0.4 |
++--------------------------------+-------------------------------------------------------------+--------------------------------------------------------------+-----------------+
+| :code:`time_limit` * | Run time limit in seconds | 0 (disabled) or 0 <= :code:`time_limit` | 0 |
++--------------------------------+-------------------------------------------------------------+--------------------------------------------------------------+-----------------+
+
+The boolean values :code:`True/False` are defined as :code:`1/0` in the C interfaces.
+
+
+.. The infinity values correspond to:
+..
+.. +----------+--------------------+
+.. | Language | Value |
+.. +==========+====================+
+.. | C | :code:`OSQP_INFTY` |
+.. +----------+--------------------+
+.. | Python | :code:`numpy.inf` |
+.. +----------+--------------------+
+.. | Matlab | :code:`Inf` |
+.. +----------+--------------------+
+.. | Julia | :code:`Inf` |
+.. +----------+--------------------+
diff --git a/docs/interfaces/status_values.rst b/docs/interfaces/status_values.rst
new file mode 100644
index 0000000..3dd53fa
--- /dev/null
+++ b/docs/interfaces/status_values.rst
@@ -0,0 +1,85 @@
+.. _status_values :
+
+
+
+Status values and errors
+========================
+
+Status values
+-------------
+
+These are the exit statuses, their respective constants and values returned by the solver as defined in `constants.h <https://github.com/osqp/osqp/blob/master/include/constants.h>`_.
+The *inaccurate* statuses define when the optimality, primal infeasibility or dual infeasibility conditions are satisfied with tolerances 10 times larger than the ones set.
+
++------------------------------+-----------------------------------+-------+
+| Status | Constant | Value |
++==============================+===================================+=======+
+| solved | OSQP_SOLVED | 1 |
++------------------------------+-----------------------------------+-------+
+| solved inaccurate | OSQP_SOLVED_INACCURATE | 2 |
++------------------------------+-----------------------------------+-------+
+| maximum iterations reached | OSQP_MAX_ITER_REACHED | -2 |
++------------------------------+-----------------------------------+-------+
+| primal infeasible | OSQP_PRIMAL_INFEASIBLE | -3 |
++------------------------------+-----------------------------------+-------+
+| primal infeasible inaccurate | OSQP_PRIMAL_INFEASIBLE_INACCURATE | 3 |
++------------------------------+-----------------------------------+-------+
+| dual infeasible | OSQP_DUAL_INFEASIBLE | -4 |
++------------------------------+-----------------------------------+-------+
+| dual infeasible inaccurate | OSQP_DUAL_INFEASIBLE_INACCURATE | 4 |
++------------------------------+-----------------------------------+-------+
+| interrupted by user | OSQP_SIGINT | -5 |
++------------------------------+-----------------------------------+-------+
+| run time limit reached | OSQP_TIME_LIMIT_REACHED | -6 |
++------------------------------+-----------------------------------+-------+
+| unsolved | OSQP_UNSOLVED | -10 |
++------------------------------+-----------------------------------+-------+
+| problem non convex | OSQP_NON_CVX | -7 |
++------------------------------+-----------------------------------+-------+
+
+.. note::
+
+ We recommend the user to **check the convexity of their problem before
+ passing it to OSQP**! If the user passes a non-convex problem we do not
+ assure the solver will be able to detect it.
+
+ OSQP will try to detect **non-convex** problems by checking if the residuals
+ diverge or if there are any issues in the initial factorization (if a direct
+ method is used). It will detect non-convex problems when one or more of the
+ eigenvalues of :code:`P` are "clearly" negative, i.e., when :code:`P + sigma
+ * I` is not positive semidefinite. However, it might fail to detect
+ non-convexity when :code:`P` has slightly negative eigenvalues, i.e., when
+ :code:`P + sigma * I` is positive semidefinite and :code:`P` is not.
+
+
+
+
+Solver Errors
+-------------
+
+OSQP can return errors during the setup and solve steps. Here is a table of the meaning
+and their constant values.
+
+
++------------------------------------------------+-----------------------------------+-------+
+| Errors | Constant | Value |
++================================================+===================================+=======+
+| Data validation | OSQP_DATA_VALIDATION_ERROR | 1 |
++------------------------------------------------+-----------------------------------+-------+
+| Settings validation | OSQP_SETTINGS_VALIDATION_ERROR | 2 |
++------------------------------------------------+-----------------------------------+-------+
+| Linear system solver loading | OSQP_LINSYS_SOLVER_LOAD_ERROR | 3 |
++------------------------------------------------+-----------------------------------+-------+
+| Linear system solver initialization | OSQP_LINSYS_SOLVER_INIT_ERROR | 4 |
++------------------------------------------------+-----------------------------------+-------+
+| Non convex problem | OSQP_NONCVX_ERROR | 5 |
++------------------------------------------------+-----------------------------------+-------+
+| Memory allocation | OSQP_MEM_ALLOC_ERROR | 6 |
++------------------------------------------------+-----------------------------------+-------+
+| Workspace not initialized | OSQP_WORKSPACE_NOT_INIT | 7 |
++------------------------------------------------+-----------------------------------+-------+
+
+
+
+
+