Here's an interesting take on median:
http://www.johnmyleswhite.com/notebook/2013/03/22/modes-medians-and-means-an-unifying-perspective/
It's worth noting that when you use linear discrepancy that there's no
difference between the various definitions of median of a list with an
even number of elem
I need to get all the rotations of a rank-1 vector
i.e from 10 11 12 to get 10 11 12, 11 12 10 and 12 10 11
say my vector is size 3, I tried:
i.3 |. 10 11 12
but it spits out a length error, as, of course, does 0 1 2 |. 10 11 12
Trying to change the rank of rotate doesn't seem to help, not h
Something like this might work :
1 2 3 |."0 1 ] 10 11 12
Otherwise you should probably look at A.
({~ i.@!@# A. i.@#) 'abc'
On Mar 24, 2013 2:55 PM, "Alex Giannakopoulos"
wrote:
> I need to get all the rotations of a rank-1 vector
> i.e from 10 11 12 to get 10 11 12, 11 12 10 and 12 10 11
>
> s
Thanks Ric, that worked.
In the end I used
rots =: ] |." 0 1 ~ [:i.#
which gives me what I want. Not quite sure I understand the |. " 0 1 ]
bit, so I am using it cargo-cult stylee. I was previously trying |. " 0
there must be something I haven't grasped.
Ah, is the |. " 0 1 ] setting the rank of the /left/ argument to 0?
Lightbulb goes on!
--
For information about J forums see http://www.jsoftware.com/forums.htm
(|."0 _~i.@#) 10 11 12
Henry Rich
On 3/23/2013 9:55 PM, Alex Giannakopoulos wrote:
I need to get all the rotations of a rank-1 vector
i.e from 10 11 12 to get 10 11 12, 11 12 10 and 12 10 11
say my vector is size 3, I tried:
i.3 |. 10 11 12
but it spits out a length error, as, of cou
Thanks Henry, I was hobbling in that general direction...
Amazing how simple it is when one "gets it", but I'd never had occasion to
change rank of left argument before.
--
For information about J forums see http://www.jsoftware.co
I like the anagram function:
v
10 11 12
rr
A.~ i.@:!@:#
rr v
10 11 12
10 12 11
11 10 12
11 12 10
12 10 11
12 11 10
On 2013.03.24 15:20:35, you,
the extraordinary Ric Sherlock, spake thus:
> Something like this might work :
> 1 2 3 |."0 1 ] 10 11 12
> Otherwise you should probably look