I am trying to define an expression P = Q’ * R * Q using @expression but it is not cooperating. I tried to split the matrix product and even use @NLexpression macro but no luck. Can someone suggest a way to define P?
using LinearAlgebra
using JuMP
model = Model()
n = 5 @variable(model, R[1:n, 1:n] , Symmetric) @variable(model, Q[1:n, 1:n] , Symmetric)
Thanks for the help. Apparently the workaround still doesn’t work. I got the following error
MethodError: no method matching *(::Adjoint{VariableRef, Symmetric{VariableRef, Matrix{VariableRef}}}, ::Type{QR})
Closest candidates are:
*(::Any, ::Any, ::Any, ::Any…) at /Volumes/Julia-1.7.2/Julia-1.7.app/Contents/Resources/julia/share/julia/base/operators.jl:655
*(::Union{MathOptInterface.ScalarAffineFunction{T}, MathOptInterface.ScalarQuadraticFunction{T}, MathOptInterface.VectorAffineFunction{T}, MathOptInterface.VectorQuadraticFunction{T}}, ::T) where T at ~/.julia/packages/MathOptInterface/LqT2k/src/Utilities/functions.jl:3300
*(::AbstractMatrix{T}, ::LinearAlgebra.AbstractRotation{S}) where {T, S} at /Volumes/Julia-1.7.2/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/LinearAlgebra/src/givens.jl:20
…