Hello all,

I tried to compare two norm() computations as shown below:

u = 1.; v = 1.;

# case 1: constants as arguments
@time for i = 1 : 10000
  g = k * norm([1.; 1.])^3
end

# case 2: variables as arguments
@time for i = 1 : 10000
  g = k * norm([u; v])^3
end

And the computation speed in case 2 is much slower than case 1. Is there a 
way to improve this? Ideally, I would expect them to have the same speed.



Zhilong Liu





Reply via email to