Rev | Line | |
---|
[37] | 1 | function res = computeconstraintresiduals(p,x) |
---|
| 2 | |
---|
| 3 | res= []; |
---|
| 4 | if ~isempty(p.F_struc) |
---|
| 5 | vecres = p.F_struc*[1;x]; |
---|
| 6 | |
---|
| 7 | if p.K.f>0 |
---|
| 8 | res = -abs(vecres(1:p.K.f)); |
---|
| 9 | end |
---|
| 10 | if p.K.l>0 |
---|
| 11 | res = [res;vecres(p.K.f+1:p.K.f+p.K.l)]; |
---|
| 12 | end |
---|
| 13 | |
---|
| 14 | if p.K.q(1)>0 |
---|
| 15 | top = 1+p.K.f+p.K.l; |
---|
| 16 | for i = 1:length(p.K.q) |
---|
| 17 | n = p.K.q(i); |
---|
| 18 | X = vecres(top:top+n-1);top = top+n; |
---|
| 19 | res = [res;X(1)-norm(full(X(2:end)))]; |
---|
| 20 | end |
---|
| 21 | end |
---|
| 22 | |
---|
| 23 | if p.K.s(1)>0 |
---|
| 24 | top = 1+p.K.f+p.K.l+p.K.q; |
---|
| 25 | for i = 1:length(p.K.s) |
---|
| 26 | n = p.K.s(i); |
---|
| 27 | X = reshape(vecres(top:top+n^2-1),n,n);top = top+n^2; |
---|
| 28 | res = [res;min(eig(X))]; |
---|
| 29 | end |
---|
| 30 | end |
---|
| 31 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.