The following using the r beta has some behaviour I do not understand. On
testing it appears unchanged from J601.
The first section below is a session log. The second section the script.
Log ******************
a =: >: ?. 2 3 4$20
b =: $.a
marginald =: 4 : 0
x =. >x NB. provide option of either boxed or unboxed x arg
+/ ^:(n-#x) ( (vi =. (i.(n =. #$y)) -. x),x)|: y
)
marginal1sp =: 4 : 0
< 0$. x marginald y
)
c =: 0 marginal1sp b
3!:0 c
32
( i.#$b) marginal1sp "0 _ b
1 │ ┌───────────┐
2 │ │114 88 77 │
│ ├───────────┤
│ │68 88 52 71│
│ └───────────┘
Note 'Questions and comment'
1. the result of marginal1sp is a box atom not a
sparse boxed atom. Why is the result of the above line
a sparse array?
2. there are three atoms in the left argument. Why does
the result only contain two results? Is there a bug in
the display of sparse arrays here?
3. I get the expected result with three elements
when I enter
0 $. ( i.#$b) marginal1sp "0 _ b
)
Script **************************
a =: >: ?. 2 3 4$20
b =: $.a
marginald =: 4 : 0
x =. >x NB. provide option of either boxed or unboxed x arg
+/ ^:(n-#x) ( (vi =. (i.(n =. #$y)) -. x),x)|: y
)
marginal1sp =: 4 : 0
< 0$. x marginald y
)
c =: 0 marginal1sp b
3!:0 c
( i.#$b) marginal1sp "0 _ b
0 $. ( i.#$b) marginal1sp "0 _ b
End of script ***********************************
Any help would be appreciated.
Fraser
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm