<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( http://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="spanplus">
    <refnamediv>
        <refname>spanplus</refname>
        <refpurpose>sum of subspaces</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Syntax</title>
        <synopsis>[X,dim,dima]=spanplus(A,B[,tol])</synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Arguments</title>
        <variablelist>
            <varlistentry>
                <term>A, B</term>
                <listitem>
                    <para>two real or complex matrices with equal number of rows</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>X</term>
                <listitem>
                    <para>orthogonal or unitary square matrix</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>dim, dima</term>
                <listitem>
                    <para>integers, dimension of subspaces</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>tol</term>
                <listitem>
                    <para>nonnegative real number</para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Description</title>
        <para>
            computes a  basis X such that:
        </para>
        <para>
            the first <literal>dima</literal> columns of <literal>X</literal> span Range(<literal>A</literal>)
            and the following (<literal>dim-dima</literal>) columns make a basis of <literal>A+B</literal>
            relative to <literal>A</literal>.
        </para>
        <para>
            The <literal>dim</literal> first columns of <literal>X</literal> make a basis for <literal>A+B</literal>.
        </para>
        <para>
            One has the following canonical form for <literal>[A,B]</literal>:
        </para>
        <programlisting role=""><![CDATA[
         [*,*]    (dima rows)
X'*[A,B]=[0,*]    (dim-dima rows)
         [0,0]
 ]]></programlisting>
        <para>
            <literal>tol</literal> is an optional argument (see function code).
        </para>
    </refsection>
    <refsection>
        <title>Examples</title>
        <programlisting role="example"><![CDATA[
A=rand(6,2)*rand(2,5);      // rank(A)=2
B=[A(:,1),rand(6,2)]*rand(3,3);   //two additional independent vectors
[X,dim,dimA]=spanplus(A,B);
dimA
dim
 ]]></programlisting>
    </refsection>
    <refsection role="see also">
        <title>See also</title>
        <simplelist type="inline">
            <member>
                <link linkend="spaninter">spaninter</link>
            </member>
            <member>
                <link linkend="im_inv">im_inv</link>
            </member>
            <member>
                <link linkend="spantwo">spantwo</link>
            </member>
        </simplelist>
    </refsection>
</refentry>
