We could change MA to add something in the interface that allows you to do that.
For a matrix-vector product with an empty matrix and an empty vector, it won't work because we cannot get an element but we actually do not need to create any element since the result is an empty vector so this is fine.
But then how do we do the sum of an empty vector of algebra elements ?
MutableArithmetics assumes that
zero
is defined for the type of algebra elements at a few places: https://github.com/jump-dev/MutableArithmetics.jl/blob/10bf3f3a9e86061309aaab10bf6e5e7237ca04c7/src/reduce.jl#L25 https://github.com/jump-dev/MutableArithmetics.jl/blob/10bf3f3a9e86061309aaab10bf6e5e7237ca04c7/src/reduce.jl#L58 https://github.com/jump-dev/MutableArithmetics.jl/blob/10bf3f3a9e86061309aaab10bf6e5e7237ca04c7/src/implementations/LinearAlgebra.jl#L382zero(::Type{<:AlgebraElement})
is however not defined and IIUC, it cannot be defined because it needs anobject
to create the algebra and it's not in the type. Actually, withDynamicPolynomials
, I also have the issue thatzero
loses the vector of variables so maybe a solution could be found for both packages.We could change MA to add something in the interface that allows you to do that. For a matrix-vector product with an empty matrix and an empty vector, it won't work because we cannot get an element but we actually do not need to create any element since the result is an empty vector so this is fine. But then how do we do the sum of an empty vector of algebra elements ?