<?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:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="eye" xml:lang="en">
    <refnamediv>
        <refname>eye</refname>
        <refpurpose>identity matrix</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Syntax</title>
        <synopsis>X = eye(m,n)
            X = eye(A)
            X = eye()
        </synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Arguments</title>
        <variablelist>
            <varlistentry>
                <term>A,X</term>
                <listitem>
                    <para>
                        matrices, hypermatrices, or <literal>syslin</literal> lists
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>m,n</term>
                <listitem>
                    <para>
                        integer values: numbers of rows and columns for <varname>X</varname>
                    </para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Description</title>
        <para>according to its arguments defines an
            <literal>m</literal>x<literal>n</literal> matrix with 1 along the main
            diagonal or an identity matrix of the same dimension as
            <literal>A</literal> . In case <varname>A</varname> is an hypermatrix,
            <varname>X</varname> will be defined as
            <literal>X(i,i,...,i) = 1</literal> for all <literal>i</literal> from 1 to <literal>min(size(A))</literal>.
        </para>
        <warning>
            <literal>eye(10)</literal> is interpreted as
            <literal>eye(A)</literal> with <literal>A=10</literal> i.e.
            <literal>1</literal>. (It is NOT a ten by ten identity matrix!).
        </warning>
        <para>
            If <literal>A</literal> is a linear system represented by a
            <literal>syslin</literal> list, <literal>eye(A)</literal> returns an
            <literal>eye</literal> matrix of appropriate dimension: (number of outputs
            x number of inputs).
        </para>
        <para>
            <literal>eye()</literal> produces a identity matrix with undefined
            dimensions. Dimensions will be defined when this identity matrix is added
            to a matrix with fixed dimensions.
        </para>
    </refsection>
    <refsection>
        <title>Examples</title>
        <programlisting role="example"><![CDATA[
eye(2,3)
A=rand(2,3);eye(A)
s=poly(0,'s');A=[s,1;s,s+1];eye(A)
A=[1/s,1;s,2];eye(A);
A=ssrand(2,2,3);eye(A)
[1 2;3 4]+2*eye()
eye(zeros(4,4,4,4))
 ]]></programlisting>
    </refsection>
    <refsection role="see also">
        <title>See also</title>
        <simplelist type="inline">
            <member>
                <link linkend="ones">ones</link>
            </member>
            <member>
                <link linkend="zeros">zeros</link>
            </member>
        </simplelist>
    </refsection>
    <refsection>
        <title>History</title>
        <revhistory>
            <revision>
                <revnumber>5.5.0</revnumber>
                <revdescription>
                    <para>Generalization to N-D hypermatrix</para>
                </revdescription>
            </revision>
        </revhistory>
    </refsection>
</refentry>
