gph_plq — Convert a standard PLQ model to a PLQ subdifferential model.
gph = gph_plq(plq)
Converts a PLQ function into a matrix representing its subdifferential by storing points on the subdifferential's graph, as well as the values of the original function, in order to be able to integrate.
This function runs in linear time with respect to the number of pieces in the PLQ function.
// The absolute-value function. plq = [0,0,-1,0; %inf,0,1,0]; gph = gph_plq(plq), // gph = // // - 1. 0. 0. 1. // - 1. - 1. 1. 1. // 1. 0. 0. 1. // A "\_/" function. plq = [0,0,-1,0; 1,0,0,0; %inf,0,1,-1]; gph = gph_plq(plq), // gph = // // - 1. 0. 0. 1. 1. 2. // - 1. - 1. 0. 0. 1. 1. // 1. 0. 0. 0. 0. 1.