<?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_check">
  <info>
    <pubdate>18-May-2010</pubdate>
  </info>

  <refnamediv>
    <refname>plq_check</refname>
    <refpurpose>Piecewise linear quadratic (plq), Consistency check</refpurpose>
  </refnamediv>

   <refsynopsisdiv>
     <title>Calling Sequence</title>
     <synopsis>[b, er] = plq_check(plqf, ind)</synopsis>
   </refsynopsisdiv>

   <refsection>
     <title>Parameters</title>
     <variablelist>

       <varlistentry>
         <term>plqf</term>
         <listitem>
           <para>matrix. A plq function.</para>
         </listitem>
       </varlistentry>

       <varlistentry>
         <term>ind</term>
         <listitem>
           <para>optional integer.  Which tests to perform on plqf.</para>
         </listitem>
       </varlistentry>

       <varlistentry>
         <term>b</term>
         <listitem>
           <para>boolean.  True if and only if plqf is a valid PLQ function.</para>
         </listitem>
       </varlistentry>

       <varlistentry>
         <term>er</term>
         <listitem>
           <para>real number.  The maximum error found in the last test run.</para>
         </listitem>
       </varlistentry>

     </variablelist>
   </refsection>

   <refsection>
     <title>Description</title>

     <para>
       Performs a number of sanity checks on the PLQ function plqf.  If all of
       the tests pass, %t is returned, otherwise %f is returned.
     </para>

     <para>
       Test 1 tests that the plqf's x values (first column) are increasing.
       Test 2 checks that plqf is continuous.  By default, both tests are
       performed.  The optional index argument can specify an individual test,
       or vector of tests, to run.
     </para>

     <para>
       If test 1 fails, then er is the largest decrease in x value between two
       consecutive pieces.  If test 2 fails, then er is the maximum absolute
       difference between the values of two consecutive pieces at their meeting
       point.
     </para>
   </refsection>

   <refsection>
     <title>Examples</title>
     <programlisting role="example"><![CDATA[
plqf = [-1 0 0 %inf; 0 0 0 0; 1 0 0 1; %inf 0 0 %inf];
plq_check(plqf),    // False - discontinuous.

plqf = [-1 0 0 %inf; 0 0 0 0; -0.5 0 0 0; %inf 0 0 %inf];
plq_check(plqf),    // False - X not increasing.

plqf = [0 0 -1 0; %inf 0 1 0];
plq_check(plqf),    // True.
]]></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>Bryan Gardiner</literal>, University of British Columbia, BC, Canada
     </para>
   </refsection>

</refentry>
