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

Overload matrix multiplication operator for rvars in R >= 4.3 #320

Merged
merged 2 commits into from
Nov 19, 2023

Conversation

mjskay
Copy link
Collaborator

@mjskay mjskay commented Nov 18, 2023

Summary

As promised on bluesky (hah), since in R >= 4.3 you can now implement %*% for S3 classes, this PR allows you to use %*% instead of %**% for matrix multiplying rvars.

There are also some minor maintenance things in there: it bumps to a dev version, adds that section in news, and re-documents.

Copyright and Licensing

By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the following licenses:

@codecov-commenter
Copy link

codecov-commenter commented Nov 18, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (c6ab463) 95.60% compared to head (7bc98df) 95.52%.

❗ Current head 7bc98df differs from pull request most recent head 263a5e6. Consider uploading reports for the commit 263a5e6 to get more accurate results

Files Patch % Lines
R/zzz.R 0.00% 2 Missing ⚠️
R/rvar-math.R 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #320      +/-   ##
==========================================
- Coverage   95.60%   95.52%   -0.08%     
==========================================
  Files          47       47              
  Lines        3686     3691       +5     
==========================================
+ Hits         3524     3526       +2     
- Misses        162      165       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mjskay
Copy link
Collaborator Author

mjskay commented Nov 18, 2023

The one missing line in code coverage probably can't be tested until they add more generics to matrixOps.

The check failures I am fixing now.

Copy link

This is how benchmark results would change (along with a 95% confidence interval in relative change) if bc26835 is merged into master:

  •   :ballot_box_with_check:as_draws_array: 101ms -> 101ms [-0.99%, +0.47%]
  •   :rocket:as_draws_df: 35.5ms -> 32.4ms [-10.27%, -7.38%]
  •   :ballot_box_with_check:as_draws_list: 190ms -> 189ms [-2.33%, +0.73%]
  •   :ballot_box_with_check:as_draws_matrix: 30.2ms -> 30.3ms [-1.7%, +2.52%]
  •   :ballot_box_with_check:as_draws_rvars: 160ms -> 162ms [-0.38%, +3.03%]
  •   :ballot_box_with_check:summarise_draws_100_variables: 721ms -> 718ms [-1.13%, +0.42%]
  •   :ballot_box_with_check:summarise_draws_10_variables: 79.2ms -> 79.5ms [-0.37%, +1.04%]
    Further explanation regarding interpretation and methodology can be found in the documentation.

Copy link

This is how benchmark results would change (along with a 95% confidence interval in relative change) if 7bc98df is merged into master:

  •   :ballot_box_with_check:as_draws_array: 99.7ms -> 101ms [-0.01%, +2.28%]
  •   :rocket:as_draws_df: 34.5ms -> 31.5ms [-10.35%, -7.34%]
  •   :ballot_box_with_check:as_draws_list: 180ms -> 183ms [-1.32%, +5.03%]
  •   :ballot_box_with_check:as_draws_matrix: 29ms -> 29.2ms [-3.89%, +5.45%]
  •   :ballot_box_with_check:as_draws_rvars: 155ms -> 154ms [-2.03%, +0.22%]
  •   :ballot_box_with_check:summarise_draws_100_variables: 706ms -> 706ms [-0.52%, +0.36%]
  •   :ballot_box_with_check:summarise_draws_10_variables: 78.4ms -> 78.2ms [-0.45%, +0.13%]
    Further explanation regarding interpretation and methodology can be found in the documentation.

@mjskay
Copy link
Collaborator Author

mjskay commented Nov 18, 2023

This should be ready now; the test failure in R 3.6 looks to be unrelated.

@paul-buerkner
Copy link
Collaborator

Looks good. Thank you!

@paul-buerkner paul-buerkner merged commit 9059111 into master Nov 19, 2023
9 of 10 checks passed
@mjskay mjskay deleted the matrixOps branch November 19, 2023 17:52
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