plq_clean — Piecewise linear quadratic (plq), clears duplicate rows
[plqClean] = plq_clean(plqDirty)
matrix. A plq function with dimensions n x 4.
matrix. A plq function with dimensions n x 4.
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).
</listitem>// 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];