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
[email protected]
http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users

Reply via email to