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

Force design matrices to be non-sparse #39

Merged
merged 3 commits into from
May 15, 2020
Merged

Conversation

amstilp
Copy link
Contributor

@amstilp amstilp commented May 15, 2020

The Matrix package by default creates a sparse matrix when more than 50% of the values are zero. For sparse matrices with only slightly more than 50% zero values, matrix multiplication is much less efficient. It is possible that a design matrix will have more than 50% zero values (e.g., if a large number of conditional variants are included), and thus be subject to reduced efficiency when fitting the null model, but it is unlikely that they will have enough zero values to make sparse matrix multiplication efficient when fitting the null model. This pull request forces all design matrices created with the Matrix package to be non-sparse and improves efficiency when fitting null models with a lot of conditional variants.

It's highly unlikely that the design matrix will have enough 0
elements that it should be created as a sparse matrix. It can
even be problematic and cause slowdowns if approximatmely half the
elements are 0. Force the design matrix to be non-sparse when
creating it.
@amstilp
Copy link
Contributor Author

amstilp commented May 15, 2020

It looks like there are a lot of changes, but most are whitespace changes due to different text editor defaults.

Copy link
Contributor

@mconomos mconomos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good. Thanks for finding and fixing this.

Copy link
Collaborator

@smgogarten smgogarten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@smgogarten smgogarten merged commit 94bd0c8 into master May 15, 2020
@smgogarten smgogarten deleted the no-sparse-design-matrix branch May 15, 2020 23:29
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.

3 participants