Same idea, better implementation

    hcinv =. -/@:#.@:(,: +:@(1&{.))"1

Henry Rich

On 12/10/2011 10:48 AM, Henry Rich wrote:
> Maybe not an improvement, but this is how I would have done back in my
> hardware-design days:
>
> hcinv =. -~/@:#.@:(~:/\)@:((,1)&,:)"1
>
> Quite a bit more elegant in wires than in J!
>
> Henry Rich
>
> On 12/10/2011 1:01 AM, Kip Murray wrote:
>> Now we need an inverse for Raul's improved #: ("hash colon")
>>
>>        hc  NB. Raul's improved #:
>>     {.@#:@(,: (2 * |))
>>
>>        hc i: 2
>>     1 1 0
>>     1 1 1
>>     0 0 0
>>     0 0 1
>>     0 1 0
>>
>>        hcinv  NB. improvement sought
>>     2&#.`(2&#.@}. - 2 ^<:@#)@.{."1
>>
>>        hcinv hc i: 2
>>     _2 _1 0 1 2
>>
>> On 12/8/2011 2:41 PM, Raul Miller wrote:
>> ...
>> But this would work just as well, as a model:
>>
>>        {.@#:@(,:  2 * |)i:2
>>     1 1 0
>>     1 1 1
>>     0 0 0
>>     0 0 1
>>     0 1 0
>> ----------------------------------------------------------------------
>> 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

Reply via email to