Consider the following example:
x = zeros(10)
x .= rand()
All components of x
will have the same (random) value. Now suppose I do instead:
x = zeros(10)
x .= rand.()
Since rand.()
is dotted, I’d expect it to apply to each element of x
separatedly. In this case, I should obtain ten distinct random values. However the result is the same as above (a single random value fills the whole vector).
Even though rand.()
has no arguments, it still should “apply to each element separatedly”. At least that’s what my intuition tells me.
Can someone explain this behavior?