<?xml version="1.0" encoding="ISO-8859-1"?><refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:lang="en" xml:id="plq_coDirect"><info><pubdate>05-May-2008</pubdate></info><refnamediv><refname>plq_coDirect</refname><refpurpose>Piecewise linear quadratic (plq), Convex hull (direct algorithm)</refpurpose></refnamediv>
  
   
  
   
  
   
  
   
  
   

  
   <refsynopsisdiv><title>Calling Sequence</title><synopsis>plqco = plq_coDirect(plqf)</synopsis></refsynopsisdiv>

  
   <refsection><title>Parameters</title>
	  
      <variablelist>
		  
         <varlistentry>
			  
            <term>plqf</term>
			  
            <listitem>
				  
               <para>matrix. A plq function whose convex hull will be computed.
				  </para>
			  
            </listitem>
		  
         </varlistentry>
		  
         <varlistentry>
			  
            <term>plqco</term>
			  
            <listitem>
				  
               <para>matrix. A plq function that is the convex hull of the original function.
				  </para>
			  
            </listitem>
		  
         </varlistentry>
	  
      </variablelist>
  
   </refsection>
 
  
   <refsection><title>Description</title>
     
         <para>
	     Computes the convex hull of a continuous, but not necessarily convex, plq function, where the input and output are given in the form of a plq matrix.
    </para>

    <para>
      This algorithm performs a left-to-right plane sweep, examining
      two adjacent pieces at a time.  It convexifies two pieces, and
      moves rightward, adding to the "current convex hull" to the left
      of the index, or backtracks if convexity was broken at a point.
      This algorithm runs in linear time, as each iteration either
      moves rightward, backtracks and merges two pieces, or backtracks
      without merging, but this can happen at most a linear number of
      times.
    </para>

   <para>
     A special case is when three adjacent pieces are quadratic,
     linear, and quadratic, each quadratic piece contains the vertex
     of the quadratic, and a linear piece which is not the convex hull
     is between.  To prevent cycling convergent behaviour, the linear
     piece is directly replaced with the convex hull of the two
     quadratic pieces.
   </para>
  
   </refsection>

  
   <refsection><title>Examples</title><programlisting role="example"><![CDATA[
// The hull of a linear-linear-quadratic function:
plqf = [0,0,1,0;2,0,0,0;%inf,1,-4,4];
result = plq_coDirect(plqf),
scf(); plq_plot(plqf, result);

// The hull of a more complicated function:
plqf =[-3,1,8,16;0,0,-1,-2;3,0,1,-2;%inf,1,-8,16];
result = plq_coDirect(plqf),
scf(); plq_plot(plqf, result);
  ]]></programlisting></refsection>


   <refsection><title>See Also</title><simplelist type="inline">

       <member>
         <link linkend="plq_co">plq_co</link>
       </member>

       <member>
         <link linkend="plq_coSplit">plq_coSplit</link>
       </member>
    
      <member>
         <link linkend="plq_function">plq_function</link>
      </member>

   </simplelist></refsection>

  
   <refsection><title>Authors</title><para>
	  
      <literal>Bryan Gardiner</literal>, University of British Columbia, BC, Canada
  </para></refsection>

  
   <refsection><title>Used Functions</title>
    
      <para>
      
         <link linkend="_plq_conv_on_interval">_plq_conv_on_interval</link> is used to ensure that pieces of a function are convex on an interval.
    </para>
  
   </refsection>

</refentry>