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

tuning scalar multiplication #56

Merged
merged 5 commits into from
Jul 5, 2024
Merged

tuning scalar multiplication #56

merged 5 commits into from
Jul 5, 2024

Conversation

kalmarek
Copy link
Collaborator

@kalmarek kalmarek commented Jul 4, 2024

@kalmarek kalmarek requested a review from blegat July 4, 2024 12:22
Copy link

codecov bot commented Jul 4, 2024

Codecov Report

Attention: Patch coverage is 96.29630% with 1 line in your changes missing coverage. Please review.

Project coverage is 86.26%. Comparing base (f998c9f) to head (7a0232e).

Files Patch % Lines
src/coefficients.jl 92.85% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #56      +/-   ##
==========================================
+ Coverage   86.23%   86.26%   +0.02%     
==========================================
  Files          14       14              
  Lines         741      757      +16     
==========================================
+ Hits          639      653      +14     
- Misses        102      104       +2     
Flag Coverage Δ
unittests 86.26% <96.29%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@blegat
Copy link
Member

blegat commented Jul 4, 2024

It's maybe cleaner to do something like

"""
    lmul(a, X)
Multiplies the coefficients of `X` by `a`.
"""
function lmul end
function lmul(a, X::AlgebraElement)
    return MA.operate_to(similar(X), lmul, a, X)
end
Base.:*(a, X::AlgebraEleemnt) = lmul(a, X)

where lmul would be an explicit way to multiply the coefficients (I'm open to other names, in MP, I call it left_constant_mult I think but we don't have to use the same name)

@kalmarek
Copy link
Collaborator Author

kalmarek commented Jul 4, 2024

I'm not sure it changes much, I don't intend these functions to be used by anyone outside ;)

@kalmarek
Copy link
Collaborator Author

kalmarek commented Jul 4, 2024

It's maybe cleaner to do something like

"""
    lmul(a, X)
Multiplies the coefficients of `X` by `a`.
"""
function lmul end
function lmul(a, X::AlgebraElement)
    return MA.operate_to(similar(X), lmul, a, X)
end
Base.:*(a, X::AlgebraEleemnt) = lmul(a, X)

where lmul would be an explicit way to multiply the coefficients (I'm open to other names, in MP, I call it left_constant_mult I think but we don't have to use the same name)

It serves precisely the opposite role, where the coefficients stay the same and we shift keys ;)

@kalmarek kalmarek mentioned this pull request Jul 4, 2024
3 tasks
Copy link
Member

@blegat blegat left a comment

Choose a reason for hiding this comment

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

There is some added allocation on nightly but it might be due to a change in Julia since yesterday

@kalmarek
Copy link
Collaborator Author

kalmarek commented Jul 5, 2024

Since you approved, fixing nightly is on you from now on :D

@kalmarek kalmarek merged commit ba3697f into main Jul 5, 2024
16 of 22 checks passed
@kalmarek kalmarek deleted the mk/multiplication branch July 5, 2024 13:25
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.

2 participants