<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">
<p><font face="Times New Roman, Times, serif">norm(B) computes the
L2 norm of (the greatest singular value) while norm(B,'fro')
and sqrt(B'*B) compute the frobennius norm of B</font></p>
<p class="MsoNormal"><u><span
style="font-size:10.5pt;font-family:"Monospaced","serif";color:#AE5CB0"
lang="EN-US"></span></u><span
style="font-size:10.5pt;font-family:"Monospaced","serif""
lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><font face="Times New Roman, Times, serif"><span
style="font-size: 10.5pt; color: black;">B=rand(100,100);<br>
tic();norm(B);t2=toc();<br>
</span><span style="font-size: 10.5pt; color: black;">B=rand(100,100);<br>
tic();norm(B,'fro');tf=toc();<br>
</span>that explain why </font><i><span
style="font-size:10.5pt;font-family:"Monospaced","serif";color:#01A801"
lang="EN-US"><font color="#000000" face="Times New Roman,
Times, serif"> sqrt(trace(A_transp * A)) can be more
efficient than norm(A)</font><br>
</span></i></p>
<p class="MsoNormal"><i><span
style="font-size:10.5pt;font-family:"Monospaced","serif";color:#01A801"
lang="EN-US">Serge Steer<br>
<br>
</span></i><span
style="font-size:10.5pt;font-family:"Monospaced","serif""><span
style="color:#5C5C5C"></span></span></p>
Le 26/09/2012 19:42, Paul Carrico a écrit :<br>
</div>
<blockquote
cite="mid:000301cd9c0e$47768fc0$d663af40$@carrico@free.fr"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 12 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Monospaced;
panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"Pr\00E9format\00E9 HTML Car";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.PrformatHTMLCar
{mso-style-name:"Pr\00E9format\00E9 HTML Car";
mso-style-priority:99;
mso-style-link:"Pr\00E9format\00E9 HTML";
font-family:"Courier New";}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Dear All,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">A funny result for
calculating the norm of a tensor … for ounce a “traditional”
method (that probably uses vectorization in back stage) is
faster than the norm function …<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Paul<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.5pt;font-family:"Monospaced","serif";color:#32B9B9"
lang="EN-US">mode</span><span
style="font-size:10.5pt;font-family:"Monospaced","serif";color:#4A55DB"
lang="EN-US">(</span><span
style="font-size:10.5pt;font-family:"Monospaced","serif";color:rosybrown"
lang="EN-US">0</span><span
style="font-size:10.5pt;font-family:"Monospaced","serif";color:#4A55DB"
lang="EN-US">)</span><span
style="font-size:10.5pt;font-family:"Monospaced","serif";color:black"
lang="EN-US">;</span><span
style="font-size:10.5pt;font-family:"Monospaced","serif""
lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.5pt;font-family:"Monospaced","serif""
lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.5pt;font-family:"Monospaced","serif";color:black"
lang="EN-US">A</span><span
style="font-size:10.5pt;font-family:"Monospaced","serif""
lang="EN-US"> <span style="color:#5C5C5C">=</span> <span
style="color:#4A55DB">[</span> <span
style="color:rosybrown">1</span> <span
style="color:rosybrown">2</span> <span
style="color:rosybrown">3</span> <span
style="color:black">;</span> <span
style="color:rosybrown">4</span> <span
style="color:rosybrown">5</span> <span
style="color:rosybrown">6</span><span style="color:black">;</span>
<span style="color:rosybrown">7</span> <span
style="color:rosybrown">8</span> <span
style="color:rosybrown">9</span><span
style="color:#4A55DB">]</span><o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.5pt;font-family:"Monospaced","serif";color:black"
lang="EN-US">n</span><span
style="font-size:10.5pt;font-family:"Monospaced","serif""
lang="EN-US"> <span style="color:#5C5C5C">=</span> <span
style="color:rosybrown">1000</span><o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.5pt;font-family:"Monospaced","serif";color:#A020F0"
lang="EN-US">for</span><span
style="font-size:10.5pt;font-family:"Monospaced","serif""
lang="EN-US"> <span style="color:black">i</span> <span
style="color:#5C5C5C">=</span> <span
style="color:rosybrown">1</span> <span
style="color:#FFAA00">:</span> <span style="color:black">n</span><o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.5pt;font-family:"Monospaced","serif""
lang="EN-US"> <span style="color:#A020F0">for</span> <span
style="color:black">j</span> <span style="color:#5C5C5C">=</span>
<span style="color:rosybrown">1</span> <span
style="color:#FFAA00">:</span> <span style="color:black">n</span><o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.5pt;font-family:"Monospaced","serif""
lang="EN-US"> <span style="color:black">B</span><span
style="color:#4A55DB">(</span><span style="color:black">i,j</span><span
style="color:#4A55DB">)</span> <span
style="color:#5C5C5C">=</span> <span style="color:black">i</span><span
style="color:#5C5C5C">*</span><span style="color:black">j;</span><o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.5pt;font-family:"Monospaced","serif""
lang="EN-US"> <span style="color:#A020F0">end</span><o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.5pt;font-family:"Monospaced","serif";color:#A020F0"
lang="EN-US">end</span><span
style="font-size:10.5pt;font-family:"Monospaced","serif""
lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.5pt;font-family:"Monospaced","serif""
lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><i><span
style="font-size:10.5pt;font-family:"Monospaced","serif";color:#01A801"
lang="EN-US">// Scilab function</span></i><span
style="font-size:10.5pt;font-family:"Monospaced","serif""
lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><u><span
style="font-size:10.5pt;font-family:"Monospaced","serif";color:#AE5CB0"
lang="EN-US">tic</span></u><span
style="font-size:10.5pt;font-family:"Monospaced","serif";color:#4A55DB"
lang="EN-US">()</span><span
style="font-size:10.5pt;font-family:"Monospaced","serif";color:black"
lang="EN-US">;</span><span
style="font-size:10.5pt;font-family:"Monospaced","serif""
lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><u><span
style="font-size:10.5pt;font-family:"Monospaced","serif";color:#AE5CB0"
lang="EN-US">norm</span></u><span
style="font-size:10.5pt;font-family:"Monospaced","serif";color:#4A55DB"
lang="EN-US">(</span><span
style="font-size:10.5pt;font-family:"Monospaced","serif";color:black"
lang="EN-US">B</span><span
style="font-size:10.5pt;font-family:"Monospaced","serif";color:#4A55DB"
lang="EN-US">)</span><span
style="font-size:10.5pt;font-family:"Monospaced","serif""
lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.5pt;font-family:"Monospaced","serif";color:black"
lang="EN-US">t1</span><span
style="font-size:10.5pt;font-family:"Monospaced","serif""
lang="EN-US"> <span style="color:#5C5C5C">=</span> <u><span
style="color:#AE5CB0">toc</span></u><span
style="color:#4A55DB">()</span><o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.5pt;font-family:"Monospaced","serif""
lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><i><span
style="font-size:10.5pt;font-family:"Monospaced","serif";color:#01A801"
lang="EN-US">// "traditional" method</span></i><span
style="font-size:10.5pt;font-family:"Monospaced","serif""
lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><i><span
style="font-size:10.5pt;font-family:"Monospaced","serif";color:#01A801"
lang="EN-US">// norm = sqrt(trace(A_transp * A))</span></i><span
style="font-size:10.5pt;font-family:"Monospaced","serif""
lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><u><span
style="font-size:10.5pt;font-family:"Monospaced","serif";color:#AE5CB0"
lang="EN-US">tic</span></u><span
style="font-size:10.5pt;font-family:"Monospaced","serif""
lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.5pt;font-family:"Monospaced","serif";color:black">norm_</span><span
style="font-size:10.5pt;font-family:"Monospaced","serif"">
<span style="color:#5C5C5C">=</span> <span
style="color:#4A55DB">(</span><u><span
style="color:#AE5CB0">trace</span></u><span
style="color:#4A55DB">(</span><span style="color:black">B</span><span
style="color:#5C5C5C">'*</span><span style="color:black">B</span><span
style="color:#4A55DB">))</span><span style="color:#5C5C5C">**</span><span
style="color:rosybrown">0.5</span><o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.5pt;font-family:"Monospaced","serif";color:black">t2</span><span
style="font-size:10.5pt;font-family:"Monospaced","serif"">
<span style="color:#5C5C5C">=</span> <u><span
style="color:#AE5CB0">toc</span></u><span
style="color:#4A55DB">()</span><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</body>
</html>