I have a large Vector{Float64}
called x
, a few elements of which remain unchanged within a loop. I would like the remaining elements to reflect the values in another array b
, before passing on to a function within the loop which does some heavy lifting. Something like this
# x is preallocated outside the loop,
# changeidx remains the same every iteration
# b changes on every iteration but is preallocated outside the loop
x[changeidx] .= b
foo!(output, x)
# output is also preallocated
Is there a way to send foo!
the variable x
without actually copying the values of b
into x
? Will a view
help me here? Or is there a best practice for this kind of operation?
Thanks