Skip to content

Commit c6dcbb4

Browse files
committed
so it turns out that we need int32 indices
1 parent 1683216 commit c6dcbb4

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

include/binsparse/tensor.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ typedef struct {
2323
// corresponds to BSP_TENSOR_DENSE
2424
typedef struct {
2525
int rank;
26+
// pointers_to, while it will only ever point to one bsp_array_t, must be kept
27+
// as a pointer (rather than a struct) because there are cases where it MUST
28+
// be null.
2629
bsp_array_t* pointers_to;
30+
// indices is supposed to be an array of bsp_array_t's.
2731
bsp_array_t* indices;
2832
bsp_level_t* child;
2933
} bsp_sparse_t;

test/julia/tensor_test.jl

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,35 @@ tensortest(
5757
joinpath(test_files, "input4.bsp.h5"),
5858
joinpath(test_files, "output4.bsp.h5")
5959
)
60+
61+
tensortest(
62+
Tensor(
63+
Dense(SparseList{Int32}(Element{0.0,Float64,Int32}())),
64+
[
65+
0 1 0 3;
66+
1 0 0 4;
67+
]
68+
),
69+
joinpath(test_files, "inputcsr.bsp.h5"),
70+
joinpath(test_files, "outputcsr.bsp.h5")
71+
)
72+
tensortest(
73+
Tensor(
74+
Dense(SparseList{Int32}(Element{0.0,Float64,Int32}())),
75+
fsprand(10, 10, 0.1)
76+
),
77+
joinpath(test_files, "inputcsr2.bsp.h5"),
78+
joinpath(test_files, "outputcsr2.bsp.h5")
79+
)
80+
81+
tensortest(
82+
Tensor(
83+
Dense(Dense(Element(0.0))),
84+
[
85+
1 1 2 3;
86+
6 1 5 4;
87+
]
88+
),
89+
joinpath(test_files, "inputdense.bsp.h5"),
90+
joinpath(test_files, "outputdense.bsp.h5")
91+
)

0 commit comments

Comments
 (0)