tbpsg_function_gradient function calculates PSG function (see PSG Function) gradient on a PSG point.

 

Syntax

[val] = tbpsg_function_gradient(func_descr, point_name, toolboxstruc_arr)

 

Description

[val] = tbpsg_function_gradient(func_descr, point_name, toolboxstruc_arr) returns vector with gradient of function described in func_descr on PSG point point_name (see PSG Point in MATLAB) with data packed in structure toolboxstruc_arr (see PSG Data Objects in MATLAB).

 

Input Arguments

func_descr

string with description of PSG function (see PSG Function);

point_name

name of PSG point (see PSG Point in MATLAB);

toolboxstruc_arr

array of PSG data structures (see PSG Data Objects in MATLAB).

 

Output Arguments

val

vector with function gradient.

 

Remarks

toolboxstruc_arr should contain all matrices from func_descr as well as point named point_name.
tbpsg_function_gradient does not calculate gradient of the Linear Multiple function.

 

Example

Input data:

H1 = [1 4 8 3;7 -5 4 -6;-2 8 -1 0;0 -3 -4 9];

c1 = [-2;11;6;10];

p1 = [0.2;0.2;0.3;0.3];

a = [1;1;1;1];

alpha = 0.65;

To pack matrix, point and parameter to array of structures "toolboxstruc_arr":

toolboxstruc_arr(1) = tbpsg_matrix_pack('matrix_1', H1, [],  c1, p1);

toolboxstruc_arr(2) = tbpsg_point_pack('point_1', a, []);

toolboxstruc_arr(3) = tbpsg_parameter_pack('parameter_alpha', alpha);

Calculate gradient of cvar_risk function with parameter 0.65 at point 'point_1':

val = tbpsg_function_gradient('cvar_risk(parameter_alpha,matrix_1)','point_1',toolboxstruc_arr);

Output:

val =

  -4.0000    4.1429   -0.5714   -0.4286

 

 

See also

Table (List) of Functions

tbpsg_function_value, tbpsg_function_increment,tbpsg_loss_values