Using the C++ Math Library    

Functions

The MATLAB C++ Math Library contains over 400 mathematical functions and a collection of utility routines. The mathematical functions are C++ versions of their MATLAB counterparts, while the utility routines provide services that the mathematical functions previously received from interpreted MATLAB; for example, printing and memory management.

Unlike C++ functions, MATLAB functions may have multiple return values. The MATLAB C++ Math Library provides for multiple return values by requiring that you pass all your return values except the first into the function as output parameters. In a function argument list, output parameters always precede input parameters. For example, the MATLAB function call
[ V, D ] = eig(X) becomes V = eig(&D, X) in the MATLAB C++ Math Library.

By default all MATLAB functions have optional input and output arguments (see Functions). However, for each function, only certain combinations of input and output arguments are valid. The MATLAB C++ Math Library uses a combination of function overloading and C++ default arguments to make available for each function those exact combinations of input and output arguments that are valid in MATLAB. For example, the MATLAB function svd() has a maximum of two inputs and three outputs, a total of 12 different ways it might be called. However, only three of those combinations are valid. There are, therefore, three versions of svd() in the MATLAB C++ Math Library.

See How to Call C++ Library Functions in Chapter 5 for a more thorough explanation of how to determine what arguments to pass to the MATLAB C++ Math Library version of a MATLAB function call. You can also use the online MATLAB C++ Math Library Reference available from the Help Desk to find the specific arguments for each library function. Accessing Online Reference Documentation describes how to access the Help Desk.


 Operators Input and Output