Skip to content

Commit

Permalink
sub! -> MA
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat committed Feb 26, 2024
1 parent 55be591 commit de56536
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/arithmetic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function _preallocate_output(X::AlgebraElement, Y::AlgebraElement, op)
end

Base.:+(X::AlgebraElement, Y::AlgebraElement) = MA.operate_to!(_preallocate_output(X, Y, +), +, X, Y)
Base.:-(X::AlgebraElement, Y::AlgebraElement) = sub!(_preallocate_output(X, Y, -), X, Y)
Base.:-(X::AlgebraElement, Y::AlgebraElement) = MA.operate_to!(_preallocate_output(X, Y, -), -, X, Y)
Base.:*(X::AlgebraElement, Y::AlgebraElement) = MA.operate_to!(_preallocate_output(X, Y, *), *, X, Y)

Base.:^(a::AlgebraElement, p::Integer) = Base.power_by_squaring(a, p)
Expand Down Expand Up @@ -67,7 +67,7 @@ function MA.operate_to!(res::AlgebraElement, ::typeof(+), X::AlgebraElement, Y::
return res
end

function sub!(res::AlgebraElement, X::AlgebraElement, Y::AlgebraElement)
function MA.operate_to!(res::AlgebraElement, ::typeof(-), X::AlgebraElement, Y::AlgebraElement)
@assert parent(res) === parent(X) === parent(Y)
MA.operate_to!(res, -, Y)
MA.operate_to!(res, +, res, X)
Expand Down

0 comments on commit de56536

Please sign in to comment.