Block triangular matrix in Convex.jl

Hello,

Is there a straightforward way to constrain a variable in Convex.jl to be block triangular (either upper or lower)? I am looking for something like YALMIP’s blkvar command. It seems rather tedious to constrain the upper/lower elements of a matrix to be zero. Thank you!

1 Like

Hi @jens-rataczak, welcome to the forum :smile:

Nope. I don’t think we have support for triangular matrices. What are you trying to model?

Thanks!

I am trying to model a matrix that looks like the following
Screenshot 2024-08-13 at 4.27.00 PM

where each of the K_ij are matrices themselves. My approach right now is to define a fucntion

function LowerBlockTriVariable(N, m, n)
    K = []
    X = Variable(m, n)
    push!(K, X)
    L = [X zeros(m, n*N)]
    count = 2
    for j = 2:N
        X = [Variable(m, n) for k = j:j+count-1]
        push!(K, X)
        a = [hcat(X...) zeros(m, n*(N+1-j))]
        L = [L; a]
        count += 1
    end
    L, K
end

that inserts a matrix variable into the desired location of the whole block matrix, but I was just wondering if there was a more efficient way to do so.

1 Like