[Jprogramming] Boxing columns
Ben Gorte - CITG
B.G.H.Gorte at tudelft.nl
Thu Nov 20 15:42:31 UTC 2014
If I'm allowed to jump in here, I'm using ;. a lot to subdivide images into 2x2 blocks (think wavelet), and I guess it's okay to do it like:
]z =: (2 2,:2 2) < ;. _3 i.4 6
+-----+-----+-----+
|0 1 |2 3 | 4 5|
|6 7 |8 9 |10 11|
+-----+-----+-----+
|12 13|14 15|16 17|
|18 19|20 21|22 23|
+-----+-----+-----+
I was quite happy to discover that:
,./,./> z
0 1 2 3 4 5
6 7 8 9 10 11
12 13 14 15 16 17
18 19 20 21 22 23
does the inverse (it's even pleasant to type).
Now I'm smoothly moving to 3d with
]zz =: (2 2 2,:2 2 2) < ;. _3 i.4 6 8
but as the inverse is concerned I'm sort of stuck at:
CutBack =: [: ([: ,/ ([: ,./ ,./)"4) 1 2 4 5&|:
(i.4 6 8) -: CutBack >zz
1
which I'm sure can be improved. Any suggestions?
Thanks,
Ben
________________________
From: programming-bounces at forums.jsoftware.com [programming-bounces at forums.jsoftware.com] on behalf of Henry Rich [HenryHRich at nc.rr.com]
Sent: Wednesday, November 19, 2014 23:40
To: programming at jsoftware.com
Subject: Re: [Jprogramming] Boxing columns
Is the inverse implemented using ^:_1 ? I couldn't find it.
I come up with ,.&:>/ as an inverse for ('';1)&(<;.1) .
Henry Rich
On 11/19/2014 5:28 PM, Roger Hui wrote:
> The inverse of this "block matrices cut" is also interesting.
>
>
> On Wed, Nov 19, 2014 at 2:27 PM, Roger Hui <rogerhui.canada at gmail.com>
> wrote:
>
>> ('';1) <;.1 i.3 3
>> ┌─┬─┬─┐
>> │0│1│2│
>> │3│4│5│
>> │6│7│8│
>> └─┴─┴─┘
>>
>>
>> On Wed, Nov 19, 2014 at 2:05 PM, Henry Rich <HenryHRich at nc.rr.com> wrote:
>>
>>> boxcols i. 3 3
>>> +-+-+-+
>>> |0|1|2|
>>> |3|4|5|
>>> |6|7|8|
>>> +-+-+-+
>>>
>>> Can you write boxcols?
>>>
>>> Can you write it tacitly without using a hook, fork, compose, or appose?
>>>
>>> Henry Rich
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>
>>
>>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list