# NCopt

description:

[X,fX,eig_val,eig_vec,A,fA]=NCopt(f,AW) computes minimizers and the minimum of the polynomial f.

arguments:

f is an NCpoly representing a polynomial.

AW: true/false whether AWbd is called.

output:

X: from GNS - a matrix where each of its rows represents a square matrix

fX: f(X) where X is from GNS

eig_val: eigenvalues of fX

eig_vec: corresponding eigenvectors

A: from AWbd

fA: f(A) where A is from AWbd - actually on each block of A

possible usage:

NCopt(f), NCopt(f,AW)

example:

>> f = (1 - y + x*y + y*x)'*(1 - y + x*y + y*x) + (-2 + y^2)^2 + (-x + x^2)^2;

>> [X,fX,eig_val,eig_vec]=NCopt(f)

*** Minimum eigenvalue for f is 0.000000. ***

X = Columns 1 through 8

0.1492    0.1176    0.3287    0.0611    0.1176    0.9387   -0.0007   -0.2507

1.4113   -0.0868    0.0193   -0.0090   -0.0868   -1.3218    0.0909   -0.4394

Columns 9 through 16

0.3287   -0.0007    0.7765    0.0740    0.0611   -0.2507    0.0740   -0.6993

0.0193    0.0909   -1.3201   -0.4347   -0.0090   -0.4394   -0.4347    0.9773

fX = 0.0108   -0.0222    0.0066   -0.1102

-0.0222    0.2500    0.1858   -0.2756

0.0066    0.1858    0.2098   -0.4285

-0.1102   -0.2756   -0.4285    3.8200

eig_val = 0.0000         0         0         0

0    0.0427         0         0

0         0    0.3507         0

0         0         0    3.8971

eig_vec = 0.9304    0.3562   -0.0825    0.0278

0.2804   -0.5590    0.7761    0.0806

-0.2353    0.7468    0.6105    0.1191

0.0207    0.0543    0.1344   -0.9892