* Bug 15337 fixed: mistake in l_p definition in norm() page
[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"
17     xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml"
18     xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook"
19     xmlns:scilab="http://www.scilab.org" xml:id="norm" xml:lang="en">
20     <refnamediv>
21         <refname>norm</refname>
22         <refpurpose>norms of a vector or a matrix</refpurpose>
23     </refnamediv>
24     <refsynopsisdiv>
25         <title>Syntax</title>
26         <synopsis>
27         y = norm(x)
28         y = norm(x, normType)
29         </synopsis>
30     </refsynopsisdiv>
31     <refsection>
32         <title>Arguments</title>
33         <variablelist>
34             <varlistentry>
35                 <term>x</term>
36                 <listitem>
37                     <para>vector or matrix of real or complex numbers (full or sparse storage)
38                     </para>
39                 </listitem>
40             </varlistentry>
41             <varlistentry>
42                 <term>normType</term>
43                 <listitem>
44                     <para>
45                         <itemizedlist>
46                             <listitem>
47                                 For a matrix <literal>x</literal>: a number among
48                                 <literal>1, 2, %inf, -%inf</literal>, or a word among
49                                 <literal>"inf"</literal> (or <literal>"i"</literal>) or
50                                 <literal>"fro"</literal> (or <literal>"f"</literal>).
51                             </listitem>
52                             <listitem>
53                                 For a vector <literal>x</literal>: any number or <literal>%inf</literal>,
54                                 <literal>-%inf</literal>; or a word <literal>"inf"</literal>
55                                 (<literal>"i"</literal>), <literal>"fro"</literal> (<literal>"f"</literal>).
56                             </listitem>
57                         </itemizedlist>
58                     </para>
59                     Default value = 2.
60                 </listitem>
61             </varlistentry>
62             <varlistentry>
63                 <term>y</term>
64                 <listitem>
65                     <para>
66                         norm: single positive real number.
67                     </para>
68                 </listitem>
69             </varlistentry>
70         </variablelist>
71     </refsection>
72     <refsection>
73         <title>Description</title>
74         <para>For matrices</para>
75         <variablelist>
76             <varlistentry>
77                 <term>norm(x)</term>
78                 <listitem>
79                     <para>
80                         or <literal>norm(x,2)</literal> is the largest singular value
81                         of <literal>x</literal> (<literal>max(svd(x))</literal>).
82                     </para>
83                 </listitem>
84             </varlistentry>
85             <varlistentry>
86                 <term>norm(x,1)</term>
87                 <listitem>
88                     <para>
89                         The l_1 norm <literal>x</literal> (the largest column sum :
90                         <literal>max(sum(abs(x),'r'))</literal> ).
91                     </para>
92                 </listitem>
93             </varlistentry>
94             <varlistentry>
95                 <term>norm(x,'inf'),norm(x,%inf)</term>
96                 <listitem>
97                     <para>
98                         The infinity norm of <literal>x</literal> (the largest row sum :
99                         <literal>max(sum(abs(x),'c'))</literal> ).
100                     </para>
101                 </listitem>
102             </varlistentry>
103             <varlistentry>
104                 <term>norm(x,'fro')</term>
105                 <listitem>
106                     <para>Frobenius norm i.e. <literal>sqrt(sum(diag(x'*x)))</literal>.
107                     </para>
108                 </listitem>
109             </varlistentry>
110         </variablelist>
111         <para>For vectors</para>
112         <variablelist>
113             <varlistentry>
114                 <term>norm(v,p)</term>
115                 <listitem>
116                     <para>
117                         The l_p norm <literal>sum(abs(v(i))^p)^(1/p)</literal> .
118                     </para>
119                 </listitem>
120             </varlistentry>
121             <varlistentry>
122                 <term>norm(v), norm(v,2)</term>
123                 <listitem>
124                     <para>
125                         The l_2 norm
126                     </para>
127                 </listitem>
128             </varlistentry>
129             <varlistentry>
130                 <term>norm(v,'inf')</term>
131                 <listitem>
132                     <para>
133                         <literal>max(abs(v(i)))</literal>.
134                     </para>
135                 </listitem>
136             </varlistentry>
137         </variablelist>
138     </refsection>
139     <refsection>
140         <title>Examples</title>
141         <programlisting role="example"><![CDATA[
142 A = [1,2,3];
143 norm(A,1)
144 norm(A,'inf')
145 A = [1,2;3,4]
146 max(svd(A)) - norm(A)
147
148 A = sparse([1 0 0 33 -1])
149 norm(A)
150  ]]></programlisting>
151     </refsection>
152     <refsection role="see also">
153         <title>See also</title>
154         <simplelist type="inline">
155             <member>
156                 <link linkend="h_norm">h_norm</link>
157             </member>
158             <member>
159                 <link linkend="dhnorm">dhnorm</link>
160             </member>
161             <member>
162                 <link linkend="h2norm">h2norm</link>
163             </member>
164             <member>
165                 <link linkend="abs">abs</link>
166             </member>
167             <member>
168                 <link linkend="svd">svd</link>
169             </member>
170         </simplelist>
171     </refsection>
172 </refentry>