useOn 2019.08.20 12:01:34, you,
 the extraordinary Raul Miller, spake thus:

> Ok... so here's a routine which gives us all the truth valued arrays
> with n axes:
>    rntt=: (#2:) $"1 [: #:@i. 2>. 2^2*]

I think you want:  rntt=: (#2:) $"1 [: #:@i. 2>. 2^2^]
        (the number of arrays for 0,1,2,3 axes = 2 4 16 256

> 
> And, here's a test to see if an n-dimensional truth table is degenerate:
>    degenerate=: 1 e. (1 ]\. i.@#@$) -:/@|: ]
 
I will have to puzzle out 'degenerate' - it seems faster than
the brute force routine I use.

> (Use with "_1 cn a result from rntt)
> 

A quick way to get the dual of some N-axis array is:

nudu=: $ $ -.@:|.@,  

nudu 2 2$0 0 0 1        (and)

        0 1
        1 1             (or)

selfdual=: -: nudu

If we have a string, deldegen, with 0s for the degenerate
2-axis arrays:

                0 1 1 0 1 0 1 1 1 1 0 1 0 1 1 0

then 

selfdual"_1 deldegen#rntt 2
        0 0 0 0 0 0 0 0 0 0



> But I don't understand what a dual would be for an arbitrary truth
> valued array with an arbitrary number axes, so I'm not quite sure how
> I would write that test.
> 
> For example, if I implement:
> 
>    Glock=: $ #: I.@,
>    dual=: (-:&(/:~) -.)&Glock
>    selfdual=: dual~
> 
> I find four self-dual arrays of rank 2:
>    (#~ selfdual"_1) rntt 2
> 0 0
> 0 0
> 
> 0 1
> 1 0
> 
> 1 0
> 0 1
> 
> 1 1
> 1 1
> 
> What's a dual of a truth table array with arbitrary axes?
> 
> Thanks,
> 
> -- 
> Raul
> ----------------------------------------------------------------------
> 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