<?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_proj"><info><pubdate>04-Apr-2006</pubdate></info><refnamediv><refname>plq_proj</refname><refpurpose>Piecewise linear quadratic (plq), projection of a (not necessarily convex) function on the set of plq (convex) functions</refpurpose></refnamediv>
  
   
  
   
  
   
  
   
  
   

  
   <refsynopsisdiv><title>Calling Sequence</title><synopsis>[plq,d] = plq_proj(f,x,p)</synopsis></refsynopsisdiv>

  
   <refsection><title>Parameters</title>
	  
      <variablelist>
		  
         <varlistentry>
			  
            <term>plq</term>
			  
            <listitem>
				  
               <para>matrix. A plq function.
				  </para>
			  
            </listitem>
		  
         </varlistentry>
		  
         <varlistentry>
			  
            <term>d</term>
			  
            <listitem>
				  
               <para>float. distance between the function f and its projection plq functions d=||f-plq||_p.
				  </para>
			  
            </listitem>
		  
         </varlistentry>
		  
         <varlistentry>
			  
            <term>f</term>
			  
            <listitem>
				  
               <para>vector of size n. The values of the function f on the grid x: f=f(x(i)).
				  </para>
			  
            </listitem>
		  
         </varlistentry>
		  
         <varlistentry>
			  
            <term>x</term>
			  
            <listitem>
				  
               <para>vector of size n. The grid on which the function f is evaluated: f=f(x(i)).
				  </para>
			  
            </listitem>
		  
         </varlistentry>
		  
         <varlistentry>
			  
            <term>p</term>
			  
            <listitem>
				  
               <para>integer. The norm for which the projection is computed. p=1, 2, or %inf for the norm ||.||_p.
				  </para>
			  
            </listitem>
		  
         </varlistentry>
	  
      </variablelist>
  
   </refsection>
 
  
   <refsection><title>Description</title>
     
         <para>
            Computes the projection of the function f on the cone of plq convex functions. Return the result as a plq function.
    </para>
    
    
         <para>
	The computation assumes the function f is sampled on the uniform grid x. The values of the projection are computed by solving the optimization problem:
	 min ||f-u||_p such that u is convex 
	For the L_2 norm, a quadratic program with linear constraints is solved.
	    
    </para>
 	
   </refsection>

  
   <refsection><title>Examples</title><programlisting role="example"><![CDATA[
n=300;
x=linspace(-2,2,n)';
f=abs(abs(x)-1);

[p,d]=plq_proj(f,x,2);
u=plq_eval(p,x);

scf(0);clf();
plot2d(x,f,style=1);
plot2d(x,u,style=2);
legends(["f","plq"],[1,2],opt="lr");
xtitle(sprintf("Projection of f onto the cone of convex plq functions. ||f-plq||_p=%1.2f",d));
  ]]></programlisting></refsection>


   <refsection><title>See Also</title><simplelist type="inline">	
    
      <member>
         <link linkend="plq_function">plq_function</link>
      </member>

   </simplelist></refsection>

  
   <refsection><title>Authors</title><para>
	  
      <literal>Yves Lucet</literal>, University of British Columbia, BC, Canada
  </para></refsection>

</refentry>