I have the following quadratic optimization problem to solve:

$$max: x'\Sigma x$$ $$Sub: x'x = 1$$

Where,

$$\Sigma = \left[ \begin{matrix} 402.0571 & 266.6035\\ 266.6035 & 305.2564 \end{matrix} \right]$$

Searching the internet I found the CVXPY package that I think I can solve the problem, I did the implementation

library(CVXR)
Sigma = matrix(c(402.0571, 266.6035, 266.6035, 305.2564), nc = 2)
w = Variable(2)

constraint = quad_form(w, diag(2)) == 1
problem = Problem(objective, constraints = list(constraint))
result = solve(problem)


however, when implementing it I get the following problem:

Error in construct_intermediate_chain(object, candidate_solvers, gp = gp) :
Problem does not follow DCP rules. However, the problem does follow DGP rules. Consider calling this
function with gp = TRUE


I have no knowledge in the area of ​​convex optimization, but which PCD rule am I violating? Or is there any other mistake?

It seems to me that it is a lot easier, and does not require a computer. If you take the (vector) derivative of your quadratic form, you have that the conditions of an optimal point are: $$2\Sigma{}x = 0$$ This is a homogeneous system, hence undetermined up to an scale factor: if $$x$$ is a solution, so is $$kx$$ for any $$k$$; but you can remove this indeterminacy using the condition $$x'x = 1$$.