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

Upstream #47

Open
6 of 8 tasks
blegat opened this issue May 5, 2020 · 0 comments
Open
6 of 8 tasks

Upstream #47

blegat opened this issue May 5, 2020 · 0 comments
Milestone

Comments

@blegat
Copy link
Member

blegat commented May 5, 2020

Some implementations in Base/LinearAlgebra/SparseArrays have the following assumption:

  1. zero(T) isa T
  2. one(T) isa T
  3. -(::T) isa T
  4. +(::T, ::T) isa T
  5. *(::T, ::T) isa T
  6. x * y = y * x
  7. Implements ==
  8. *(x::T, y::S) = *(promote(x, y)...)

However, these assumptions are violated for the following types where MP stands for MultivariatePolynomials and MOI stand for MathOptInterface.

Type 1 2 3 4 5 6 7 8
Bool x x
JuMP.VariableRef x x x x x x
MOI.VariableRef x x x x x x
MOI.ScalarAffineExpression x x x
MP.AbstractVariable x x x x x
MP.AbstractMonomial x x x x
MP.AbstractTerm x
AbstractArray x
Non-commutative MP.AbstractVariable x x x x x x

The current approach is to create an AbstractMutable type and redefine methods for the methods defined in Base for these types.
The long term solution would be to fix the issue upstream. In the short term, as Julia v1.5 might be an LTS, that would allow the package to be simplified once we drop Julia v1.0 for all the fixes that are merged before Julia v1.5.

The following are the issues in LinearAlgebra.

The following are the issues in SparseArrays.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants