help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Are scalars precomputed when multiplied with or added to vectors?


From: Olaf Till
Subject: Are scalars precomputed when multiplied with or added to vectors?
Date: Wed, 12 Mar 2008 15:17:40 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

If x and y are vectors and all other variables are scalars, e.g. in

octave:1> y = sqrt (x.^2 * a^2 + sqrt ((a + b)^2 + c * d)) + c + d;

will all scalar subexpressions

(i.e.: a^2, sqrt ((a + b)^2 + c * d), c + d)

be computed by Octave only once for the operations on all components
of x, or is it worth explicitly precomputing them?

Olaf


reply via email to

[Prev in Thread] Current Thread [Next in Thread]