Variable definition for hermitian matrix


Let’s say I have following hermitian matrix 3 by 3:

 X=[  1.1025 + 0.0000i  -0.5512 + 0.9548i  -0.5512 - 0.9548i
     -0.5512 - 0.9548i   1.1025 + 0.0000i  -0.5513 + 0.9548i
     -0.5512 + 0.9548i  -0.5513 - 0.9548i   1.1025 + 0.0000i]

I would like to define a variable for each entry of the matrix and tried do it as follows:

variable X1_1  
variable X1_2 complex
variable X2_2  
variable X1_3 complex
variable X2_3 complex
variable X3_3  

And construct the X as follows:

X= [   X1_1   X1_2   X1_3;...
       X1_2'  X2_2   X2_3;...
       X1_3'  X2_3'  X3_3]

Am I right what I’m doing? Any help will be appreciated.

What are you trying to do with X after it is constructed?

Are the diagonal elements of X always real? If so, then your X is “correct”, but you have defined it in a rather laborious way, which is not a big deal for a 3 by 3 matrix, but would be for a large matrix. if the diagonal of X needs to be real, you could add a constraint:

variable X(n,n) hermitian
imag(diag(X)) == 0

By using similar block matrixes I will build a bigger sparse hermitian matrix. In some case the diagonals will be real, for some it will be complex number.
Do you think that I must have imag(diag(X)) == 0 constraint to make diagonals real or it is optional.

If you have defined the elements to be complex or (as part of a) hermitian (matrix), then in general, you need a constraint to ensure those elements are real. If the elements are defined to be real (i…e. complex or hermitian not specified), then a constraint is not needed.

Thank you for clear explanation of that Mark. Appreciated.