<< plq_dom plq plq_fitzinf0 >>

CCA (Computational Convex Analysis) >> plq > plq_eval

plq_eval

Piecewise linear quadratic (plq), evaluate a plq function on a grid

Calling Sequence

[y, k] = plq_eval(plqf,X)

Parameters

plqf

matrix. A plq function with dimensions n x 4.

X

column vector. A grid of points on which the function is sampled.

y

column vector. A grid of points on which the plq function is evaluated on.

k

matrix. A 3 x n matrix with information about which pieces of the plq function contained which X points.

Description

Evaluates a plq function on a grid. This function is necessary as it allows the plq functions to be simplified into more manageable data with scilab functions such as plotting.

k is a matrix shaped like the following, with a column for each unique piece of the plq function an X value was in. For the i'th unique piece, the values X(L(i):R(i)) were evaluated using the I(i)'th row of the plq function.

Examples

//Example 1
X=[1;2;4;5;7;8;9];
plqf=[3,0.5,0,0;6,0,0,0;%inf,0,1,0];
[y,k] = plq_eval(plqf,X);

//Example 2
x=linspace(0,4)';
plqf = build_plq(x,exp,exp);
y=plq_eval(plqf,x);

See Also

Authors

Yves Lucet, University of British Columbia, BC, Canada

<< plq_dom plq plq_fitzinf0 >>