[Scilab-users] funny result for tensor norm calculation

Serge Steer Serge.Steer at inria.fr
Fri Sep 28 13:50:21 CEST 2012


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

__

B=rand(100,100);
tic();norm(B);t2=toc();
B=rand(100,100);
tic();norm(B,'fro');tf=toc();
that explain why /sqrt(trace(A_transp * A)) can be more efficient than 
norm(A)
/

/Serge Steer

/

Le 26/09/2012 19:42, Paul Carrico a écrit :
>
> Dear All,
>
> 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 ...
>
> Paul
>
> mode(0);
>
> A= [ 1 2 3 ; 4 5 6; 7 8 9]
>
> n= 1000
>
> fori = 1 : n
>
> for j = 1 : n
>
> B(i,j) = i*j;
>
> end
>
> end
>
> /// Scilab function/
>
> _tic_();
>
> _norm_(B)
>
> t1= _toc_()
>
> /// "traditional" method/
>
> /// norm = sqrt(trace(A_transp * A))/
>
> _tic_
>
> norm_= (_trace_(B'*B))**0.5
>
> t2= _toc_()
>
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20120928/d10baf1b/attachment.htm>


More information about the users mailing list