On Monday, December 16, 2013 4:53:54 PM UTC-5, Spencer Russell wrote:
>
> I didn't find one when I needed it a couple weeks ago, so I wrote one. It 
> takes a vector, whereas it would probably be nice to allow the user to give 
> a matrix and then specify which direction to unwrap in. Also note that it 
> uses the first value in the vector as the anchor point to unwrap all 
> subsequent values towards.
>
> https://gist.github.com/ssfrr/7995008
>
> Note that I'm by no means an experienced Julia coder and I'm not sure 
> what's considered good idiomatic Julia code, e.g. I have an "inplace=false" 
> argument and then add an unwrap!() alias that sets inplace to true.
>
> If this seems like a useful utility function I can do a pull request into 
> DSP.jl.
>
>
It's more idiomatic to define an in-place version, and then make the 
out-of-place version by

    unwrap(x) = unwrap!(copy(x))

Also, note that you should be able to use truncated division rather than 
loops to add/subtract the correct multiple of 2pi, as in my snippet.

Reply via email to