Constraint on non-square matrix

I have a n-dimensional decision variable “x” that has two components “x1” (dimension "d1) and “x2” (dimension “d2”) such that “d1 + d2 = n”.

I also have a (n x n)-correlation matrix between variables (x1, x2): C = [C1 C12;C12’ C2] with C1 being “d1 x d1”, C12 being “d1 x d2”, and C2 being “d2 x d2”.

x1 has constraints on it.
I am trying to impose a constraint on x2 so that its correlation to x1 (in addition to its constraint) is minimized, i.e., the optimizer will put positions in elements of x2 that are negatively correlated to (most of) elements in x1. Thus, I was thinking to enforce “x1’C12x2 <= 0” but would get an error that C12 is not square (and d1 =/= d2). Was there another re-formulation I could have tried to meet this requirement? thank you.

Your question is no clearer to me than it is to Johan at . I suggest you post a minimum reproducible example somewhere (depending on whether your code is CVX or YALMIP). Of course, any expression must have conformal (compatible) dimensions.

If x1 and x2 are both CVX variables, x1'*C12*x2 will not be allowed by CVX, even if it is conformal. CVX will allow at most one of x1,C12,x2 to be a CVX variable. YALMIP does not require that because it allows non-convexity.