Followup of issue Graphegon/pygraphblas#8. LAGraph_random fills zero-values in nonzero positions as demonstrated by the following code:
int seed = 42;
GrB_Index nvals;
LAGraph_random(&A, GrB_BOOL, 10, 10, 4, false, true, false, false, true, &seed);
GrB_Matrix_nvals(A, &nvals);
GrB_wait();
GxB_print(A, GxB_SHORT);
row: 0 : 1 entries [0:0]
column 9: 1
row: 1 : 1 entries [1:1]
column 4: 1
row: 2 : 1 entries [2:2]
column 6: 1
row: 3 : 1 entries [3:3]
column 4: 0
row: 4 : 2 entries [4:5]
column 1: 1
column 3: 0
row: 6 : 1 entries [6:6]
column 2: 1
row: 9 : 1 entries [7:7]
column 0: 1
I'm not sure whether this is the intended behaviour but based on the random generators for INT and FP types, putting "explicit zeros" is intentional. So maybe this should be kept as is but documented in the header comment of LAGraph_random. What do you think?
PS: For booleans, setting the make_pattern parameter to true works around the problem.
Followup of issue Graphegon/pygraphblas#8.
LAGraph_randomfills zero-values in nonzero positions as demonstrated by the following code:I'm not sure whether this is the intended behaviour but based on the random generators for INT and FP types, putting "explicit zeros" is intentional. So maybe this should be kept as is but documented in the header comment of
LAGraph_random. What do you think?PS: For booleans, setting the
make_patternparameter totrueworks around the problem.