0

How do I restrict a matrix variable to be both Positive Semidefinite and Hermitian in CVXR? When I try to add both attributes, I get an error saying that I can only have one attribute.

Here is what I tried:

theta <- Variable(rows = 3, cols = 3, PSD = TRUE, hermitian = TRUE)

Here is the error:

Error in .local(.Object, ...) :
  Cannot set more than one special attribute.
Clayton
  • 1
  • 1

1 Answers1

0
theta <- Variable(rows = 3, cols = 3, PSD = TRUE)

This will create a matrix variable theta that is both positive semidefinite and Hermitian. CVXR will enforce both of these constraints automatically when the variable is marked as PSD.

Azhari
  • 535
  • 5
  • 20
  • 1
    Thanks. I'm also trying to apply certain constraints to the matrix variable. I need to ensure that each individual element of the matrix has modulus equal to one. I've tried working with the Mod() function, but it only works on numeric variables. Do you know if there is another way? – Clayton May 10 '23 at 12:05