help-octave
[Top][All Lists]
Advanced

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

Re: Vectorizing simple loops


From: pawelz
Subject: Re: Vectorizing simple loops
Date: Thu, 3 Dec 2015 04:04:21 -0800 (PST)

Brian - sure, you are welcome. I learned a lot to reuse later too. Indeed the
solution is very elegant, I never suspected such would be possible. I am
pasting it here too, for reference:

in = [ 1 0 2 0 7 7 7 0 5 0 0 0 9 ]
out = nonzeros(in).'(cumsum(in~=0))

Btw -  this second challenge <http://stackoverflow.com/questions/34046161>  
is still unanswered. Given that I thought the same about the first one, I
don't trust my judgment entirely, but to me the second challenge seems more
difficult - if able to be vectorized at all...



--
View this message in context: 
http://octave.1599824.n4.nabble.com/Vectorizing-simple-loops-tp4673742p4673781.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

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