redimension_store and subarray and multiply inconsistent


#1

SciDB 12.3, Ubuntu 11.10

My goal is to load a sparse array from csv, convert it into a matrix, and then multiply it by a matrix already in the database. The loaded array in some cases behaves as if the it has been compacted so that the gaps between elements along the main dimension have been removed. But when it is queried using subarray, the returned values are consistent with the original dimension values. When using it in the matrix multiplication operation, it is the incorrect dimension values. Here is what I did:

create somewhat sparse data file to load:

scidb@ubuntu:~$ cat mat2.csv 
0,0,1
1,0,1
3,0,1
scidb@ubuntu:~$ csv2scidb < mat2.csv > mat2.scidb 
scidb@ubuntu:~$ cat mat2.scidb 
{0}[
(0,0,1),
(1,0,1),
(3,0,1)
]

the above matrix is:
1
1
0
1

load the above into SciDB:

AFL% create array loadRaw<i:uint32, j:uint32, value:double> [line=0:*,10,0];
Query was executed successfully
AFL% load(loadRaw, '/home/scidb/mat2.scidb');
[(0,0,1),(1,0,1),(3,0,1),(),(),(),(),(),(),()]
AFL% create array mat2 <value:double> [i=0:9,10,0, j=0:0,1,0];
Query was executed successfully
AFL% redimension_store(loadRaw, mat2);
[[(1)],[(1)],[(1)],[()],[()],[()],[()],[()],[()],[()]]

create a matrix in SciDB:

AFL% create array mat1 <value:double> [i=0:9,10,0, j=0:1,2,0];
Query was executed successfully
AFL% store(build(mat1, i*2 + j), mat1);
[[(0),(1)],[(2),(3)],[(4),(5)],[(6),(7)],[(8),(9)],[(10),(11)],[(12),(13)],[(14),(15)],[(16),(17)],[(18),(19)]]

The created matrix is:
0 1
2 3
4 5
6 7
8 9
10 11
12 13
14 15
16 17
18 19

running matrix multiply yields:

AFL% multiply(transpose(mat2), mat1);
[[(6),(9)]]

Based on the matrices above, the answer should be
8 11

The answer provided is one in which the loaded matrix is
1
1
1
0

instead of
1
1
0
1

The output of scan:

AFL% scan(mat2);
[[(1)],[(1)],[(1)],[()],[()],[()],[()],[()],[()],[()]]

However, investigating with subarray produces something different:

AFL% subarray(mat2,0,0,0,0);
[[(1)]]
AFL% subarray(mat2,0,0,1,0);
[[(1)],[(1)]]
AFL% subarray(mat2,0,0,2,0);
[[(1)],[(1)]]
AFL% subarray(mat2,0,0,3,0);
[[(1)],[(1)],[(1)]]

Scanning to a dimension value of “2” produces only 2 elements, consistent with the original loaded file. Scanning to dimension value of “3” produces 3 elements again consistent.

edit: corrected expected result of matrix operation to (8, 11) instead of original (4, 11)


#2

OK, so I repeated the above experiment but instead of using uint32 to specify the row columns I used int64, as was in the post that showed me that method of loading data
viewtopic.php?f=11&t=598#p1083

specifically, the loadRaw array attributes are changed to have int64 instead of uint32 type. Then the expected result from scan and matrix multiplication are observed.