Re: [Jprogramming] Unboxing after subarray function

2017-03-30 Thread Rob Hodgkinson
> Thanks Raul, your solution is much nicer than mine. > > > > On Wed, 3/29/17, Raul Miller wrote: > > Subject: Re: [Jprogramming] Unboxing after subarray function > To: "Programming forum" > Date: Wednesday, March 29, 201

Re: [Jprogramming] Unboxing after subarray function

2017-03-30 Thread 'Jon Hough' via Programming
Thanks Raul, your solution is much nicer than mine. On Wed, 3/29/17, Raul Miller wrote: Subject: Re: [Jprogramming] Unboxing after subarray function To: "Programming forum" Date: Wednesday, March 29, 2017, 9:01 PM Here's a

Re: [Jprogramming] Unboxing after subarray function

2017-03-30 Thread 'Jon Hough' via Programming
- On Wed, 3/29/17, Rob Hodgkinson wrote: Subject: Re: [Jprogramming] Unboxing after subarray function To: [email protected] Date: Wednesday, March 29, 2017, 6:45 PM Did you notice my last line ?  It specifically gave you an alternative way to u

Re: [Jprogramming] Unboxing after subarray function

2017-03-30 Thread Linda A Alvord
- From: Programming [mailto:[email protected]] On Behalf Of Raul Miller Sent: Wednesday, March 29, 2017 8:01 AM To: Programming forum Subject: Re: [Jprogramming] Unboxing after subarray function Here's a generalization which works on your first example (which happens to a

Re: [Jprogramming] Unboxing after subarray function

2017-03-29 Thread Raul Miller
; │0 0 0│0 0 0│ >> │0 1 0│0 0 0│ >> │0 0 0│0 0 1│ >> ├─────┼─────┤ >> │0 0 0│0 0 0│ >> │0 1 0│0 0 0│ >> │0 0 0│0 0 1│ >> └─┴─┘ >> >> So, the problem is to get rid of the boxes, but keep the shape and positions >> of the array and i

Re: [Jprogramming] Unboxing after subarray function

2017-03-29 Thread Rob Hodgkinson
>> >> >> ┌─┬─┐ >> │0 0 0│0 0 0│ >> │0 1 0│0 0 0│ >> │0 0 0│0 0 1│ >> ├─┼─────┤ >> │0 0 0│0 0 0│ >> │0 1 0│0 0 0│ >> │0 0 0│0 0 1│ >> └─┴─┘ >> >> So, the problem is to get rid of the boxes, but keep the shape and positions

Re: [Jprogramming] Unboxing after subarray function

2017-03-29 Thread Raul Miller
> > ┌─┬─┐ > │0 0 0│0 0 0│ > │0 1 0│0 0 0│ > │0 0 0│0 0 1│ > ├─┼─┤ > │0 0 0│0 0 0│ > │0 1 0│0 0 0│ > │0 0 0│0 0 1│ > └─┴─┘ > > So, the problem is to get rid of the boxes, but keep the shape and positions > of the array and its element

Re: [Jprogramming] Unboxing after subarray function

2017-03-29 Thread Rob Hodgkinson
0│ > │0 1 0│0 0 0│ > │0 0 0│0 0 1│ > ├─┼─┤ > │0 0 0│0 0 0│ > │0 1 0│0 0 0│ > │0 0 0│0 0 1│ > └─┴─┘ > > So, the problem is to get rid of the boxes, but keep the shape and positions > of the array and its elements. > > -

Re: [Jprogramming] Unboxing after subarray function

2017-03-29 Thread 'Jon Hough' via Programming
ns of the array and its elements. On Wed, 3/29/17, Rob Hodgkinson wrote: Subject: Re: [Jprogramming] Unboxing after subarray function To: [email protected] Date: Wednesday, March 29, 2017, 6:19 PM Jon, I note Henry’s point about using <;.3 T if y

Re: [Jprogramming] Unboxing after subarray function

2017-03-29 Thread Rob Hodgkinson
(is;is) ($$((>./=])@:,))&.>@:< interval T NB. max of 3x3 subarrays > 12 12 $ , > |:"2 <"1 > IsMax > > Also creates the correct array. > > -------- > On Wed, 3/29/17, 'Jon Hough' via Programming &g

Re: [Jprogramming] Unboxing after subarray function

2017-03-29 Thread Henry Rich
Look at u;.3 and u;._3 Henry Rich On 3/29/2017 3:54 AM, 'Jon Hough' via Programming wrote: T =: 12 12 $ 0 _2 12 100 2 4.5 1 7 _5.5 3.2 120 2 _100 3 5 18 4 -- For information about J forums see http://www.jsoftware.com/forums.

Re: [Jprogramming] Unboxing after subarray function

2017-03-29 Thread 'Jon Hough' via Programming
:"2 <"1 > IsMax Also creates the correct array. On Wed, 3/29/17, 'Jon Hough' via Programming wrote: Subject: [Jprogramming] Unboxing after subarray function To: "Programming Forum" Date: Wednesday, March 29,

[Jprogramming] Unboxing after subarray function

2017-03-29 Thread 'Jon Hough' via Programming
I have a NxN matrix. For each 2x2 subarray of this (keep it simple, N is even), I want to calculate the maximum value and if the value of that cell equals the maximum of the 2x2 subarray write 1, else write 0. e.g. NB. T arbitrary 10x10 matrix T =: 10 10 $ 0 _2 12 100 2 4.5 1 7 _5.5 3.2 120 2 _