Created
June 16, 2016 13:37
-
-
Save jaeandersson/8f3644488c69b9642c8b1a851830b846 to your computer and use it in GitHub Desktop.
Autogenerated MATLAB code for "casadi::Function"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
classdef Function < casadi.SharedObject | |
%General function. | |
% | |
%A general function $f$ in casadi can be multi-input, multi-output. Number of | |
%inputs: nin n_in() Number of outputs: nout n_out() We can view this | |
%function as a being composed of a ( nin, nout) grid of single-input, single- | |
%output primitive functions. Each such primitive function $f_ {i, j} | |
%\\forall i \\in [0, nin-1], j \\in [0, nout-1]$ can map as $\\mathbf | |
%{R}^{n, m}\\to\\mathbf{R}^{p, q}$, in which n, m, p, q can take | |
%different values for every (i, j) pair. When passing input, you specify | |
%which partition $i$ is active. You pass the numbers vectorized, as a vector | |
%of size $(n*m)$. When requesting output, you specify which partition $j$ is | |
%active. You get the numbers vectorized, as a vector of size $(p*q)$. To | |
%calculate Jacobians, you need to have $(m=1, q=1)$. | |
% | |
%Write the Jacobian as $J_ {i, j} = \\nabla f_{i, j} = \\frac | |
%{\\partial f_{i, j}(\\vec{x})}{\\partial \\vec{x}}$. | |
% | |
%We have the following relationships for function mapping from a row vector | |
%to a row vector: | |
% | |
%$ \\vec {s}_f = \\nabla f_{i, j} . \\vec{v}$ $ \\vec {s}_a = | |
%(\\nabla f_{i, j})^T . \\vec{w}$ | |
% | |
%Some quantities in these formulas must be transposed: input col: transpose $ | |
%\\vec {v} $ and $\\vec{s}_a$ output col: transpose $ \\vec {w} $ and | |
%$\\vec{s}_f$ NOTE: Functions are allowed to modify their input arguments | |
%when evaluating: implicitFunction, IDAS solver Further releases may disallow | |
%this. | |
% | |
%Joel Andersson | |
% | |
%C++ includes: function.hpp | |
%Usage: Function () | |
% | |
methods | |
function delete(self) | |
if self.swigPtr | |
casadiMEX(746, self); | |
self.swigPtr=[]; | |
end | |
end | |
function varargout = expand(self,varargin) | |
%Expand a function to SX. | |
% | |
% | |
%Usage: retval = expand (name, opts = casadi::Dict()) | |
% | |
%name is of type std::string const &. opts is of type casadi::Dict const &. name is of type std::string const &. opts is of type casadi::Dict const &. retval is of type Function. | |
[varargout{1:nargout}] = casadiMEX(747, self, varargin{:}); | |
end | |
function varargout = n_in(self,varargin) | |
%Get the number of function inputs. | |
% | |
% | |
%Usage: retval = n_in () | |
% | |
%retval is of type int. | |
[varargout{1:nargout}] = casadiMEX(748, self, varargin{:}); | |
end | |
function varargout = n_out(self,varargin) | |
%Get the number of function outputs. | |
% | |
% | |
%Usage: retval = n_out () | |
% | |
%retval is of type int. | |
[varargout{1:nargout}] = casadiMEX(749, self, varargin{:}); | |
end | |
function varargout = size1_in(self,varargin) | |
%Get input dimension. | |
% | |
% | |
%Usage: retval = size1_in (iname) | |
% | |
%iname is of type std::string const &. iname is of type std::string const &. retval is of type int. | |
[varargout{1:nargout}] = casadiMEX(750, self, varargin{:}); | |
end | |
function varargout = size2_in(self,varargin) | |
%Get input dimension. | |
% | |
% | |
%Usage: retval = size2_in (iname) | |
% | |
%iname is of type std::string const &. iname is of type std::string const &. retval is of type int. | |
[varargout{1:nargout}] = casadiMEX(751, self, varargin{:}); | |
end | |
function varargout = size_in(self,varargin) | |
%Get input dimension. | |
% | |
% | |
%Usage: retval = size_in (iname) | |
% | |
%iname is of type std::string const &. iname is of type std::string const &. retval is of type std::pair< int,int >. | |
[varargout{1:nargout}] = casadiMEX(752, self, varargin{:}); | |
end | |
function varargout = size1_out(self,varargin) | |
%Get output dimension. | |
% | |
% | |
%Usage: retval = size1_out (oname) | |
% | |
%oname is of type std::string const &. oname is of type std::string const &. retval is of type int. | |
[varargout{1:nargout}] = casadiMEX(753, self, varargin{:}); | |
end | |
function varargout = size2_out(self,varargin) | |
%Get output dimension. | |
% | |
% | |
%Usage: retval = size2_out (oname) | |
% | |
%oname is of type std::string const &. oname is of type std::string const &. retval is of type int. | |
[varargout{1:nargout}] = casadiMEX(754, self, varargin{:}); | |
end | |
function varargout = size_out(self,varargin) | |
%Get output dimension. | |
% | |
% | |
%Usage: retval = size_out (oname) | |
% | |
%oname is of type std::string const &. oname is of type std::string const &. retval is of type std::pair< int,int >. | |
[varargout{1:nargout}] = casadiMEX(755, self, varargin{:}); | |
end | |
function varargout = nnz_in(self,varargin) | |
%Get of number of input nonzeros For a particular input or for all for all of | |
%the inputs. | |
% | |
% | |
%Usage: retval = nnz_in (iname) | |
% | |
%iname is of type std::string const &. iname is of type std::string const &. retval is of type int. | |
[varargout{1:nargout}] = casadiMEX(756, self, varargin{:}); | |
end | |
function varargout = nnz_out(self,varargin) | |
%Get of number of output nonzeros For a particular output or for all for all | |
%of the outputs. | |
% | |
% | |
%Usage: retval = nnz_out (oname) | |
% | |
%oname is of type std::string const &. oname is of type std::string const &. retval is of type int. | |
[varargout{1:nargout}] = casadiMEX(757, self, varargin{:}); | |
end | |
function varargout = numel_in(self,varargin) | |
%Get of number of input elements For a particular input or for all for all of | |
%the inputs. | |
% | |
% | |
%Usage: retval = numel_in (iname) | |
% | |
%iname is of type std::string const &. iname is of type std::string const &. retval is of type int. | |
[varargout{1:nargout}] = casadiMEX(758, self, varargin{:}); | |
end | |
function varargout = numel_out(self,varargin) | |
%Get of number of output elements For a particular output or for all for all | |
%of the outputs. | |
% | |
% | |
%Usage: retval = numel_out (oname) | |
% | |
%oname is of type std::string const &. oname is of type std::string const &. retval is of type int. | |
[varargout{1:nargout}] = casadiMEX(759, self, varargin{:}); | |
end | |
function varargout = name_in(self,varargin) | |
%> [str] Function.name_in() const | |
%------------------------------------------------------------------------ | |
% | |
%Get input scheme. | |
% | |
%> str Function.name_in(int ind) const | |
%------------------------------------------------------------------------ | |
% | |
%Get input scheme name by index. | |
% | |
% | |
%Usage: retval = name_in (ind) | |
% | |
%ind is of type int. ind is of type int. retval is of type std::string. | |
[varargout{1:nargout}] = casadiMEX(760, self, varargin{:}); | |
end | |
function varargout = name_out(self,varargin) | |
%> [str] Function.name_out() const | |
%------------------------------------------------------------------------ | |
% | |
%Get output scheme. | |
% | |
%> str Function.name_out(int ind) const | |
%------------------------------------------------------------------------ | |
% | |
%Get output scheme name by index. | |
% | |
% | |
%Usage: retval = name_out (ind) | |
% | |
%ind is of type int. ind is of type int. retval is of type std::string. | |
[varargout{1:nargout}] = casadiMEX(761, self, varargin{:}); | |
end | |
function varargout = index_in(self,varargin) | |
%Find the index for a string describing a particular entry of an input | |
%scheme. | |
% | |
%example: schemeEntry("x_opt") -> returns NLPSOL_X if FunctionInternal | |
%adheres to SCHEME_NLPINput | |
% | |
% | |
%Usage: retval = index_in (name) | |
% | |
%name is of type std::string const &. name is of type std::string const &. retval is of type int. | |
[varargout{1:nargout}] = casadiMEX(762, self, varargin{:}); | |
end | |
function varargout = index_out(self,varargin) | |
%Find the index for a string describing a particular entry of an output | |
%scheme. | |
% | |
%example: schemeEntry("x_opt") -> returns NLPSOL_X if FunctionInternal | |
%adheres to SCHEME_NLPINput | |
% | |
% | |
%Usage: retval = index_out (name) | |
% | |
%name is of type std::string const &. name is of type std::string const &. retval is of type int. | |
[varargout{1:nargout}] = casadiMEX(763, self, varargin{:}); | |
end | |
function varargout = default_in(self,varargin) | |
%Get default input value (NOTE: constant reference) | |
% | |
% | |
%Usage: retval = default_in (ind) | |
% | |
%ind is of type int. ind is of type int. retval is of type double. | |
[varargout{1:nargout}] = casadiMEX(764, self, varargin{:}); | |
end | |
function varargout = sparsity_in(self,varargin) | |
%Get sparsity of a given input. | |
% | |
% | |
%Usage: retval = sparsity_in (iname) | |
% | |
%iname is of type std::string const &. iname is of type std::string const &. retval is of type Sparsity. | |
[varargout{1:nargout}] = casadiMEX(765, self, varargin{:}); | |
end | |
function varargout = sparsity_out(self,varargin) | |
%Get sparsity of a given output. | |
% | |
% | |
%Usage: retval = sparsity_out (iname) | |
% | |
%iname is of type std::string const &. iname is of type std::string const &. retval is of type Sparsity. | |
[varargout{1:nargout}] = casadiMEX(766, self, varargin{:}); | |
end | |
function varargout = printDimensions(self,varargin) | |
%Print dimensions of inputs and outputs. | |
% | |
% | |
%Usage: printDimensions () | |
% | |
[varargout{1:nargout}] = casadiMEX(767, self, varargin{:}); | |
end | |
function varargout = printOptions(self,varargin) | |
%Print options to a stream. | |
% | |
% | |
%Usage: printOptions () | |
% | |
[varargout{1:nargout}] = casadiMEX(768, self, varargin{:}); | |
end | |
function varargout = printOption(self,varargin) | |
%Print all information there is to know about a certain option. | |
% | |
% | |
%Usage: printOption (name) | |
% | |
%name is of type std::string const &. | |
[varargout{1:nargout}] = casadiMEX(769, self, varargin{:}); | |
end | |
function varargout = jacobian(self,varargin) | |
%Generate a Jacobian function of output oind with respect to input iind. | |
% | |
%Parameters: | |
%----------- | |
% | |
%iind: The index of the input | |
% | |
%oind: The index of the output | |
% | |
%The default behavior of this class is defined by the derived class. If | |
%compact is set to true, only the nonzeros of the input and output | |
%expressions are considered. If symmetric is set to true, the Jacobian being | |
%calculated is known to be symmetric (usually a Hessian), which can be | |
%exploited by the algorithm. | |
% | |
%The generated Jacobian has one more output than the calling function | |
%corresponding to the Jacobian and the same number of inputs. | |
% | |
% | |
%Usage: retval = jacobian (iind, oind, compact = false, symmetric = false) | |
% | |
%iind is of type std::string const &. oind is of type std::string const &. compact is of type bool. symmetric is of type bool. iind is of type std::string const &. oind is of type std::string const &. compact is of type bool. symmetric is of type bool. retval is of type Function. | |
[varargout{1:nargout}] = casadiMEX(770, self, varargin{:}); | |
end | |
function varargout = setJacobian(self,varargin) | |
%Set the Jacobian function of output oind with respect to input iind NOTE: | |
%Does not take ownership, only weak references to the Jacobians are kept | |
%internally | |
% | |
% | |
%Usage: setJacobian (jac, iind = 0, oind = 0, compact = false) | |
% | |
%jac is of type Function. iind is of type int. oind is of type int. compact is of type bool. | |
[varargout{1:nargout}] = casadiMEX(771, self, varargin{:}); | |
end | |
function varargout = gradient(self,varargin) | |
%Generate a gradient function of output oind with respect to input iind. | |
% | |
%Parameters: | |
%----------- | |
% | |
%iind: The index of the input | |
% | |
%oind: The index of the output | |
% | |
%The default behavior of this class is defined by the derived class. Note | |
%that the output must be scalar. In other cases, use the Jacobian instead. | |
% | |
% | |
%Usage: retval = gradient (iind, oind) | |
% | |
%iind is of type std::string const &. oind is of type std::string const &. iind is of type std::string const &. oind is of type std::string const &. retval is of type Function. | |
[varargout{1:nargout}] = casadiMEX(772, self, varargin{:}); | |
end | |
function varargout = tangent(self,varargin) | |
%Generate a tangent function of output oind with respect to input iind. | |
% | |
%Parameters: | |
%----------- | |
% | |
%iind: The index of the input | |
% | |
%oind: The index of the output | |
% | |
%The default behavior of this class is defined by the derived class. Note | |
%that the input must be scalar. In other cases, use the Jacobian instead. | |
% | |
% | |
%Usage: retval = tangent (iind, oind) | |
% | |
%iind is of type std::string const &. oind is of type std::string const &. iind is of type std::string const &. oind is of type std::string const &. retval is of type Function. | |
[varargout{1:nargout}] = casadiMEX(773, self, varargin{:}); | |
end | |
function varargout = hessian(self,varargin) | |
%Generate a Hessian function of output oind with respect to input iind. | |
% | |
%Parameters: | |
%----------- | |
% | |
%iind: The index of the input | |
% | |
%oind: The index of the output | |
% | |
%The generated Hessian has two more outputs than the calling function | |
%corresponding to the Hessian and the gradients. | |
% | |
% | |
%Usage: retval = hessian (iind, oind) | |
% | |
%iind is of type std::string const &. oind is of type std::string const &. iind is of type std::string const &. oind is of type std::string const &. retval is of type Function. | |
[varargout{1:nargout}] = casadiMEX(774, self, varargin{:}); | |
end | |
function varargout = fullJacobian(self,varargin) | |
%Generate a Jacobian function of all the inputs elements with respect to all | |
%the output elements). | |
% | |
% | |
%Usage: retval = fullJacobian () | |
% | |
%retval is of type Function. | |
[varargout{1:nargout}] = casadiMEX(775, self, varargin{:}); | |
end | |
function varargout = setFullJacobian(self,varargin) | |
%Set the Jacobian of all the input nonzeros with respect to all output | |
%nonzeros NOTE: Does not take ownership, only weak references to the Jacobian | |
%are kept internally | |
% | |
% | |
%Usage: setFullJacobian (jac) | |
% | |
%jac is of type Function. | |
[varargout{1:nargout}] = casadiMEX(776, self, varargin{:}); | |
end | |
function varargout = call(self,varargin) | |
%Evaluate the function symbolically or numerically. | |
% | |
% | |
%Usage: call (arg, always_inline = false, never_inline = false) | |
% | |
%arg is of type casadi::MXDict const &. always_inline is of type bool. never_inline is of type bool. | |
[varargout{1:nargout}] = casadiMEX(777, self, varargin{:}); | |
end | |
function varargout = mapsum(self,varargin) | |
%Evaluate symbolically in parallel and sum (matrix graph) | |
% | |
%Parameters: | |
%----------- | |
% | |
%parallelization: Type of parallelization used: unroll|serial|openmp | |
% | |
% | |
%Usage: retval = mapsum (arg, parallelization = "serial") | |
% | |
%arg is of type std::vector< casadi::MX,std::allocator< casadi::MX > > const &. parallelization is of type std::string const &. arg is of type std::vector< casadi::MX,std::allocator< casadi::MX > > const &. parallelization is of type std::string const &. retval is of type std::vector< casadi::MX,std::allocator< casadi::MX > >. | |
[varargout{1:nargout}] = casadiMEX(778, self, varargin{:}); | |
end | |
function varargout = mapaccum(self,varargin) | |
%Create a mapaccumulated version of this function. | |
% | |
%Suppose the function has a signature of: | |
% | |
%:: | |
% | |
% f: (x, u) -> (x_next , y ) | |
% | |
% | |
% | |
% | |
%The the mapaccumulated version has the signature: | |
% | |
%:: | |
% | |
% F: (x0, U) -> (X , Y ) | |
% | |
% with | |
% U: horzcat([u0, u1, ..., u_(N-1)]) | |
% X: horzcat([x1, x2, ..., x_N]) | |
% Y: horzcat([y0, y1, ..., y_(N-1)]) | |
% | |
% and | |
% x1, y0 <- f(x0, u0) | |
% x2, y1 <- f(x1, u1) | |
% ... | |
% x_N, y_(N-1) <- f(x_(N-1), u_(N-1)) | |
% | |
% | |
% | |
% | |
% | |
%Usage: retval = mapaccum (name, n, accum_in, accum_out, opts = casadi::Dict()) | |
% | |
%name is of type std::string const &. n is of type int. accum_in is of type std::vector< int,std::allocator< int > > const &. accum_out is of type std::vector< int,std::allocator< int > > const &. opts is of type casadi::Dict const &. name is of type std::string const &. n is of type int. accum_in is of type std::vector< int,std::allocator< int > > const &. accum_out is of type std::vector< int,std::allocator< int > > const &. opts is of type casadi::Dict const &. retval is of type Function. | |
[varargout{1:nargout}] = casadiMEX(779, self, varargin{:}); | |
end | |
function varargout = map(self,varargin) | |
%> Function Function.map(str name, str parallelization, int n, [int ] reduce_in, [int ] reduce_out, Dict opts=Dict()) | |
% | |
%> Function Function.map(str name, str parallelization, int n, Dict opts=Dict()) | |
%------------------------------------------------------------------------ | |
% | |
%Create a mapped version of this function. | |
% | |
%Suppose the function has a signature of: | |
% | |
%:: | |
% | |
% f: (a, p) -> ( s ) | |
% | |
% | |
% | |
% | |
%The the mapaccumulated version has the signature: | |
% | |
%:: | |
% | |
% F: (A, P) -> (S ) | |
% | |
% with | |
% A: horzcat([a0, a1, ..., a_(N-1)]) | |
% P: horzcat([p0, p1, ..., p_(N-1)]) | |
% S: horzcat([s0, s1, ..., s_(N-1)]) | |
% and | |
% s0 <- f(a0, p0) | |
% s1 <- f(a1, p1) | |
% ... | |
% s_(N-1) <- f(a_(N-1), p_(N-1)) | |
% | |
% | |
% | |
% | |
%Parameters: | |
%----------- | |
% | |
%parallelization: Type of parallelization used: unroll|serial|openmp | |
% | |
%> [MX] Function.map([MX ] arg, str parallelization="serial") | |
% | |
%> std.map<str, MX> Function.map(const std.map< str, MX > &arg, str parallelization="serial") | |
%------------------------------------------------------------------------ | |
% | |
%Evaluate symbolically in parallel (matrix graph) | |
% | |
%Parameters: | |
%----------- | |
% | |
%parallelization: Type of parallelization used: unroll|serial|openmp | |
% | |
% | |
%Usage: retval = map (name, parallelization, n, opts = casadi::Dict()) | |
% | |
%name is of type std::string const &. parallelization is of type std::string const &. n is of type int. opts is of type casadi::Dict const &. name is of type std::string const &. parallelization is of type std::string const &. n is of type int. opts is of type casadi::Dict const &. retval is of type Function. | |
[varargout{1:nargout}] = casadiMEX(780, self, varargin{:}); | |
end | |
function varargout = slice(self,varargin) | |
%returns a new function with a selection of inputs/outputs of the original | |
% | |
% | |
%Usage: retval = slice (order_in, order_out, opts = casadi::Dict()) | |
% | |
%order_in is of type std::vector< int,std::allocator< int > > const &. order_out is of type std::vector< int,std::allocator< int > > const &. opts is of type casadi::Dict const &. order_in is of type std::vector< int,std::allocator< int > > const &. order_out is of type std::vector< int,std::allocator< int > > const &. opts is of type casadi::Dict const &. retval is of type Function. | |
[varargout{1:nargout}] = casadiMEX(781, self, varargin{:}); | |
end | |
function varargout = kernel_sum(self,varargin) | |
%kernel_sum Consider a dense matrix V. | |
% | |
%KernelSum computes | |
% | |
%F(V,X) = sum_i sum_j f ( [i;j], V(i,j), X) | |
% | |
%with X: [x;y] | |
% | |
%where the summation is taken for all entries (i,j) that are a distance r | |
%away from X. | |
% | |
%This function assumes that V is fixed: sensitivities with respect to it are | |
%not computed. | |
% | |
%This allows for improved speed of evaluation. | |
% | |
%Having V fixed is a common use case: V may be a large bitmap (observation), | |
%onto which a kernel is fitted. | |
% | |
%Joris Gillis | |
% | |
% | |
%Usage: retval = kernel_sum (name, size, r, n, opts = casadi::Dict()) | |
% | |
%name is of type std::string const &. size is of type std::pair< int,int > const &. r is of type double. n is of type int. opts is of type casadi::Dict const &. name is of type std::string const &. size is of type std::pair< int,int > const &. r is of type double. n is of type int. opts is of type casadi::Dict const &. retval is of type Function. | |
[varargout{1:nargout}] = casadiMEX(784, self, varargin{:}); | |
end | |
function varargout = derivative(self,varargin) | |
%> void Function.derivative([DM] arg, [DM] &output_res, [DMVector] fseed, [DMVector] &output_fsens, [DMVector] aseed, [DMVector] &output_asens, bool always_inline=false, bool never_inline=false) | |
% | |
%> void Function.derivative([SX] arg, [SX] &output_res, [SXVector] fseed, [SXVector] &output_fsens, [SXVector] aseed, [SXVector] &output_asens, bool always_inline=false, bool never_inline=false) | |
% | |
%> void Function.derivative([MX] arg, [MX] &output_res, [MXVector] fseed, [MXVector] &output_fsens, [MXVector] aseed, [MXVector] &output_asens, bool always_inline=false, bool never_inline=false) | |
%------------------------------------------------------------------------ | |
%[INTERNAL] | |
%Evaluate the function symbolically or numerically with directional | |
%derivatives The first two arguments are the nondifferentiated inputs | |
%and results of the evaluation, the next two arguments are a set of | |
%forward directional seeds and the resulting forward directional | |
%derivatives, the length of the vector being the number of forward | |
%directions. The next two arguments are a set of adjoint directional | |
%seeds and the resulting adjoint directional derivatives, the length of | |
%the vector being the number of adjoint directions. | |
% | |
%> Function Function.derivative(int nfwd, int nadj) | |
%------------------------------------------------------------------------ | |
% | |
%Get a function that calculates nfwd forward derivatives and nadj adjoint | |
%derivatives Legacy function: Use forward and reverse instead. | |
% | |
%Returns a function with (1+nfwd)*n_in+nadj*n_out inputs and (1+nfwd)*n_out + | |
%nadj*n_in outputs. The first n_in inputs correspond to nondifferentiated | |
%inputs. The next nfwd*n_in inputs correspond to forward seeds, one direction | |
%at a time and the last nadj*n_out inputs correspond to adjoint seeds, one | |
%direction at a time. The first n_out outputs correspond to nondifferentiated | |
%outputs. The next nfwd*n_out outputs correspond to forward sensitivities, | |
%one direction at a time and the last nadj*n_in outputs corresponds to | |
%adjoint sensitivities, one direction at a time. | |
% | |
%(n_in = n_in(), n_out = n_out()) | |
% | |
% | |
%Usage: retval = derivative (nfwd, nadj) | |
% | |
%nfwd is of type int. nadj is of type int. nfwd is of type int. nadj is of type int. retval is of type Function. | |
[varargout{1:nargout}] = casadiMEX(785, self, varargin{:}); | |
end | |
function varargout = forward(self,varargin) | |
%> void Function.forward([MX ] arg, [MX ] res, [[MX ] ] fseed,[[MX ] ] output_fsens, bool always_inline=false, bool never_inline=false) | |
% | |
%> void Function.forward([SX ] arg, [SX ] res, [[SX ] ] fseed,[[SX ] ] output_fsens, bool always_inline=false, bool never_inline=false) | |
% | |
%> void Function.forward([DM ] arg, [DM ] res, [[DM ] ] fseed,[[DM ] ] output_fsens, bool always_inline=false, bool never_inline=false) | |
%------------------------------------------------------------------------ | |
% | |
%Create call to (cached) derivative function, forward mode. | |
% | |
%> Function Function.forward(int nfwd) | |
%------------------------------------------------------------------------ | |
% | |
%Get a function that calculates nfwd forward derivatives. | |
% | |
%Returns a function with n_in + n_out +nfwd*n_in inputs and nfwd*n_out | |
%outputs. The first n_in inputs correspond to nondifferentiated inputs. The | |
%next n_out inputs correspond to nondifferentiated outputs. and the last | |
%nfwd*n_in inputs correspond to forward seeds, one direction at a time The | |
%nfwd*n_out outputs correspond to forward sensitivities, one direction at a | |
%time. * (n_in = n_in(), n_out = n_out()) | |
% | |
%The functions returned are cached, meaning that if called multiple timed | |
%with the same value, then multiple references to the same function will be | |
%returned. | |
% | |
% | |
%Usage: retval = forward (nfwd) | |
% | |
%nfwd is of type int. nfwd is of type int. retval is of type Function. | |
[varargout{1:nargout}] = casadiMEX(786, self, varargin{:}); | |
end | |
function varargout = reverse(self,varargin) | |
%> void Function.reverse([MX ] arg, [MX ] res, [[MX ] ] aseed,[[MX ] ] output_asens, bool always_inline=false, bool never_inline=false) | |
% | |
%> void Function.reverse([SX ] arg, [SX ] res, [[SX ] ] aseed,[[SX ] ] output_asens, bool always_inline=false, bool never_inline=false) | |
% | |
%> void Function.reverse([DM ] arg, [DM ] res, [[DM ] ] aseed,[[DM ] ] output_asens, bool always_inline=false, bool never_inline=false) | |
%------------------------------------------------------------------------ | |
% | |
%Create call to (cached) derivative function, reverse mode. | |
% | |
%> Function Function.reverse(int nadj) | |
%------------------------------------------------------------------------ | |
% | |
%Get a function that calculates nadj adjoint derivatives. | |
% | |
%Returns a function with n_in + n_out +nadj*n_out inputs and nadj*n_in | |
%outputs. The first n_in inputs correspond to nondifferentiated inputs. The | |
%next n_out inputs correspond to nondifferentiated outputs. and the last | |
%nadj*n_out inputs correspond to adjoint seeds, one direction at a time The | |
%nadj*n_in outputs correspond to adjoint sensitivities, one direction at a | |
%time. * (n_in = n_in(), n_out = n_out()) | |
% | |
%(n_in = n_in(), n_out = n_out()) | |
% | |
%The functions returned are cached, meaning that if called multiple timed | |
%with the same value, then multiple references to the same function will be | |
%returned. | |
% | |
% | |
%Usage: retval = reverse (nadj) | |
% | |
%nadj is of type int. nadj is of type int. retval is of type Function. | |
[varargout{1:nargout}] = casadiMEX(787, self, varargin{:}); | |
end | |
function varargout = set_forward(self,varargin) | |
%Set a function that calculates nfwd forward derivatives NOTE: Does not take | |
%ownership, only weak references to the derivatives are kept internally. | |
% | |
% | |
%Usage: set_forward (fcn, nfwd) | |
% | |
%fcn is of type Function. nfwd is of type int. | |
[varargout{1:nargout}] = casadiMEX(788, self, varargin{:}); | |
end | |
function varargout = set_reverse(self,varargin) | |
%Set a function that calculates nadj adjoint derivatives NOTE: Does not take | |
%ownership, only weak references to the derivatives are kept internally. | |
% | |
% | |
%Usage: set_reverse (fcn, nadj) | |
% | |
%fcn is of type Function. nadj is of type int. | |
[varargout{1:nargout}] = casadiMEX(789, self, varargin{:}); | |
end | |
function varargout = sparsity_jac(self,varargin) | |
%Get, if necessary generate, the sparsity of a Jacobian block | |
% | |
% | |
%Usage: retval = sparsity_jac (iind, oind, compact = false, symmetric = false) | |
% | |
%iind is of type std::string const &. oind is of type std::string const &. compact is of type bool. symmetric is of type bool. iind is of type std::string const &. oind is of type std::string const &. compact is of type bool. symmetric is of type bool. retval is of type Sparsity. | |
[varargout{1:nargout}] = casadiMEX(790, self, varargin{:}); | |
end | |
function varargout = set_jac_sparsity(self,varargin) | |
%Generate the sparsity of a Jacobian block | |
% | |
% | |
%Usage: set_jac_sparsity (sp, iind, oind, compact = false) | |
% | |
%sp is of type Sparsity. iind is of type std::string const &. oind is of type std::string const &. compact is of type bool. | |
[varargout{1:nargout}] = casadiMEX(791, self, varargin{:}); | |
end | |
function varargout = generate(self,varargin) | |
%Export / Generate C code for the function. | |
% | |
% | |
%Usage: generate (opts = casadi::Dict()) | |
% | |
%opts is of type casadi::Dict const &. | |
[varargout{1:nargout}] = casadiMEX(792, self, varargin{:}); | |
end | |
function varargout = generate_dependencies(self,varargin) | |
%Export / Generate C code for the dependency function. | |
% | |
% | |
%Usage: generate_dependencies (fname, opts = casadi::Dict()) | |
% | |
%fname is of type std::string const &. opts is of type casadi::Dict const &. | |
[varargout{1:nargout}] = casadiMEX(793, self, varargin{:}); | |
end | |
function varargout = stats(self,varargin) | |
%Get all statistics obtained at the end of the last evaluate call. | |
% | |
% | |
%Usage: retval = stats (mem = 0) | |
% | |
%mem is of type int. mem is of type int. retval is of type casadi::Dict. | |
[varargout{1:nargout}] = casadiMEX(794, self, varargin{:}); | |
end | |
function varargout = sx_in(self,varargin) | |
%Get symbolic primitives equivalent to the input expressions There is no | |
%guarantee that subsequent calls return unique answers. | |
% | |
% | |
%Usage: retval = sx_in () | |
% | |
%retval is of type std::vector< casadi::SX,std::allocator< casadi::SX > > const. | |
[varargout{1:nargout}] = casadiMEX(795, self, varargin{:}); | |
end | |
function varargout = mx_in(self,varargin) | |
%Get symbolic primitives equivalent to the input expressions There is no | |
%guarantee that subsequent calls return unique answers. | |
% | |
% | |
%Usage: retval = mx_in () | |
% | |
%retval is of type std::vector< casadi::MX,std::allocator< casadi::MX > > const. | |
[varargout{1:nargout}] = casadiMEX(796, self, varargin{:}); | |
end | |
function varargout = sx_out(self,varargin) | |
%Get symbolic primitives equivalent to the output expressions There is no | |
%guarantee that subsequent calls return unique answers. | |
% | |
% | |
%Usage: retval = sx_out () | |
% | |
%retval is of type std::vector< casadi::SX,std::allocator< casadi::SX > > const. | |
[varargout{1:nargout}] = casadiMEX(797, self, varargin{:}); | |
end | |
function varargout = mx_out(self,varargin) | |
%Get symbolic primitives equivalent to the output expressions There is no | |
%guarantee that subsequent calls return unique answers. | |
% | |
% | |
%Usage: retval = mx_out () | |
% | |
%retval is of type std::vector< casadi::MX,std::allocator< casadi::MX > > const. | |
[varargout{1:nargout}] = casadiMEX(798, self, varargin{:}); | |
end | |
function varargout = free_sx(self,varargin) | |
%Get all the free variables of the function. | |
% | |
% | |
%Usage: retval = free_sx () | |
% | |
%retval is of type SX. | |
[varargout{1:nargout}] = casadiMEX(799, self, varargin{:}); | |
end | |
function varargout = free_mx(self,varargin) | |
%Get all the free variables of the function. | |
% | |
% | |
%Usage: retval = free_mx () | |
% | |
%retval is of type std::vector< casadi::MX,std::allocator< casadi::MX > >. | |
[varargout{1:nargout}] = casadiMEX(800, self, varargin{:}); | |
end | |
function varargout = has_free(self,varargin) | |
%Does the function have free variables. | |
% | |
% | |
%Usage: retval = has_free () | |
% | |
%retval is of type bool. | |
[varargout{1:nargout}] = casadiMEX(801, self, varargin{:}); | |
end | |
function varargout = generate_lifted(self,varargin) | |
%Extract the functions needed for the Lifted Newton method. | |
% | |
% | |
%Usage: generate_lifted () | |
% | |
[varargout{1:nargout}] = casadiMEX(802, self, varargin{:}); | |
end | |
function varargout = getAlgorithmSize(self,varargin) | |
%Get the number of atomic operations. | |
% | |
% | |
%Usage: retval = getAlgorithmSize () | |
% | |
%retval is of type int. | |
[varargout{1:nargout}] = casadiMEX(803, self, varargin{:}); | |
end | |
function varargout = getWorkSize(self,varargin) | |
%Get the length of the work vector. | |
% | |
% | |
%Usage: retval = getWorkSize () | |
% | |
%retval is of type int. | |
[varargout{1:nargout}] = casadiMEX(804, self, varargin{:}); | |
end | |
function varargout = getAtomicOperation(self,varargin) | |
%Get an atomic operation operator index. | |
% | |
% | |
%Usage: retval = getAtomicOperation (k) | |
% | |
%k is of type int. k is of type int. retval is of type int. | |
[varargout{1:nargout}] = casadiMEX(805, self, varargin{:}); | |
end | |
function varargout = getAtomicInput(self,varargin) | |
%Get the (integer) input arguments of an atomic operation. | |
% | |
% | |
%Usage: retval = getAtomicInput (k) | |
% | |
%k is of type int. k is of type int. retval is of type std::pair< int,int >. | |
[varargout{1:nargout}] = casadiMEX(806, self, varargin{:}); | |
end | |
function varargout = getAtomicInputReal(self,varargin) | |
%Get the floating point output argument of an atomic operation. | |
% | |
% | |
%Usage: retval = getAtomicInputReal (k) | |
% | |
%k is of type int. k is of type int. retval is of type double. | |
[varargout{1:nargout}] = casadiMEX(807, self, varargin{:}); | |
end | |
function varargout = getAtomicOutput(self,varargin) | |
%Get the (integer) output argument of an atomic operation. | |
% | |
% | |
%Usage: retval = getAtomicOutput (k) | |
% | |
%k is of type int. k is of type int. retval is of type int. | |
[varargout{1:nargout}] = casadiMEX(808, self, varargin{:}); | |
end | |
function varargout = n_nodes(self,varargin) | |
%Number of nodes in the algorithm. | |
% | |
% | |
%Usage: retval = n_nodes () | |
% | |
%retval is of type int. | |
[varargout{1:nargout}] = casadiMEX(809, self, varargin{:}); | |
end | |
function varargout = spCanEvaluate(self,varargin) | |
%[INTERNAL] Is the | |
%class able to propagate seeds through the algorithm? | |
% | |
%(for usage, see the example propagating_sparsity.cpp) | |
% | |
% | |
%Usage: retval = spCanEvaluate (fwd) | |
% | |
%fwd is of type bool. fwd is of type bool. retval is of type bool. | |
[varargout{1:nargout}] = casadiMEX(810, self, varargin{:}); | |
end | |
function varargout = sz_arg(self,varargin) | |
%[INTERNAL] Get required | |
%length of arg field. | |
% | |
% | |
%Usage: retval = sz_arg () | |
% | |
%retval is of type size_t. | |
[varargout{1:nargout}] = casadiMEX(811, self, varargin{:}); | |
end | |
function varargout = sz_res(self,varargin) | |
%[INTERNAL] Get required | |
%length of res field. | |
% | |
% | |
%Usage: retval = sz_res () | |
% | |
%retval is of type size_t. | |
[varargout{1:nargout}] = casadiMEX(812, self, varargin{:}); | |
end | |
function varargout = sz_iw(self,varargin) | |
%[INTERNAL] Get required | |
%length of iw field. | |
% | |
% | |
%Usage: retval = sz_iw () | |
% | |
%retval is of type size_t. | |
[varargout{1:nargout}] = casadiMEX(813, self, varargin{:}); | |
end | |
function varargout = sz_w(self,varargin) | |
%[INTERNAL] Get required | |
%length of w field. | |
% | |
% | |
%Usage: retval = sz_w () | |
% | |
%retval is of type size_t. | |
[varargout{1:nargout}] = casadiMEX(814, self, varargin{:}); | |
end | |
function varargout = addMonitor(self,varargin) | |
%Add modules to be monitored. | |
% | |
% | |
%Usage: addMonitor (mon) | |
% | |
%mon is of type std::string const &. | |
[varargout{1:nargout}] = casadiMEX(815, self, varargin{:}); | |
end | |
function varargout = removeMonitor(self,varargin) | |
%Remove modules to be monitored. | |
% | |
% | |
%Usage: removeMonitor (mon) | |
% | |
%mon is of type std::string const &. | |
[varargout{1:nargout}] = casadiMEX(816, self, varargin{:}); | |
end | |
function varargout = checkInputs(self,varargin) | |
%[INTERNAL] Check if | |
%the numerical values of the supplied bounds make sense. | |
% | |
% | |
%Usage: checkInputs () | |
% | |
[varargout{1:nargout}] = casadiMEX(817, self, varargin{:}); | |
end | |
function varargout = name(self,varargin) | |
%Name of the function. | |
% | |
% | |
%Usage: retval = name () | |
% | |
%retval is of type std::string. | |
[varargout{1:nargout}] = casadiMEX(818, self, varargin{:}); | |
end | |
function varargout = type_name(self,varargin) | |
%Get type name. | |
% | |
% | |
%Usage: retval = type_name () | |
% | |
%retval is of type std::string. | |
[varargout{1:nargout}] = casadiMEX(819, self, varargin{:}); | |
end | |
function varargout = is_a(self,varargin) | |
%Check if the function is of a particular type Optionally check if name | |
%matches one of the base classes (default true) | |
% | |
% | |
%Usage: retval = is_a (type, recursive = true) | |
% | |
%type is of type std::string const &. recursive is of type bool. type is of type std::string const &. recursive is of type bool. retval is of type bool. | |
[varargout{1:nargout}] = casadiMEX(820, self, varargin{:}); | |
end | |
function varargout = checkout(self,varargin) | |
%Checkout a memory object. | |
% | |
% | |
%Usage: retval = checkout () | |
% | |
%retval is of type int. | |
[varargout{1:nargout}] = casadiMEX(823, self, varargin{:}); | |
end | |
function varargout = release(self,varargin) | |
%Release a memory object. | |
% | |
% | |
%Usage: release (mem) | |
% | |
%mem is of type int. | |
[varargout{1:nargout}] = casadiMEX(824, self, varargin{:}); | |
end | |
function varargout = linsol_solve(self,varargin) | |
%Create a solve node. | |
% | |
% | |
%Usage: retval = linsol_solve (A, B, tr = false) | |
% | |
%A is of type MX. B is of type MX. tr is of type bool. A is of type MX. B is of type MX. tr is of type bool. retval is of type MX. | |
[varargout{1:nargout}] = casadiMEX(825, self, varargin{:}); | |
end | |
function varargout = linsol_cholesky_sparsity(self,varargin) | |
%Obtain a symbolic Cholesky factorization Only for Cholesky solvers. | |
% | |
% | |
%Usage: retval = linsol_cholesky_sparsity (tr = false, mem = 0) | |
% | |
%tr is of type bool. mem is of type int. tr is of type bool. mem is of type int. retval is of type Sparsity. | |
[varargout{1:nargout}] = casadiMEX(826, self, varargin{:}); | |
end | |
function varargout = linsol_cholesky(self,varargin) | |
%Obtain a numeric Cholesky factorization Only for Cholesky solvers. | |
% | |
% | |
%Usage: retval = linsol_cholesky (tr = false, mem = 0) | |
% | |
%tr is of type bool. mem is of type int. tr is of type bool. mem is of type int. retval is of type DM. | |
[varargout{1:nargout}] = casadiMEX(827, self, varargin{:}); | |
end | |
function varargout = rootfinder_fun(self,varargin) | |
%Access rhs function for a rootfinder. | |
% | |
% | |
%Usage: retval = rootfinder_fun () | |
% | |
%retval is of type Function. | |
[varargout{1:nargout}] = casadiMEX(828, self, varargin{:}); | |
end | |
function varargout = rootfinder_jac(self,varargin) | |
%Access Jacobian of the ths function for a rootfinder. | |
% | |
% | |
%Usage: retval = rootfinder_jac () | |
% | |
%retval is of type Function. | |
[varargout{1:nargout}] = casadiMEX(829, self, varargin{:}); | |
end | |
function varargout = rootfinder_linsol(self,varargin) | |
%Access linear solver of a rootfinder. | |
% | |
% | |
%Usage: retval = rootfinder_linsol () | |
% | |
%retval is of type Function. | |
[varargout{1:nargout}] = casadiMEX(830, self, varargin{:}); | |
end | |
function varargout = integrator_dae(self,varargin) | |
%Get the DAE for an integrator. | |
% | |
% | |
%Usage: retval = integrator_dae () | |
% | |
%retval is of type Function. | |
[varargout{1:nargout}] = casadiMEX(831, self, varargin{:}); | |
end | |
function varargout = qpsol_debug(self,varargin) | |
%Generate native code in the interfaced language for debugging | |
% | |
% | |
%Usage: qpsol_debug (file) | |
% | |
%file is of type std::ostream &. | |
[varargout{1:nargout}] = casadiMEX(832, self, varargin{:}); | |
end | |
function varargout = paren(self, varargin) | |
if nargin==1 || (nargin>=2 && ischar(varargin{1})) | |
% Named inputs: return struct | |
assert(nargout<2, 'Syntax error'); | |
assert(mod(nargin,2)==1, 'Syntax error'); | |
arg = struct; | |
for i=1:2:nargin-1 | |
assert(ischar(varargin{i}), 'Syntax error'); | |
arg.(varargin{i}) = varargin{i+1}; | |
end | |
res = self.call(arg); | |
varargout{1} = res; | |
else | |
% Ordered inputs: return variable number of outputs | |
res = self.call(varargin); | |
assert(nargout<=numel(res), 'Too many outputs'); | |
for i=1:max(min(1,numel(res)),nargout) | |
varargout{i} = res{i}; | |
end | |
end | |
end | |
function self = Function(varargin) | |
[email protected](SwigRef.Null); | |
if nargin==1 && strcmp(class(varargin{1}),'SwigRef') | |
if varargin{1}~=SwigRef.Null | |
self.swigPtr = varargin{1}.swigPtr; | |
end | |
else | |
tmp = casadiMEX(833, varargin{:}); | |
self.swigPtr = tmp.swigPtr; | |
tmp.swigPtr = []; | |
end | |
end | |
end | |
methods(Static) | |
function varargout = conditional(varargin) | |
%Usage: retval = conditional (name, f, f_def, opts = casadi::Dict()) | |
% | |
%name is of type std::string const &. f is of type std::vector< casadi::Function,std::allocator< casadi::Function > > const &. f_def is of type Function. opts is of type casadi::Dict const &. name is of type std::string const &. f is of type std::vector< casadi::Function,std::allocator< casadi::Function > > const &. f_def is of type Function. opts is of type casadi::Dict const &. retval is of type Function. | |
[varargout{1:nargout}] = casadiMEX(782, varargin{:}); | |
end | |
function varargout = if_else(varargin) | |
%Usage: retval = if_else (name, f_true, f_false, opts = casadi::Dict()) | |
% | |
%name is of type std::string const &. f_true is of type Function. f_false is of type Function. opts is of type casadi::Dict const &. name is of type std::string const &. f_true is of type Function. f_false is of type Function. opts is of type casadi::Dict const &. retval is of type Function. | |
[varargout{1:nargout}] = casadiMEX(783, varargin{:}); | |
end | |
function varargout = check_name(varargin) | |
%Usage: retval = check_name (name) | |
% | |
%name is of type std::string const &. name is of type std::string const &. retval is of type bool. | |
[varargout{1:nargout}] = casadiMEX(821, varargin{:}); | |
end | |
function varargout = fix_name(varargin) | |
%Usage: retval = fix_name (name) | |
% | |
%name is of type std::string const &. name is of type std::string const &. retval is of type std::string. | |
[varargout{1:nargout}] = casadiMEX(822, varargin{:}); | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment