Re: [Jprogramming] Indices of a matrix

2017-01-10 Thread Skip Cave
Ben, Jose, Raul, Roger, Thanks so much for your efforts in providing various solutions to my index problem. I am continually amazed at the diversity of options that J's primitives provide to approach problems. Ben: 4$.$. i.3 4 NB. Unboxed using Sparse NB. Wow! I would have never even thought of

Re: [Jprogramming] Indices of a matrix

2017-01-10 Thread Raul Miller
Note that the row/column indices correspond to the decode of the integer indices. 3 4 #: i. 3 4 0 0 0 1 0 2 0 3 1 0 1 1 1 2 1 3 2 0 2 1 2 2 2 3 Likewise, the integer indices correspond to the encode of the row/column indices: 3 4 #. 3 4 #: i. 3 4 0 1 2 3 4 5 6 7 8 9 10 11 All that r

Re: [Jprogramming] Fwd: J Android error

2017-01-10 Thread Don Guinn
Yes. I gathered that. It would be nice of a warning about coreq updates. On Tue, Jan 10, 2017 at 5:07 PM, bill lam wrote: > It needs exiting once to complete installation. The changes are switching > to 11!:x for calling wd and gl2. > > > On 11 Jan, 2017 1:20 am, "Don Guinn" wrote: > > > Reinst

Re: [Jprogramming] Indices of a matrix

2017-01-10 Thread Roger Hui
Alternatively, { i.&.> 2 3 ┌───┬───┬───┐ │0 0│0 1│0 2│ ├───┼───┼───┤ │1 0│1 1│1 2│ └───┴───┴───┘ { i.&.> 2 3 4 ┌─┬─┬─┬─┐ │0 0 0│0 0 1│0 0 2│0 0 3│ ├─┼─┼─┼─┤ │0 1 0│0 1 1│0 1 2│0 1 3│ ├─┼─┼─┼─┤ │0 2 0│0 2 1│0 2 2│0 2 3│ └─┴─┴─┴─┘

Re: [Jprogramming] Fwd: J Android error

2017-01-10 Thread bill lam
It needs exiting once to complete installation. The changes are switching to 11!:x for calling wd and gl2. On 11 Jan, 2017 1:20 am, "Don Guinn" wrote: > Reinstalling J corrected the problem. > -- Forwarded message -- > From: "Don Guinn" > Date: Jan 10, 2017 9:58 AM > Subject: J

Re: [Jprogramming] Indices of a matrix

2017-01-10 Thread Jose Mario Quintana
"Ultimately, I want to design a verb bix, that will take a list of dimensions of any length, and generate boxed indices of the resulting array." bix 10 ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐ │0│1│2│3│4│5│6│7│8│9│ └─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘ bix 3 4 ┌───┬───┬───┬───┐ │0 0│0 1│0 2│0 3│ ├───┼───┼───┼───┤ │1 0│1 1│1

Re: [Jprogramming] Indices of a matrix

2017-01-10 Thread Ben Gorte - CITG
There is also: a =: i.3 4 {i. each $ a +---+---+---+---+ |0 0|0 1|0 2|0 3| +---+---+---+---+ |1 0|1 1|1 2|1 3| +---+---+---+---+ |2 0|2 1|2 2|2 3| +---+---+---+---+ Ben From: Programming [programming-boun...@forums.jsoftware.com] on behalf of Skip

Re: [Jprogramming] ^: slowness with boxes

2017-01-10 Thread Joe Bogner
For a little more color: previous discussion: http://www.jsoftware.com/pipermail/programming/2014-March/035994.html I'm going to switch back to using i. for this On Tue, Jan 10, 2017 at 6:15 PM, Joe Bogner wrote: > Looks like it is due to the boxing. Please disregard > > http://code.jsoftware

Re: [Jprogramming] ^: slowness with boxes

2017-01-10 Thread Joe Bogner
Looks like it is due to the boxing. Please disregard http://code.jsoftware.com/wiki/Vocabulary/comma#dyadic mentions that append in place special code does not work for boxes f4 =: 3 : 0 a=:a: for_n. (i. y) do. a=:a,( wrote: > Why are these so different in execution speed? I'm surprised assemb

Re: [Jprogramming] Indices of a matrix

2017-01-10 Thread Ben Gorte - CITG
How about: 4$.$. i.3 4 0 1 0 2 0 3 1 0 1 1 1 2 1 3 2 0 2 1 2 2 2 3 4$.$. i.2 3 4 0 0 1 0 0 2 0 0 3 0 1 0 0 1 1 0 1 2 0 1 3 0 2 0 0 2 1 0 2 2 0 2 3 1 0 0 1 0 1 1 0 2 1 0 3 1 1 0 1 1 1 1 1 2 1 1 3 1 2 0 1 2 1 1 2 2 1 2 3 (thanks to Marshall Lochbaum iirc) Ben

[Jprogramming] Indices of a matrix

2017-01-10 Thread Skip Cave
Given a 3x4 matrix: a =. i. 3 4 a 0 1 2 3 4 5 6 7 8 9 10 11 I can get the horizontal indices: 4|a 0 1 2 3 0 1 2 3 0 1 2 3 How do I get the vertical indices? 3?a NB. The question-mark represents the unknown verb 0 0 0 0 1 1 1 1 2 2 2 2 Ultimately, I want

[Jprogramming] ^: slowness with boxes

2017-01-10 Thread Joe Bogner
Why are these so different in execution speed? I'm surprised assembling that linking boxes makes that much of a difference over an number. I need it to be boxed because I'm going to something more complex with each iteration. f1 =: 3 : '(>: each)^:(:)^:(http://www.jsoftware.com/forums.htm

[Jprogramming] Fwd: J Android error

2017-01-10 Thread Don Guinn
Reinstalling J corrected the problem. -- Forwarded message -- From: "Don Guinn" Date: Jan 10, 2017 9:58 AM Subject: J Android error To: "Programming forum" Cc: Just installed latest updates for J on Android. Got following error. Left > in current locale of z. > > |domain error:

[Jprogramming] J Android error

2017-01-10 Thread Don Guinn
Just installed latest updates for J on Android. Got following error. Left in current locale of z. |domain error: wd | ver=.wd'version' -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] dyadic valence of v in u&.v ?

2017-01-10 Thread Erling Hellenäs
It seems my AtDot from long ago is doing the trick. AtDot=: 2 : (':';'[ v^:_1 u@v') 0 0 1 0 0 1 >:@] AtDot # i.6 0 0 3 0 0 6 /Erling On 2017-01-01 21:40, David Koppenhoefer wrote: Reading the wonderful NuVoc I found the gem that dyadic # has an inverse - it can therefore be used in &. like