JuliaAlgebra / StarAlgebras.jl

A package for computation in *-algebras with basis
MIT License
7 stars 3 forks source link

tuning scalar multiplication #56

Closed kalmarek closed 4 months ago

kalmarek commented 4 months ago

@blegat

codecov[bot] commented 4 months ago

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 :warning:
Additional details and impacted files ```diff @@ 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](https://app.codecov.io/gh/JuliaAlgebra/StarAlgebras.jl/pull/56/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaAlgebra) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/JuliaAlgebra/StarAlgebras.jl/pull/56/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaAlgebra) | `86.26% <96.29%> (+0.02%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaAlgebra#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

blegat commented 4 months ago

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 commented 4 months ago

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

kalmarek commented 4 months ago

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 commented 4 months ago

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