Thank you for your comment. Sparse boxed arrays may not be implemented but
the rank operator appears to construct them and give a sensible result. The
display of the sparse boxed array is incorrect - but I should have expected
that possibility given the implementation status.
My problem can be restated. I construct a function with one numeric
argument and a sparse array argument.
The result of the function is a boxed numeric array.
Rank is listed as supported for sparse arrays.
I apply the function with "0 _ so each result is a boxed numeric array.
I had assumed the result of the operation would be a dense array consisting
in the example of 3 boxed items. I was surprised that the result was a
sparse array. It seems that the rank conjunction preserves the sparsity of
the argument in the result. On reflection I think that is the correct
treatment.
Fraser
----- Original Message -----
From: "Roger Hui" <[EMAIL PROTECTED]>
To: "Beta forum" <[email protected]>
Sent: Sunday, March 02, 2008 4:24 AM
Subject: Re: [Jbeta] Unexpected verb behaviour with a sparse array argument
I have not studied your msg in detail but I note that
sparse boxed arrays are not supported.
----- Original Message -----
From: Fraser Jackson <[EMAIL PROTECTED]>
Date: Friday, February 29, 2008 23:59
Subject: [Jbeta] Unexpected verb behaviour with a sparse array argument
To: Beta forum <[email protected]>
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 ***********************************
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm