This is a question about how to use the dot-syntax for in-place assignment for sub-arrays.
v = [1., 2., 3., 4., 5., 6.]. I want to apply
sin(...) in place to some elements. Specifically, I want to do:
v[1:3] .= sin.(v[1:3])
Is this efficient? I fear we might be creating a temporary sub-array that is not really necessary. Or is the compiler here clever enough to do it really in-place? An alternative is to use
view(v, 1:3) .= sin.(view(v, 1:3))
Is this necessary? Which way is better?