[X,fX,eig_min,flat,error_flat,norm_H,range]=NCeigOptRand(f,S,d) computes minimizers and the minimum of the polynomial f on D_s and tries to extend dual solution to a flat solution using randomization


f is an NCpoly representing a polynomial

S is a set of nc polynomails defining D_S

d is a starting degree for the hierarchy (even number)



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

fX: f(X) where X is from GNS

eig_min: eigenvalues of fX

flat = 1 if program finds flat extension

flat = 0, if program does not find flat extension

flat = -1 if the primal problem is infeasible (f is not in the module M_S,d)

error_flat ... norm of the difference between the flat extension returned by randomization idea and the brute force flat extension (which is no more feasible for constraints)

norm_H ... Frobenious norm of flat extension returned by randomization idea

range ... diference between ranks of original matrix and flat extension used 3 methods for rank computation

possible usage: