088d0493818855e04b0d12ee3269751039171dc5
[scilab.git] / scilab / modules / elementary_functions / help / en_US / matrixoperations / norm.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) 2008 - INRIA
5  *
6  * Copyright (C) 2012 - 2016 - Scilab Enterprises
7  *
8  * This file is hereby licensed under the terms of the GNU GPL v2.0,
9  * pursuant to article 5.3.4 of the CeCILL v.2.1.
10  * This file was originally licensed under the terms of the CeCILL v2.1,
11  * and continues to be available under such terms.
12  * For more information, see the COPYING file which you should have received
13  * along with this program.
14  *
15  -->
16 <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="norm" xml:lang="en">
17     <refnamediv>
18         <refname>norm</refname>
19         <refpurpose>matrix norm</refpurpose>
20     </refnamediv>
21     <refsynopsisdiv>
22         <title>Syntax</title>
23         <synopsis>[y]=norm(x [,flag])</synopsis>
24     </refsynopsisdiv>
25     <refsection>
26         <title>Arguments</title>
27         <variablelist>
28             <varlistentry>
29                 <term>x</term>
30                 <listitem>
31                     <para>real or complex vector or matrix (full or sparse
32                         storage)
33                     </para>
34                 </listitem>
35             </varlistentry>
36             <varlistentry>
37                 <term>flag</term>
38                 <listitem>
39                     <para>string (type of norm) (default value =2)</para>
40                 </listitem>
41             </varlistentry>
42             <varlistentry>
43                 <term>y</term>
44                 <listitem>
45                     <para>
46                         norm
47                     </para>
48                 </listitem>
49             </varlistentry>
50         </variablelist>
51     </refsection>
52     <refsection>
53         <title>Description</title>
54         <para>For matrices</para>
55         <variablelist>
56             <varlistentry>
57                 <term>norm(x)</term>
58                 <listitem>
59                     <para>
60                         or <literal>norm(x,2)</literal> is the largest singular value
61                         of <literal>x</literal> (<literal>max(svd(x))</literal>).
62                     </para>
63                 </listitem>
64             </varlistentry>
65             <varlistentry>
66                 <term>norm(x,1)</term>
67                 <listitem>
68                     <para>
69                         The l_1 norm <literal>x</literal> (the largest column sum :
70                         <literal>max(sum(abs(x),'r'))</literal> ).
71                     </para>
72                 </listitem>
73             </varlistentry>
74             <varlistentry>
75                 <term>norm(x,'inf'),norm(x,%inf)</term>
76                 <listitem>
77                     <para>
78                         The infinity norm of <literal>x</literal> (the largest row sum
79                         : <literal>max(sum(abs(x),'c'))</literal> ).
80                     </para>
81                 </listitem>
82             </varlistentry>
83             <varlistentry>
84                 <term>norm(x,'fro')</term>
85                 <listitem>
86                     <para>Frobenius norm i.e.
87                         <literal>sqrt(sum(diag(x'*x)))</literal>.
88                     </para>
89                 </listitem>
90             </varlistentry>
91         </variablelist>
92         <para>For vectors</para>
93         <variablelist>
94             <varlistentry>
95                 <term>norm(v,p)</term>
96                 <listitem>
97                     <para>
98                         The l_p norm (<literal>sum(v(i)^p))^(1/p)</literal> .
99                     </para>
100                 </listitem>
101             </varlistentry>
102             <varlistentry>
103                 <term>norm(v), norm(v,2)</term>
104                 <listitem>
105                     <para>
106                         The l_2 norm
107                     </para>
108                 </listitem>
109             </varlistentry>
110             <varlistentry>
111                 <term>norm(v,'inf')</term>
112                 <listitem>
113                     <para>
114                         <literal>max(abs(v(i)))</literal>.
115                     </para>
116                 </listitem>
117             </varlistentry>
118         </variablelist>
119     </refsection>
120     <refsection>
121         <title>Examples</title>
122         <programlisting role="example"><![CDATA[
123 A=[1,2,3];
124 norm(A,1)
125 norm(A,'inf')
126 A=[1,2;3,4]
127 max(svd(A))-norm(A)
128
129 A=sparse([1 0 0 33 -1])
130 norm(A)
131  ]]></programlisting>
132     </refsection>
133     <refsection role="see also">
134         <title>See also</title>
135         <simplelist type="inline">
136             <member>
137                 <link linkend="h_norm">h_norm</link>
138             </member>
139             <member>
140                 <link linkend="dhnorm">dhnorm</link>
141             </member>
142             <member>
143                 <link linkend="h2norm">h2norm</link>
144             </member>
145             <member>
146                 <link linkend="abs">abs</link>
147             </member>
148             <member>
149                 <link linkend="svd">svd</link>
150             </member>
151         </simplelist>
152     </refsection>
153 </refentry>