@:may be faster than @ today, but what happens when J supports multiple
processors? To me using @ tells the interpreter that there is no dependence
between cells, where @: means that there could be. Therefore, @: restricts
the computation to one processor or at least extra processing to check for
dependencies between cells, where @ could allow cells to be handled in
multiple processors.
I use @: instead of @ for the very reasons you have stated, but I get the
feeling from the discussion that people feel that @: should always be used
instead of @ and that it will always be that way.
On Mon, Aug 18, 2008 at 5:07 PM, Sherlock, Ric <[EMAIL PROTECTED]>wrote:
> ---Viktor Cerovski wrote:
> > I'd like to add an another routine, normalrandom, that
> > generates normal
> > deviates with a specified standard deviation as the x argument and
> > the number of i.i.d realizations as the y argument. For
> > readability and
> > speed I split it into two parts:
> >
> > BM=:(2 1 o."0 1 [EMAIL PROTECTED]:@[ * [EMAIL PROTECTED])*"1(*
> > [:%:_2*^.@:[EMAIL PROTECTED])
> > normalrandom=:] $ ,@(BM >[EMAIL PROTECTED]:@(*/))
>
> My preference for extending normalrand to specified stddev and mean would
> be to
> use a cover verb - despite slightly poorer performance.
>
> normalrand01=: normalrand6c
>
> normalrandoma=: [EMAIL PROTECTED] + {:@[ * normalrand01@:]
>
> Or perhaps even nicer (but a bit more space hungry):
>
> normalrandomb=: 3 : 0
> normalrand01 y
> :
> 'mu sd'=. x
> mu + sd * normalrand01 y
> )
>
> To reclaim the extra space:
>
> normalrandomc=: 3 : 0
> normalrand01 y
> :
> 'mu sd'=. x
> mu&+@:(sd&*@:normalrand01) y
> )
>
> numb=: 1000000
> 10 ts 'normalrand numb'
> 0.2548488076 83888640
> 10 ts 'normalrand6c numb' NB. Alias for normalrand01
> 0.17375854333 20972736
> 10 ts '1 normalrandom numb'
> 0.17906571226 20972608
> 10 ts '0 1 normalrandoma numb'
> 0.19534977909 20972800
> 10 ts 'normalrandomb numb'
> 0.17369843793 20973824
> 10 ts 'normalrandomc numb'
> 0.17481962791 20973824
> 10 ts '2 normalrandom numb'
> 0.18213729678 20972608
> 10 ts '3 2 normalrandoma numb'
> 0.19645108526 20972800
> 10 ts '3 2 normalrandomb numb'
> 0.19858650331 25168512
> 10 ts '3 2 normalrandomc numb' NB. reclaims space
> 0.19579058232 20974720
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm