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

Random Boolean matrices have non-zero False elements #8

Closed
szarnyasg opened this issue Jan 18, 2020 · 2 comments
Closed

Random Boolean matrices have non-zero False elements #8

szarnyasg opened this issue Jan 18, 2020 · 2 comments

Comments

@szarnyasg
Copy link
Contributor

I noticed that in the Triangle-Counting notebook, Cohen's algorithm returns 1929 while the Sandia variants return 1919. This is clearly a bug but the problem is not in the algorithms but in the data: the Matrix.from_random() method produces non-zero elements with False values. This can be demonstrated as follows:

M = Matrix.from_random(BOOL, 10, 10, 4, no_diagonal=True, make_symmetric=True, seed=42)
M.to_lists()
[[0, 1, 2, 3, 4, 4, 6, 9],
 [9, 4, 6, 4, 1, 3, 2, 0],
 [True, True, True, False, True, False, True, True]]
@michelp
Copy link
Collaborator

michelp commented Jan 21, 2020

The Matrix.from_random method calls LAGraph_random() directly, so if you think this is a bug it might be best to file it there. As a workaround you could do Matrix.from_random(...).select(lib.GxB_NONZERO).

@szarnyasg
Copy link
Contributor Author

from_random indeed behaves as it should. The triangle count is still strange though so I'm opening a followup issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants