MutableArithmetics.jl icon indicating copy to clipboard operation
MutableArithmetics.jl copied to clipboard

operate_fallback!! shouldn't force the first argument to be copied

Open blegat opened this issue 1 year ago • 0 comments

In this redirection: https://github.com/jump-dev/MutableArithmetics.jl/blob/7344c9468072bd663feec7e4cdc1a0e98e34ea19/src/interface.jl#L592-L599 We redirect to operate because for instance, when it's used in the @rewrite macro, we want to modify the result so it cannot depend on the the arguments. However, since the first argument was given to operate!!, it can actually be modified! So in this case, we want a result that does not depend on any argument except the first one. This can causes performance issues in https://github.com/JuliaAlgebra/StarAlgebras.jl/pull/21/files#diff-3f191d1ba6c7bc538c1bf193064434a4984a0457baac3da62c9e6dede5d566aa for canonical as reported by @kalmarek

blegat avatar May 16 '24 09:05 blegat