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

Creating a new element #40

Open
blegat opened this issue Jun 12, 2024 · 1 comment
Open

Creating a new element #40

blegat opened this issue Jun 12, 2024 · 1 comment

Comments

@blegat
Copy link
Member

blegat commented Jun 12, 2024

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#L382
zero(::Type{<:AlgebraElement}) is however not defined and IIUC, it cannot be defined because it needs an object to create the algebra and it's not in the type.
Actually, with DynamicPolynomials, I also have the issue that zero 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 ?

@blegat
Copy link
Member Author

blegat commented Jun 14, 2024

Maybe the answer to a sum of an empty vector is MA.Zero() and the product between a n x 0 matrix with a 0-length vector if a Vector{MA.Zero}

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

No branches or pull requests

1 participant