Scilab Function
Last update : 5/5/2008

plq_clean - Piecewise linear quadratic (plq), clears duplicate rows

Calling Sequence

[plqClean] = plq_clean(plqDirty)

Parameters

Description

The plq_clean function is used to help clear duplicate rows which arise during the plq fenchel conjugate operation. For example, the function reduces the number of rows by merging these two pieces of a plq function into one e.g. [0,1,0,0;0,1,0,0] -> [0,1,0,0]. The function also compresses duplicate point values e.g. [0,1,0,1;0,2,0,0] -> [0,1,0,1], and merges adjacent rows that are always infinite (which arise in plq_add).

Examples

// Example 1. Clear Duplicate Points
plqDirty=[0,1,0,0;0,2,0,0;1,2,3,4;%inf,3,0,0];
plqClean=plq_clean(plqDirty);
// plqClean == [0,1,0,0;1,2,3,4;%inf,3,0,0];

// Example 2. Clear Duplicate Rows
plqDirty=[0,1,0,0;0,1,0,0;1,2,3,4;%inf,3,0,0];
plqClean=plq_clean(plqDirty);
// plqClean == [0,1,0,0;1,2,3,4;%inf,3,0,0];

// Example 3. Clear Duplicate Infinites
plqDirty = [-1  ,  0,  -1, %inf; ...
            -0.5,  0,   1, %inf; ...
             0  ,  0,   1, 1   ; ...
             0.5,  0,  -1, 1   ; ...
             1  ,  0,  -1, %inf; ...
            %inf,  0,   1, %inf];
plqClean = plq_clean(plqDirty);
// plqClean == [-0.5,  0,  0, %inf; ...
//               0  ,  0,  1, 1   ; ...
//               0.5,  0, -1, 1   ; ...
//              %inf,  0,  0, %inf];
            

  

See Also

plq_function,  

Author

Mike Trienis, University of British Columbia, BC, Canada