The Function
object is the top-level class for representation of functions. It stores a function handle and the data corresponding to the function. The function handle is a Matlab concept for representing functions (see help function_handle
) which has been adopted in the Function
object.
As an example, consider a function y = 2*x that can be represented as anonymous function y = @(x) 2*x
in Matlab. The Function
object can be created as follows
which accepts the function handle as an argument. Arbitrary user data can be stored with the function which are provided as a second argument. For instance,
The user data can be employed for parametrization of the function. Consider a function y=p(1)*x(1)^2 + p(2)*x(2) + p(3)
that is parametrized in the variable "p" that can be modified. The Function
object can be constructed by pointing to the parameters in the user data. Note that the object must be constructed first in order to refer to the stored data as shown here:
To evaluate the function stored in the Function
for a particular value of the point x=[1;1]
, one can use an overloaded feval
method
By changing the parameters, the function value changes as well
The AffFunction
object represents an affine function in the form y = F*x + g
. It stores data of the matrices F
, and g
as properties of the object. To create an affine function one has to provide the corresponding matrices, e.g.
The stored matrices are accessible in the appropriate fields:
After construction of the object, the function can be evaluated using feval
method inherited from Function
class. For instance, the value of the function for the point x=[1;1]
can be obtained as
Based on the dimensions of the input matrices F
, and g
, the domain and range of the affine function can be determined. The dimension of the domain space can be retrieved by referring to D
property
and the range by referring to R
property
If no matrix g
is provided as input, it is considered as zero-value, e.g.
The QuadFunction
object represents quadratic functions in the form y = x'*H*x + F*x + g
. It stores data of the matrices H
, F
, and g
as properties of the object. To create a quadratic function one has to provide the corresponding matrices, e.g.
The matrices can be accessed by referring to the properties with the same name:
Evaluation of the function is achieved by feval
method for a particular value of a point, e.g.
The dimensions of the domain and range are accessible from D
and R
property:
Object can be constructed without providing the matrices F
, and g
. In this case the values for the matrices F
, and g
are considered as zeros:
The InfNormFunction
object represents a function y = max( abs(Q*x) )
that returns always positive values. The object can be constructed by providing the matrix Q
as an argument
and is useful for representing a performance criterion. The evaluation of the function is achieved via feval
method, i.e.
The OneNormFunction
object represents a function y = sum( abs(Q*x) )
that returns always positive values. The object can be constructed by providing the matrix Q
as an argument
and is useful for representing a performance criterion. Function evaluation proceeds via overloaded feval
method that applies for all objects derived from Function
class.
Back to Computational geometry overview.