I have had to use it to get a fast version of the Mandelbrot set calculator.
The Mandelbrot verb iterates over all the input complex numbers using native
vector operations and drops those which go out of the bounds; it has to be
rank 1 to avoid messy phenomena with indexing. However, you want to
calculate over an array and you get slightly faster times if you do it under
ravel.
Of course the Mandelbrot Set is a really low-level thing and not
particularly suited to J, but it is an example anyway.

Marshall

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Dan Bron
Sent: Monday, October 04, 2010 1:00 PM
To: 'Programming forum'
Subject: Re: [Jprogramming] Another Abbreviation

Roger wrote:
> I suspect v"0 would serve.  If it
> does not, I'd like to see what such a v is.

Viktor replied:
>     a =: 1 : '$ $ u@,'
>     v =: 5&,
> 
>     v"0 i. 2 2
>  [vs]
>     v a i. 2 2

Roger responded:
>  The intent of my question [was for]
>  some practical use that breaks
>  the equivalence.

I cited some practical uses in [1] (and the last citation will tell you how
I found them, and how you might find others).  

One use is in JSoftware's standard library, where a matrix needs to be
passed to a library written in a less array friendly language, so the input
is raveled to vector, and the output reshaped into a matrix. 

On a historical note, both Kirk Iverson and I had something analogous to
UnderRavel in our personal utilities scripts.  So we must have found some
repeatable use for the pattern (though I admit I cannot remember an example
right now, and also my utilities script has collected some less-than-useful
specimens...)

-Dan

[1]  Earlier post in this thread:
http://www.jsoftware.com/pipermail/programming/2010-October/020648.html  



----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to