<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( https://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) 2008 - INRIA
 * Copyright (C) 2010 - DIGITEO - Michael Baudin
 * Copyright (C) 2012 - 2016 - Scilab Enterprises
 *
 * This file is hereby licensed under the terms of the GNU GPL v2.0,
 * pursuant to article 5.3.4 of the CeCILL v.2.1.
 * This file was originally licensed under the terms of the CeCILL v2.1,
 * and continues to be available under such terms.
 * For more information, see the COPYING file which you should have received
 * along with this program.
 *
 -->
<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" xmlns:scilab="http://www.scilab.org"
          xml:lang="en" xml:id="rcond">
    <refnamediv>
        <refname>rcond</refname>
        <refpurpose>inverse condition number</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Syntax</title>
        <synopsis>r = rcond(X)</synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Arguments</title>
        <variablelist>
            <varlistentry>
                <term>X</term>
                <listitem>
                    <para>real or complex square matrix</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>r</term>
                <listitem>
                    <para>real positive number</para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Description</title>
        <para>
            <literal>rcond(X)</literal> is an estimate for the reciprocal of the
            condition of <literal>X</literal> in the 1-norm.
        </para>
        <para>
            If <literal>X</literal> is well conditioned, <literal>rcond(X)</literal> is close to 1.
            If not, <literal>rcond(X)</literal> is close to 0.
        </para>
        <para>
          <note>
            Estimating the 1-norm inverse condition number with <literal>rcond</literal> is
            much faster than computing the 2-norm condition number with <literal>cond</literal>.
            As a trade-off, <literal>rcond</literal> may be less reliable.
          </note>
        </para>
        <para>
            Algorithm: We compute the 1-norm of X with Lapack/DLANGE, compute its LU decomposition
            with Lapack/DGETRF, and finally estimate the condition with Lapack/DGECON.
        </para>
        <para>
          <literal>rcond([])</literal> yields <literal>%inf</literal>.
        </para>
    </refsection>
    <refsection>
        <title>Examples</title>
        <programlisting role="example"><![CDATA[
A = diag([1:10]);
rcond(A)
A(1,1) = 0.000001;
rcond(A)
]]></programlisting>
      <para>Comparative benchmark: </para>
        <programlisting role="example"><![CDATA[
    A = ones(1000, 1000);
    timer(); cond(A);    timer()
    timer(); 1/rcond(A); timer()
 ]]></programlisting>
    </refsection>
    <refsection role="see also">
        <title>See also</title>
        <simplelist type="inline">
            <member>
                <link linkend="svd">svd</link>
            </member>
            <member>
                <link linkend="cond">cond</link>
            </member>
            <member>
                <link linkend="inv">inv</link>
            </member>
        </simplelist>
    </refsection>
    <refsection role="history">
        <title>History</title>
        <revhistory>
            <revision>
                <revnumber>6.0.2</revnumber>
                <revdescription>
                    rcond([]) now yields %inf = 1/cond([]) instead of [].
                </revdescription>
            </revision>
        </revhistory>
    </refsection>
</refentry>
