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

fix-rand-matrixDirichlet #211

Merged
merged 3 commits into from
Sep 27, 2024
Merged

fix-rand-matrixDirichlet #211

merged 3 commits into from
Sep 27, 2024

Conversation

Raphael-Tresor
Copy link
Contributor

Fix bug

Previous was working only for squared matrix.
Now iterate over the number of columns to generate Dirichlet data.

@wouterwln
Copy link
Member

@Raphael-Tresor can you add test cases that test this behaviour?

@Raphael-Tresor
Copy link
Contributor Author

Raphael-Tresor commented Sep 26, 2024 via email

@Raphael-Tresor
Copy link
Contributor Author

Raphael-Tresor commented Sep 26, 2024 via email

@bvdmitri
Copy link
Member

Thanks @Raphael-Tresor!! indeed a test is necessary to ensure the bug will not occur again in the future.

@Raphael-Tresor
Copy link
Contributor Author

I added tests @wouterwln

@wouterwln
Copy link
Member

For some reason rand! was allocating a matrix of samples and then copying this one by one to the desired container. Also, it used rand for Dirichlet, where rand! can also be used. I renewed the implementation. The runtime is similar but the amount of allocations went from $\mathcal{O}(n)$ to 2.

@bvdmitri bvdmitri merged commit ae10936 into main Sep 27, 2024
2 checks passed
@bvdmitri bvdmitri deleted the fix-rand-matrixDirichlet branch September 27, 2024 13:03
@wouterwln wouterwln restored the fix-rand-matrixDirichlet branch October 22, 2024 12:25
@wouterwln wouterwln deleted the fix-rand-matrixDirichlet branch October 24, 2024 13:23
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

Successfully merging this pull request may close these issues.

Broken rand for MatrixDirichlet with wide parameter matrix
3 participants