Code Generation for coneprog Background - MATLAB & Simulink (original) (raw)

Main Content

What Is Code Generation?

Code generation is the conversion of MATLAB® code to C/C++ code using MATLAB Coder™. Code generation requires a MATLAB Coder license.

Typically, you use code generation to deploy code on hardware that is not running MATLAB.

For an example, see Generate Code for coneprog. For examples of code generation in other optimization solvers, see Generate Code for fmincon, Generate Code for fsolve, or Generate Code for lsqcurvefit or lsqnonlin.

Code Generation Requirements

Note the following requirements for generating code forconeprog:

Generated Code Not Multithreaded

By default, generated code for use outside the MATLAB environment uses linear algebra libraries that are not multithreaded. Therefore, this code can run significantly slower than code in the MATLAB environment.

If your target hardware has multiple cores, you can achieve better performance by using custom multithreaded LAPACK and BLAS libraries. For details about incorporating these libraries in your generated code, see Speed Up Linear Algebra in Generated Standalone Code by Using LAPACK Calls (MATLAB Coder).

See Also

coneprog | codegen (MATLAB Coder) | optimoptions | optim.coder.infbound

Topics