1&=( |@(n&|@] - n&|@[) + |@(<.@(n&(%~)@]) - <.@(n&(%~)@[)) )"0/~i.n*n=.3 i.e. 1 = |x-diff| + |y-diff| x-diff = mod n y-diff = div n
result: 0 1 0 1 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 1 0 1 0 On Sun, Feb 24, 2013 at 3:20 PM, km <[email protected]> wrote: > Perhaps the following will help. > > http://www.jsoftware.com/docs/help701/dictionary/samp20.htm > > Sent from my iPad > > > On Feb 24, 2013, at 8:11 AM, alessandro codenotti <[email protected]> wrote: > > > > > no, sorry, i need an NxN matrix, where N is the number of nodes in the > network where the values of the (i,j) entry is 1 when there is an arc > between the node i and the node j and 0 otherwise. > > > > for example let's consider the 3x3 network given before, the > corresponding adjacency matrix is: > > > > +-+-+-+-+-+-+-+-+-+ > > |x|A|B|C|D|E|F|H|I| > > +-+-+-+-+-+-+-+-+-+ > > |A|0|1|0|1|0|0|0|0| > > +-+-+-+-+-+-+-+-+-+ > > |B|1|0|1|0|1|0|0|0| > > +-+-+-+-+-+-+-+-+-+ > > |C|0|1|0|0|0|1|0|0| > > +-+-+-+-+-+-+-+-+-+ > > |D|1|0|0|0|1|0|0|0| > > +-+-+-+-+-+-+-+-+-+ > > |E|0|1|0|1|0|1|1|0| > > +-+-+-+-+-+-+-+-+-+ > > |F|0|0|1|0|1|0|0|1| > > +-+-+-+-+-+-+-+-+-+ > > |G|0|0|0|1|0|0|1|0| > > +-+-+-+-+-+-+-+-+-+ > > |H|0|0|0|0|1|0|0|1| > > +-+-+-+-+-+-+-+-+-+ > > |I|0|0|0|1|0|1|1|0| > > +-+-+-+-+-+-+-+-+-+ > > > > I need, if it is possible, a verb that given 3 as input gives this > matrix at output (i only need the part with 0s and 1s, nonboxed), the > problem is that i don't know how to calculate it for a square network with > a generic N as side so i was asking help more with the maths than with J > itself! > > > > thanks anyway for trying to help! > > > > ---------------------------------------------------------------------- > > 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
