Hi !

I am trying to express a quadratic function in the form

1/2 x’ Q x + a’ x in GAMS ( ’ means the transpose) because I would like to generate random PSD Q matrices with MATLAB and export to GAMS with *.gdx files.

I think that with the following example it will more clear what i need:

If we consider the following quadratic function given by f(x) = 1/2 x’ * Q * x + a’ * x

with a’ = [ 1 1] and Q = [2 1; 1 2]

I can expand the quadratic function and type in GAMS as

f(x) = x1^2 + x2^2 + x1*x2 + x1 * x2

However I need to express the quadratic equation in function of Q and a.

I tested to do somthing similar that when I need to multiply 3 matrices in gams:

t’ * Q * t

where

t’ = [ 1 1] and

Q = [2 1; 1 2]

\

Set

n /n1*n2/

;

Alias (n, k)

;

Parameters

tT(i) / n1 1, n2 1/

C(i)

H

;

Table Q(n,n)

n1 n2

n1 2 1

n2 1 2

;

C(n) = sum(k, aT(k) * B(n,k ) ) ;

H = sum(k, C(k) * aT(k));

display H

;

But does not work.

Thank you for your time,

## Juan

\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.

To post to this group, send email to gamsworld@googlegroups.com.

Visit this group at http://groups.google.com/group/gamsworld.

For more options, visit https://groups.google.com/d/optout.