Re: [R] quadratic programming-maximization instead of

2012-01-04 Thread Ravi Varadhan
Maximizing f(x) = x'Ax makes sense only when A is negative-definite. Therefore, this is the same as minimizing x'Bx, where B = -A, and B is positive-definite. In other words, you should be able to simply flip the sign of the original matrix . This should yield a positive-definite matrix

Re: [R] quadratic programming-maximization instead of minization

2012-01-03 Thread Tsjerk Wassenaar
Hi Riccardo, Would it be possible to use max(diag(D))*diag(ncol(D)) - D ? That also reverses the order of eigenvalues/-vectors. Cheers, Tsjerk On Jan 2, 2012 4:35 PM, riccardo24 riccardo.giacome...@gmail.com wrote: Hi, I need to maximize a quadratic function under constraints in R. For

Re: [R] quadratic programming-maximization instead of minization

2012-01-03 Thread Tsjerk Wassenaar
Sorry, that should've been sum(diag(D)) or max(eigen(D)$values) in stead of max(diag(D)). Tsjerk On Jan 3, 2012 4:52 PM, Tsjerk Wassenaar tsje...@gmail.com wrote: Hi Riccardo, Would it be possible to use max(diag(D))*diag(ncol(D)) - D ? That also reverses the order of eigenvalues/-vectors.

[R] quadratic programming-maximization instead of minization

2012-01-02 Thread riccardo24
Hi, I need to maximize a quadratic function under constraints in R. For minimization I used solve.QP but for maximization it is not useful since the matrix D of the quadratic function should be positive definite hence I cannot simply change the sign. any suggestion ? thanks -- View this message

Re: [R] quadratic programming-maximization instead of minization

2012-01-02 Thread Ken Hutchison
I don't have experience with this in R and I'm not sure I understand the question that well but maybe something like nearPD()? Ken Hutchison On Jan 2, 2012, at 6:36 AM, riccardo24 riccardo.giacome...@gmail.com wrote: Hi, I need to maximize a quadratic function under constraints in R. For