<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( https://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) 2008 - INRIA
 *
 * 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="inv">
    <refnamediv>
        <refname>inv</refname>
        <refpurpose>matrix inverse</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Syntax</title>
        <synopsis>inv(X)</synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Arguments</title>
        <variablelist>
            <varlistentry>
                <term>X</term>
                <listitem>
                    <para>real or complex square matrix, polynomial matrix, rational matrix in transfer or state-space representation.</para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Description</title>
        <para>
            <literal>inv(X)</literal> is the inverse of the square matrix <literal>X</literal>. A warning
            message is printed if <literal>X</literal> is badly scaled or nearly singular.
        </para>
        <para>
            For polynomial matrices or rational matrices in transfer representation,
            <literal>inv(X)</literal> is equivalent to <literal>invr(X)</literal>.
        </para>
        <para>
          <literal>inv([])</literal> returns <literal>[]</literal>.
        </para>
        <para>
            For linear systems in state-space representation (<literal>syslin</literal> list),
            <literal>invr(X)</literal> is equivalent to <literal>invsyslin(X)</literal>.
        </para>
    </refsection>
    <refsection>
        <title>References</title>
        <para>
            <literal>inv</literal> function for matrices of numbers is  based on the Lapack routines
            DGETRF, DGETRI for  real matrices and  ZGETRF, ZGETRI for the complex case.
            For polynomial matrix and rational function matrix <literal>inv</literal> is based on the <literal>invr</literal>
            Scilab function.
        </para>
    </refsection>
    <refsection>
        <title>Examples</title>
        <programlisting role="example"><![CDATA[
A=rand(3,3);inv(A)*A

x=poly(0,'x');
A=[x,1,x;x^2,2,1+x;1,2,3];inv(A)*A

A=[1/x,2;2+x,2/(1+x)]
inv(A)*A

A=ssrand(2,2,3);
W=inv(A)*A
clean(ss2tf(W))
 ]]></programlisting>
    </refsection>
    <refsection role="see also">
        <title>See also</title>
        <simplelist type="inline">
            <member>
                <link linkend="slash">slash</link>
            </member>
            <member>
                <link linkend="backslash">backslash</link>
            </member>
            <member>
                <link linkend="pinv">pinv</link>
            </member>
            <member>
                <link linkend="qr">qr</link>
            </member>
            <member>
                <link linkend="lufact">lufact</link>
            </member>
            <member>
                <link linkend="lusolve">lusolve</link>
            </member>
            <member>
                <link linkend="invr">invr</link>
            </member>
            <member>
                <link linkend="coff">coff</link>
            </member>
            <member>
                <link linkend="coffg">coffg</link>
            </member>
        </simplelist>
    </refsection>
</refentry>
