[37] | 1 | function display(X) |
---|
| 2 | %DISPLAY (overloaded) |
---|
| 3 | |
---|
| 4 | % Author Johan Löfberg |
---|
| 5 | % $Id: display.m,v 1.16 2006/07/26 20:17:57 joloef Exp $ |
---|
| 6 | |
---|
| 7 | switch(X.typeflag) |
---|
| 8 | case {0,9} |
---|
| 9 | n = X.dim(1); |
---|
| 10 | m = X.dim(2); |
---|
| 11 | if (n*m==1) |
---|
| 12 | |
---|
| 13 | linearbilinearquadraticsigmonial = is(X,'LBQS'); |
---|
| 14 | if linearbilinearquadraticsigmonial(1) |
---|
| 15 | classification = 'Linear scalar '; |
---|
| 16 | elseif linearbilinearquadraticsigmonial(4) |
---|
| 17 | classification = 'Sigmonial scalar '; |
---|
| 18 | elseif linearbilinearquadraticsigmonial(2) |
---|
| 19 | classification = 'Bilinear scalar '; |
---|
| 20 | elseif linearbilinearquadraticsigmonial(3) |
---|
| 21 | classification = 'Quadratic scalar '; |
---|
| 22 | else |
---|
| 23 | classification = 'Polynomial scalar '; |
---|
| 24 | end |
---|
| 25 | |
---|
| 26 | if ~isreal(X.basis) |
---|
| 27 | classification = [classification '(complex']; |
---|
| 28 | else |
---|
| 29 | classification = [classification '(real']; |
---|
| 30 | end |
---|
| 31 | |
---|
| 32 | if is(X,'compound') |
---|
| 33 | classification = [classification ', derived']; |
---|
| 34 | end |
---|
| 35 | |
---|
| 36 | if ~islinear(X) |
---|
| 37 | variables = getvariables(X); |
---|
| 38 | monomtable = yalmip('monomtable'); |
---|
| 39 | if ((nnz(getbasematrix(X,0))==0) ) & (sum(diff(sum(monomtable(variables,:),2)))==0) |
---|
| 40 | classification = [classification ', homogeneous']; |
---|
| 41 | end |
---|
| 42 | end |
---|
| 43 | if any(ismember(depends(X),yalmip('intvariables'))) |
---|
| 44 | classification = [classification ', integer']; |
---|
| 45 | else |
---|
| 46 | if any(ismember(depends(X),yalmip('binvariables'))) |
---|
| 47 | classification = [classification ', binary']; |
---|
| 48 | else |
---|
| 49 | if any(ismember(depends(X),yalmip('uncvariables'))) |
---|
| 50 | classification = [classification ', uncertain']; |
---|
| 51 | end |
---|
| 52 | end |
---|
| 53 | end |
---|
| 54 | |
---|
| 55 | nvars = length(depends(X)); |
---|
| 56 | if nvars == 1 |
---|
| 57 | classification = [classification ', ' num2str(nvars) ' variable']; |
---|
| 58 | else |
---|
| 59 | classification = [classification ', ' num2str(nvars) ' variables']; |
---|
| 60 | end |
---|
| 61 | |
---|
| 62 | if any(ismember(depends(X),yalmip('parvariables'))) |
---|
| 63 | classification = [classification ', parametric']; |
---|
| 64 | end |
---|
| 65 | if ~isnan(double(X)) |
---|
| 66 | classification = [classification ', current value : ' num2str(double(X))]; |
---|
| 67 | end |
---|
| 68 | classification = [classification ')']; |
---|
| 69 | |
---|
| 70 | disp([classification]); |
---|
| 71 | else |
---|
| 72 | |
---|
| 73 | if islinear(X) |
---|
| 74 | classification = 'Linear matrix variable '; |
---|
| 75 | elseif is(X,'sigmonial') |
---|
| 76 | classification = 'Sigmonial matrix variable '; |
---|
| 77 | elseif is(X,'bilinear') |
---|
| 78 | classification = 'Bilinear matrix variable '; |
---|
| 79 | elseif is(X,'quadratic') |
---|
| 80 | classification = 'Quadratic matrix variable '; |
---|
| 81 | else |
---|
| 82 | classification = 'Polynomial matrix variable '; |
---|
| 83 | end |
---|
| 84 | |
---|
| 85 | if isreal(X.basis) |
---|
| 86 | if issymmetric(X) |
---|
| 87 | info = ' (symmetric, '; |
---|
| 88 | else |
---|
| 89 | info = ' (full, '; |
---|
| 90 | end; |
---|
| 91 | info = [info 'real']; |
---|
| 92 | else |
---|
| 93 | if issymmetric(X) |
---|
| 94 | info = ' (symmetric, '; |
---|
| 95 | elseif ishermitian(X) |
---|
| 96 | info = ' (hermitian, '; |
---|
| 97 | else |
---|
| 98 | info = ' (full, '; |
---|
| 99 | end; |
---|
| 100 | info = [info 'complex']; |
---|
| 101 | end; |
---|
| 102 | |
---|
| 103 | if is(X,'compound') |
---|
| 104 | info = [info ', derived']; |
---|
| 105 | end |
---|
| 106 | |
---|
| 107 | if X.typeflag==9 |
---|
| 108 | info = [info ', KYP']; |
---|
| 109 | end |
---|
| 110 | if any(ismember(depends(X),yalmip('intvariables'))) |
---|
| 111 | info = [info ', integer']; |
---|
| 112 | else |
---|
| 113 | if any(ismember(depends(X),yalmip('binvariables'))) |
---|
| 114 | info = [info ', binary']; |
---|
| 115 | else |
---|
| 116 | if any(ismember(depends(X),yalmip('uncvariables'))) |
---|
| 117 | info = [info ', uncertain']; |
---|
| 118 | end |
---|
| 119 | end |
---|
| 120 | end |
---|
| 121 | if any(ismember(depends(X),yalmip('parvariables'))) |
---|
| 122 | info = [info ', parametric']; |
---|
| 123 | end |
---|
| 124 | |
---|
| 125 | xvars = depends(X); |
---|
| 126 | nvars = length(xvars); |
---|
| 127 | if nvars == 1 |
---|
| 128 | info = [info ', ' num2str(nvars) ' variable']; |
---|
| 129 | else |
---|
| 130 | info = [info ', ' num2str(nvars) ' variables']; |
---|
| 131 | end |
---|
| 132 | |
---|
| 133 | n = X.dim(1); |
---|
| 134 | m = X.dim(2); |
---|
| 135 | |
---|
| 136 | if (n<100) & (n==m) |
---|
| 137 | x = recover(xvars); |
---|
| 138 | if ~any(any(isnan(double(x)))) |
---|
| 139 | doubleX = double(X); |
---|
| 140 | try |
---|
| 141 | eigX = eig(doubleX); |
---|
| 142 | info = [info ', eigenvalues between [' num2str(min(eigX)) ',' num2str(max(eigX)) ']']; |
---|
| 143 | catch |
---|
| 144 | end |
---|
| 145 | end |
---|
| 146 | elseif n~=m |
---|
| 147 | x = recover(xvars); |
---|
| 148 | if ~any(any(isnan(double(x)))) |
---|
| 149 | doubleX = double(X); |
---|
| 150 | try |
---|
| 151 | info = [info ', values in range [' num2str(min(min(doubleX))) ',' num2str(max(max(doubleX))) ']']; |
---|
| 152 | catch |
---|
| 153 | end |
---|
| 154 | end |
---|
| 155 | end |
---|
| 156 | |
---|
| 157 | info = [info ')']; |
---|
| 158 | disp([classification num2str(n) 'x' num2str(m) info]); |
---|
| 159 | end; |
---|
| 160 | case 1 |
---|
| 161 | disp('Relational object'); |
---|
| 162 | case 3 |
---|
| 163 | disp('Relational object'); |
---|
| 164 | case 4 |
---|
| 165 | disp('Relational object'); |
---|
| 166 | case 5 |
---|
| 167 | disp('Cone object'); |
---|
| 168 | case 6 |
---|
| 169 | disp('logdet object'); |
---|
| 170 | case 7 |
---|
| 171 | disp('Integrality constraint'); |
---|
| 172 | case 10 |
---|
| 173 | disp('Eigenvalue object'); |
---|
| 174 | case 11 |
---|
| 175 | disp('SOS object'); |
---|
| 176 | otherwise |
---|
| 177 | end |
---|