plq_gph — Convert a PLQ subdifferential model to a standard PLQ model.
plq = plq_gph(gph)
Converts the graph of the subdifferential of a PLQ function into the corresponding PLQ data structure. Uses the value of the function stored at each x value in gph and integrates across each segment.
This function runs in linear time with respect to the number of points in the input graph.
// The indicator function I_[-1,1]. // Defined to be 0 inside [-1,1] and %inf outside. gph = [-1, -1, 1, 1; .. -1, 0, 0, 1; .. %inf, 0, 0, %inf]; plq = plq_gph(gph), // plq = // // - 1. 0. 0. Inf // 1. 0. 0. 0. // Inf 0. 0. Inf // A PLQ function: // x in [-1,1]: 0 // otherwise: x^2 - 1 gph = [-2, -1, -1, 1, 1, 2; .. -4, -2, 0, 0, 2, 4; .. 3, 0, 0, 0, 0, 3]; plq = plq_gph(gph), // plq = // // - 1. 1. 0. - 1. // 1. 0. 0. 0. // Inf 1. 0. - 1.