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

Interface for arithmetics on mutable types in Julia

Results 21 MutableArithmetics.jl issues
Sort by recently updated
recently updated
newest added

As [reported on Discourse](https://discourse.julialang.org/t/linear-programming-with-jump/34192/5?u=odow), affine expressions don't play well with `LinearAlgebra.LowerTriangular`: ```Julia julia> using JuMP julia> model = Model() A JuMP Model Feasibility problem with: Variables: 0 ariableModel mode: AUTOMATIC...

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`...

e.g. `operate_to!!(::Int, ::typeof(//), ::Int, ::Int)` doesn't work cc @kalmarek

``` using JuMP function foo() model = Model() N=3 M=4 @variable(model, x[1:N,1:M], Bin) LHS = sum(x, dims=4) RHS = fill(1, (N)) @assert size(LHS) == (N, M) @assert size(RHS) == (N,...

It is an uphill battle figuring out how to implement this interface. The only documentation I can find on how to do so is hidden in [this paper](https://proceedings.juliacon.org/papers/10.21105/jcon.00093), but even...

See https://discourse.julialang.org/t/performance-of-primal-versus-dual-forms-in-jump/116633

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...

And the remaining one (in README) can be in subtle ways not exactly correct: README says > The `MA.operate!!(op::Function, x, args...)` redirects to `op(x, args...)` if `x` is not mutable...

Closes #302 - [ ] Needs tests etc

Because people do stuff like this: https://github.com/GenXProject/GenX.jl/blob/150fe7af80410a11bd17adf544c186f898f0ddcd/src/model/core/co2.jl#L76-L83 ```Julia julia> using JuMP julia> flag = true true julia> model = Model() A JuMP Model ├ solver: none ├ objective_sense: FEASIBILITY_SENSE ├...