We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
See https://discourse.julialang.org/t/x-allowed-in-jump-model-but-not-transpose-x/110147
julia> using JuMP, LinearAlgebra julia> model = Model() A JuMP Model Feasibility problem with: Variables: 0 Model mode: AUTOMATIC CachingOptimizer state: NO_OPTIMIZER Solver name: No optimizer attached. julia> @variable(model, x[1:2, 1:2]) 2×2 Matrix{VariableRef}: x[1,1] x[1,2] x[2,1] x[2,2] julia> A = rand(2, 2) 2×2 Matrix{Float64}: 0.879093 0.669481 0.965462 0.0239002 julia> @expression(model, sum(A[i, :] * transpose(x[i, :]) for i in 1:2)) ERROR: MethodError: no method matching promote_array_mul(::Type{Vector{Float64}}, ::Type{Transpose{VariableRef, Vector{VariableRef}}}) Closest candidates are: promote_array_mul(::Type{<:Union{Adjoint{S, V}, Transpose{S, V}}}, ::Type{<:AbstractMatrix{T}}) where {S, T, V<:(AbstractVector)} @ MutableArithmetics ~/.julia/packages/MutableArithmetics/NIXlP/src/implementations/LinearAlgebra.jl:469 promote_array_mul(::Type{<:AbstractVector{S}}, ::Type{<:Adjoint{T, <:AbstractVector{T}}}) where {S, T} @ MutableArithmetics ~/.julia/packages/MutableArithmetics/NIXlP/src/implementations/LinearAlgebra.jl:212 promote_array_mul(::Type{<:AbstractMatrix{S}}, ::Type{<:AbstractMatrix{T}}) where {S, T} @ MutableArithmetics ~/.julia/packages/MutableArithmetics/NIXlP/src/implementations/LinearAlgebra.jl:205 Stacktrace: [1] promote_operation(::typeof(*), A::Type{Vector{Float64}}, B::Type{Transpose{VariableRef, Vector{VariableRef}}}) @ MutableArithmetics ~/.julia/packages/MutableArithmetics/NIXlP/src/implementations/LinearAlgebra.jl:193 [2] promote_operation_fallback(op::typeof(MutableArithmetics.add_mul), ::Type{…}, ::Type{…}, ::Type{…}) @ MutableArithmetics ~/.julia/packages/MutableArithmetics/NIXlP/src/interface.jl:82 [3] promote_operation(::typeof(MutableArithmetics.add_mul), ::Type, ::Type, ::Type) @ MutableArithmetics ~/.julia/packages/MutableArithmetics/NIXlP/src/interface.jl:113 [4] mutability(::Type, ::Function, ::Type, ::Type, ::Type) @ MutableArithmetics ~/.julia/packages/MutableArithmetics/NIXlP/src/interface.jl:273 [5] mutability(::Matrix{AffExpr}, ::Function, ::Matrix{AffExpr}, ::Vector{Float64}, ::Transpose{VariableRef, Vector{…}}) @ MutableArithmetics ~/.julia/packages/MutableArithmetics/NIXlP/src/interface.jl:281 [6] operate!!(::typeof(MutableArithmetics.add_mul), ::Matrix{…}, ::Vector{…}, ::Transpose{…}) @ MutableArithmetics ~/.julia/packages/MutableArithmetics/NIXlP/src/rewrite.jl:93 [7] macro expansion @ ~/.julia/packages/MutableArithmetics/NIXlP/src/rewrite_generic.jl:268 [inlined] [8] macro expansion @ ~/.julia/packages/MutableArithmetics/NIXlP/src/rewrite.jl:321 [inlined] [9] macro expansion @ ~/.julia/packages/JuMP/HjlGr/src/macros.jl:257 [inlined] [10] macro expansion @ ~/.julia/packages/JuMP/HjlGr/src/macros/@expression.jl:86 [inlined] [11] macro expansion @ ~/.julia/packages/JuMP/HjlGr/src/macros.jl:393 [inlined] [12] top-level scope @ ./REPL[166]:1 Some type information was truncated. Use `show(err)` to see complete types. julia> @expression(model, sum(A[i, :] * adjoint(x[i, :]) for i in 1:2)) 2×2 Matrix{AffExpr}: 0.8790932168359455 x[1,1] + 0.9654622065979918 x[2,1] … 0.8790932168359455 x[1,2] + 0.9654622065979918 x[2,2] 0.6694813114786755 x[1,1] + 0.023900164627634002 x[2,1] 0.6694813114786755 x[1,2] + 0.023900164627634002 x[2,2]
The text was updated successfully, but these errors were encountered:
import MutableArithmetics as MA using LinearAlgebra x = BigInt[1 2; 3 4] A = rand(2, 2) MA.@rewrite(sum(A[i, :] * transpose(x[i, :]) for i in 1:2))
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
See https://discourse.julialang.org/t/x-allowed-in-jump-model-but-not-transpose-x/110147
The text was updated successfully, but these errors were encountered: