vectorization - Is vectorised data manipulation sequential (e.g R and MATLAB)? -


everybody told exploit vectorised programmes such matlab , use indexing instead of loop.

for e.g, in matlab, rather setting element of matrix 0 in double loop, use m[1:n,1:n]=0;.

my question relates whether works sequentially? i.e, if have row vector v of size n, , execute following line

v[1:n-1]=v[2:n] 

then updated values used throughout, or take "snapshot" of vector, , paste vector again in shifted index?

i'd sequentialy values updated bottom first , used again values above etc

it works though on right hand side happens before on left hand side, doing "snapshot" thing better memory efficiency. in reality, may loop through or may take "snapshot", due abstraction don't need know or care that.

so result follows:

v=[1 2 3 4 5 6]; v[1:5]=v[2:6]; disp(v)      v =       [2 3 4 5 6 6] 

is want?


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -