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

for i = 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

Reply via email to