Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make LAGraph_random configurable with ranges #59

Open
szarnyasg opened this issue Jan 21, 2020 · 1 comment
Open

Make LAGraph_random configurable with ranges #59

szarnyasg opened this issue Jan 21, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@szarnyasg
Copy link
Contributor

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.

@szarnyasg szarnyasg changed the title LAGraph_random adds LAGraph_random inserts explicit zero elements Jan 21, 2020
@DrTimothyAldenDavis
Copy link
Member

DrTimothyAldenDavis commented Jan 23, 2020 via email

@szarnyasg szarnyasg changed the title LAGraph_random inserts explicit zero elements Make LAGraph_random configurable with ranges Mar 3, 2020
@szarnyasg szarnyasg added the enhancement New feature or request label Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants