<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) 2013 - Scilab Enterprises
 *
 * 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="issquare" xml:lang="en">
    <refnamediv>
        <refname>issquare</refname>
        <refpurpose>check if a variable is a square matrix</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Syntax</title>
        <synopsis>t=issquare(x)</synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Arguments</title>
        <variablelist>
            <varlistentry>
                <term>x</term>
                <listitem>
                    <para>scalar, vector, matrix, hypermatrix, list, array of structures or cells</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>t</term>
                <listitem>
                    <para>a boolean</para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Description</title>
        <para>
            <literal>
                issquare(<varname>x</varname>)
            </literal>
            returns true if <varname>x</varname>
            is a square matrix (all dimensions of <varname>x</varname> are the same, with eventually singletons
            if <varname>x</varname> is an hypermatrix).
        </para>
        <para>
            <note>
              <para>
                <literal>issquare([])</literal> returns <literal>%F</literal> (false).
              </para>
              <para>
                <literal>issquare(eye())</literal> returns <literal>%T</literal> (true).
              </para>
            </note>
        </para>
    </refsection>
    <refsection>
        <title>Examples</title>
        <programlisting role="example"><![CDATA[
issquare(ones(10,10))
issquare(1)
issquare(["s" "t"; "t" "s"])
issquare(rand(2,1,2))
issquare(rand(2,2,3))
s = struct();
issquare(s) // Empty structure
clear s
s.a = %z;
s.b = 2;
issquare(s); // Scalar structure
clear s
s(1,2).a = 3;
s(1,3).b = %z;
issquare(s) // Row array of structures
clear s
s(2,1).a = "w";
s(3,1).b = %t;
issquare(s) // Column array of structures
clear s
s(1,2).a = -2;
s(3,1).b = %pi;
issquare(s) // 2D not-square array of structures
clear s
s(2,2,2).a = %f;
s(1,2,1).b = list(%e, %s);
issquare(s) // 3D (cubic) array of structures
clear s
s(2,1,2).a = 3;
s(1,1,2).b = "test";
issquare(s) // 3D array of structures (with a singleton dim)
 ]]></programlisting>
    </refsection>
    <refsection role="see also">
        <title>See also</title>
        <simplelist type="inline">
            <member>
                <link linkend="isscalar">isscalar</link>
            </member>
            <member>
                <link linkend="isrow">isrow</link>
            </member>
            <member>
                <link linkend="iscolumn">iscolumn</link>
            </member>
            <member>
                <link linkend="ismatrix">ismatrix</link>
            </member>
            <member>
                <link linkend="isempty">isempty</link>
            </member>
        </simplelist>
    </refsection>
    <refsection>
        <title>History</title>
        <revhistory>
            <revision>
                <revnumber>5.5.0</revnumber>
                <revremark>Function issquare introduced.</revremark>
            </revision>
            <revision>
                <revnumber>6.1.1</revnumber>
                <revremark>issquare() can be overloaded.</revremark>
            </revision>
        </revhistory>
    </refsection>
</refentry>
