-
Notifications
You must be signed in to change notification settings - Fork 0
/
vsdpTest.m
498 lines (457 loc) · 15.8 KB
/
vsdpTest.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
function tests = vsdpTest()
% VSDPTEST Runs a testsuite for VSDP (version 2006).
%
% Example:
%
% clc; table (runtests ('vsdpTest')) % Matlab
% clc; vsdpTest; % Octave
%
% See also demovsdp.
% Copyright 2016-2017 Kai T. Ohlhus ([email protected])
if (~exist('sqlp.m', 'file'))
fprintf(1, '%s. %s\n\n\t%s\n\n%s.\n\n', ...
'Approximate solver "SDPT3" not found', ...
'Get a recent version from', 'https://github.com/sqlp/sdpt3', ...
'and run "install_sdpt3" from the root directory');
error('VSDP:vsdpTest:noSDPT3', 'SDPT3 not found');
end
if (~exist('INTLAB_Version_9.m', 'file'))
fprintf(1, '%s. %s\n\n\t%s\n\n%s.\n\n', ...
'Interval toolbox "INTLAB" (>= 9) not found', ...
'Get a recent version from', 'http://www.ti3.tuhh.de/rump/intlab', ...
'and run "startintlab" from the root directory');
error('VSDP:vsdpTest:noINTLAB', 'INTLAB (>= 9) not found');
end
if (exist('OCTAVE_VERSION','builtin'))
addpath(fullfile(pwd,'octave'));
end
tests = functiontests(localfunctions);
end
function [blk,A,C,b] = example_feasible()
blk(1,:) = {'s'; 2};
A{1,1} = [0 1; 1 0];
A{2,1} = [1 1; 1 1];
C{1} = [1 0; 0 1];
b = [1; 2.0001];
end
function [blk,A,C,b] = example_DELTA(DELTA)
% DELTA > 0: the optimal value is -0.5, and strong duality holds,
% DELTA = 0: ill-posed problem with nonzero duality gap,
% DELTA < 0: primal and dual infeasible.
C{1} = [ 0 1/2 0;
1/2 DELTA 0;
0 0 DELTA];
A{1,1} = [ 0 -1/2 0;
-1/2 0 0;
0 0 0];
A{2,1} = [1 0 0;
0 0 0;
0 0 0];
A{3,1} = [0 0 1;
0 0 0;
1 0 0];
A{4,1} = [0 0 0;
0 0 1;
0 1 0];
b = [1; 2*DELTA; 0; 0];
blk(1,:) = {'s'; 3};
end
function [blk,A,C,b,DELTA] = example_DELTA_feasible()
DELTA = 1e-4;
[blk,A,C,b] = example_DELTA(DELTA);
end
function [blk,A,C,b,DELTA] = example_DELTA_infeasible()
DELTA = -1e-4;
[blk,A,C,b] = example_DELTA(DELTA);
end
function [blk,A,C,b] = example_primal_infeasible()
blk(1,:) = {'s'; 2};
A{1,1} = [1 0; 0 0];
A{2,1} = [0 1; 1 0.005];
C{1} = [0 0; 0 0];
b = [-0.01; 1];
end
function testVSVEC(testCase)
vsvec_len = @(blk) sum(blk .* (blk + 1) ./ 2);
A = {ones(3)};
vAref = [1 sqrt(2) sqrt(2) 1 sqrt(2) 1]';
vA = vsvec(A);
verifyEqual(testCase, vA, vAref)
verifyEqual(testCase, length(vA), vsvec_len(3))
vA = vsvec(A,0);
verifyEqual(testCase, vA, vAref)
verifyEqual(testCase, length(vA), vsvec_len(3))
vAref = sparse(vAref);
verifyEqual(testCase, vsvec(A,1), vAref)
A = {[10 2 3; 2 11 4; 3 4 12]; ones(3)};
vAref = [10 4 6 11 8 12 1 2 2 1 2 1]';
vA = vsvec(A,0,2);
verifyEqual(testCase, vA, vAref)
verifyEqual(testCase, length(vA), 2*vsvec_len(3))
A = {[10 2 3; 2 11 4; 3 4 12]; sparse(ones(3))};
vA = vsvec(A,0,2);
verifyEqual(testCase, vA, vAref)
verifyEqual(testCase, length(vA), 2*vsvec_len(3))
end
function testVSMAT(testCase)
AA = {{ones(3)};
{[10 2 3; 2 11 4; 3 4 12]; ones(3)};};
for i = 1:length(AA)
A = AA{i};
blk = zeros(length(A),1);
for j = 1:length(A)
blk(j) = length(A{j});
end
% test full input + full output
% default call
verifyEqual(testCase, isequal(A,vsmat(vsvec(A),blk)), true)
% sparseflag = 0
verifyEqual(testCase, isequal(A,vsmat(vsvec(A),blk,0)), true)
verifyEqual(testCase, isequal(A,vsmat(vsvec(A,0),blk)), true)
verifyEqual(testCase, isequal(A,vsmat(vsvec(A,0),blk,0)), true)
% intermediate sparse vector
verifyEqual(testCase, isequal(A,vsmat(vsvec(A,1),blk,0)), true)
% sparseflag = 0 + different mults
mult = [sqrt(2), 2, 1];
for j = 1:length(mult)
verifyEqual(testCase, ...
isequal(A,vsmat(vsvec(A,0,mult(j)),blk,0,1/mult(j))), true)
end
% test sparse input + sparse output
for j = 1:length(A)
A{j} = sparse(A{j});
end
% intermediate full vector
verifyEqual(testCase, isequal(A,vsmat(vsvec(A,0),blk,1)), true)
% intermediate sparse vector
verifyEqual(testCase, isequal(A,vsmat(vsvec(A,1),blk,1)), true)
end
end
function testVEIGSYM(testCase)
A = [1 2 3; 2 1 4; 3 4 5];
% test real input
lambda = veigsym(A);
verifyEqual(testCase, mid(lambda), eig(A), 'RelTol', 4*eps())
verifyEqual(testCase, rad(lambda), zeros(3,1), 'AbsTol', 1e-14)
% test interval input
lambda_inf = [-1.5170; -0.6226; 9.0495];
lambda_sup = [-1.4569; -0.5625; 9.1096];
A = midrad(A, 1e-2*ones(3));
lambda = veigsym(A);
verifyEqual(testCase, inf(lambda), lambda_inf, 'RelTol', 1e-4)
verifyEqual(testCase, sup(lambda), lambda_sup, 'RelTol', 1e-4)
verifyEqual(testCase, sup(lambda), lambda_sup, 'RelTol', 1e-4)
end
function testVULS(testCase)
A = [1 1 1 1];
B = [0 1 0 infsup(0.9,1.1)];
a = infsup(2.9,3.1);
b = 2;
xl = [0 1 0 0]';
xu = [4 1 1 2]';
x0 = [0 1 0 1]';
[X,J,I,N] = vuls(A,a,B,b,xl,xu,x0);
X_ref = infsup([0; 1; 0; 0.8878],[0.0001; 1; 0.0001; 1.1122]);
verifyEqual(testCase, all(in(X,X_ref)), true)
verifyEqual(testCase, isempty(J.ineqlin), true)
verifyEqual(testCase, isempty(J.lower), true)
verifyEqual(testCase, isempty(J.upper), true)
verifyEqual(testCase, I, 4)
verifyEqual(testCase, N, [1, 2, 3]')
end
function testVSDPCHECK_example_feasible(testCase)
[blk,A,C,b] = example_feasible();
[m,n] = vsdpcheck(blk,A,C,b);
verifyEqual(testCase, m, 2)
verifyEqual(testCase, n, 1)
end
function testVSDPCHECK_example_DELTA_feasible(testCase)
[blk,A,C,b,~] = example_DELTA_feasible();
[m,n] = vsdpcheck(blk,A,C,b);
verifyEqual(testCase, m, 4)
verifyEqual(testCase, n, 1)
end
function testVSDPCHECK_example_DELTA_infeasible(testCase)
[blk,A,C,b,~] = example_DELTA_infeasible();
[m,n] = vsdpcheck(blk,A,C,b);
verifyEqual(testCase, m, 4)
verifyEqual(testCase, n, 1)
end
function testVSDPCHECK_example_primal_infeasible(testCase)
[blk,A,C,b] = example_primal_infeasible();
[m,n] = vsdpcheck(blk,A,C,b);
verifyEqual(testCase, m, 2)
verifyEqual(testCase, n, 1)
end
function testSDPT3_conversion_example_feasible(testCase)
[blk,A,C,b] = example_feasible();
[At,Ct] = vsdp_to_sdpt3(blk,A,C,b);
[AA,CC] = sdpt3_to_vsdp(blk,At,Ct,b);
for i = 1:length(b)
verifyEqual(testCase, full(AA{i,1}), A{i,1})
end
verifyEqual(testCase, CC, C)
end
function testSDPT3_conversion_example_DELTA_feasible(testCase)
[blk,A,C,b,~] = example_DELTA_feasible();
[At,Ct] = vsdp_to_sdpt3(blk,A,C,b);
[AA,CC] = sdpt3_to_vsdp(blk,At,Ct,b);
for i = 1:length(b)
verifyEqual(testCase, full(AA{i,1}), A{i,1})
end
verifyEqual(testCase, CC, C)
end
function testSDPT3_conversion_example_DELTA_infeasible(testCase)
[blk,A,C,b,~] = example_DELTA_infeasible();
[At,Ct] = vsdp_to_sdpt3(blk,A,C,b);
[AA,CC] = sdpt3_to_vsdp(blk,At,Ct,b);
for i = 1:length(b)
verifyEqual(testCase, full(AA{i,1}), A{i,1})
end
verifyEqual(testCase, CC, C)
end
function testSDPT3_conversion_example_primal_infeasible(testCase)
[blk,A,C,b] = example_primal_infeasible();
[At,Ct] = vsdp_to_sdpt3(blk,A,C,b);
[AA,CC] = sdpt3_to_vsdp(blk,At,Ct,b);
for i = 1:length(b)
verifyEqual(testCase, full(AA{i,1}), A{i,1})
end
verifyEqual(testCase, CC, C)
end
function testMYSDPS_example_feasible(testCase)
[blk,A,C,b] = example_feasible();
[objt,X,y,Z,info] = mysdps(blk,A,C,b);
verifyEqual(testCase, objt, [1, 1], 'RelTol', 1e-4)
verifyEqual(testCase, X{1}, ones(2)/2, 'RelTol', 1e-4)
verifyEqual(testCase, objt(1), trace(C{1} * X{1}), 'RelTol', 1e-4)
verifyEqual(testCase, objt(2), b'*y, 'RelTol', 1e-4)
verifyEqual(testCase, Z{1}, C{1} - A{1,1}*y(1) - A{2,1}*y(2), 'RelTol', 1e-4)
verifyEqual(testCase, info, 0)
end
function testMYSDPS_example_DELTA_feasible(testCase)
[blk,A,C,b,DELTA] = example_DELTA_feasible();
[objt,X,y,Z,info] = mysdps(blk,A,C,b);
verifyEqual(testCase, objt, [-0.5 -0.5], 'RelTol', DELTA)
testX = X{1};
verifyEqual(testCase, testX(1:2,1:2), [2*DELTA, -1; -1, 1/(2*DELTA)], ...
'RelTol', DELTA)
verifyEqual(testCase, testX(3,3) >= 0, true)
verifyEqual(testCase, y(2), -1/(4*DELTA), 'RelTol', DELTA)
verifyEqual(testCase, y([1,3,4]), [0;0;0], 'AbsTol', DELTA)
verifyEqual(testCase, objt(1), trace(C{1} * X{1}), 'RelTol', DELTA)
verifyEqual(testCase, objt(2), b'*y, 'RelTol', DELTA)
D = C{1};
for j = 1:4
D = D - y(j) * A{j,1};
end
verifyEqual(testCase, Z{1}, D, 'RelTol', DELTA)
verifyEqual(testCase, info, 0)
end
function testMYSDPS_example_DELTA_infeasible(testCase)
[blk,A,C,b,~] = example_DELTA_infeasible();
[~,~,~,~,info] = mysdps(blk,A,C,b);
% indication of primal infeasibility
verifyEqual(testCase, info, 1)
end
function testMYSDPS_example_primal_infeasible(testCase)
[blk,A,C,b] = example_primal_infeasible();
[~,~,~,~,info] = mysdps(blk,A,C,b);
% indication of primal infeasibility
verifyEqual(testCase, info, 1)
end
function testVSDPUP_example_feasible(testCase)
[blk,A,C,b] = example_feasible();
[~,Xt,yt,Zt,~] = mysdps(blk,A,C,b);
[fU,X,lb] = vsdpup(blk,A,C,b,Xt,yt,Zt);
verifyEqual(testCase, fU, 1.0001, 'RelTol', 1e-4)
verifyEqual(testCase, all (all (in (X{1}, midrad(ones(2)/2,5e-4)))), true)
verifyEqual(testCase, lb, 5e-5, 'RelTol', 1e-4)
end
function testVSDPUP_example_DELTA_feasible(testCase)
[blk,A,C,b,DELTA] = example_DELTA_feasible();
[~,Xt,yt,Zt,~] = mysdps(blk,A,C,b);
[fU,X,lb] = vsdpup(blk,A,C,b,Xt,yt,Zt);
verifyEqual(testCase, fU, -0.5, 'RelTol', DELTA)
midX = [2*DELTA, -1, 0; -1, 1/(2*DELTA), 0; 0, 0, DELTA];
verifyEqual(testCase, all (all (in (X{1}, midrad(midX,DELTA)))), true)
verifyEqual(testCase, lb, 1.289076539560735e-8, 'AbsTol', DELTA)
end
function testVSDPUP_example_DELTA_feasible_finite_bnd(testCase)
[blk,A,C,b,DELTA] = example_DELTA_feasible();
[~,Xt,yt,Zt,~] = mysdps(blk,A,C,b);
yu = 1e5 * [1 1 1 1]';
[fU,X,lb] = vsdpup(blk,A,C,b,Xt,yt,Zt,yu);
% In this case: VSDPUP computes rigorously the finite upper bound without
% verifying primal feasibility.
verifyEqual(testCase, fU, -0.5, 'RelTol', DELTA)
verifyEqual(testCase, isnan(X), true)
verifyEqual(testCase, isnan(lb), true)
end
function testVSDPUP_example_DELTA_infeasible(testCase)
[blk,A,C,b,~] = example_DELTA_infeasible();
[~,Xt,yt,Zt,~] = mysdps(blk,A,C,b);
[fU,X,lb] = vsdpup(blk,A,C,b,Xt,yt,Zt);
verifyEqual(testCase, isinf(fU), true)
verifyEqual(testCase, isnan(X), true)
verifyEqual(testCase, isnan(lb), true)
end
function testVSDPUP_example_primal_infeasible(testCase)
[blk,A,C,b] = example_primal_infeasible();
[~,Xt,yt,Zt,~] = mysdps(blk,A,C,b);
[fU,X,lb] = vsdpup(blk,A,C,b,Xt,yt,Zt);
verifyEqual(testCase, isinf(fU), true)
verifyEqual(testCase, isnan(X), true)
verifyEqual(testCase, isnan(lb), true)
end
function testVSDPLOW_example_feasible(testCase)
[blk,A,C,b] = example_feasible();
[~,Xt,yt,Zt,~] = mysdps(blk,A,C,b);
[fL,Y,dl] = vsdplow(blk,A,C,b,Xt,yt,Zt);
verifyEqual(testCase, fL, 1.0001, 'RelTol', 1e-4)
verifyEqual(testCase, Y, [-1; 1], 'RelTol', 1e-4)
verifyEqual(testCase, dl, 9.3912e-11, 'AbsTol', 1e-9)
end
function testVSDPLOW_example_DELTA_feasible(testCase)
[blk,A,C,b,DELTA] = example_DELTA_feasible();
[~,Xt,yt,Zt,~] = mysdps(blk,A,C,b);
[fL,Y,dl] = vsdplow(blk,A,C,b,Xt,yt,Zt);
verifyEqual(testCase, fL, -0.5, 'RelTol', DELTA)
verifyEqual(testCase, Y(2), -1/(4*DELTA), 'RelTol', DELTA)
verifyEqual(testCase, Y([1,3,4]), [0;0;0], 'AbsTol', DELTA)
verifyEqual(testCase, dl, 4.319659051028185e-13, 'AbsTol', 1e-9)
end
function testVSDPLOW_example_DELTA_feasible_finite_bnd(testCase)
[blk,A,C,b,DELTA] = example_DELTA_feasible();
[~,Xt,yt,Zt,~] = mysdps(blk,A,C,b);
xu = 1e5;
% FIXME: pertubation neccessary to work with approximation from SDPT3-4.0
yt(2) = yt(2) - DELTA/2;
[fL,Y,dl] = vsdplow(blk,A,C,b,Xt,yt,Zt,xu);
verifyEqual(testCase, fL, -0.5, 'RelTol', DELTA)
verifyEqual(testCase, Y(2), -1/(4*DELTA), 'RelTol', DELTA)
verifyEqual(testCase, Y([1,3,4]), [0;0;0], 'AbsTol', DELTA)
verifyEqual(testCase, dl, 4.319659051028185e-13, 'AbsTol', 1e-9)
end
function testVSDPLOW_example_DELTA_infeasible(testCase)
[blk,A,C,b,~] = example_DELTA_infeasible();
[~,Xt,yt,Zt,~] = mysdps(blk,A,C,b);
[fL,Y,dl] = vsdplow(blk,A,C,b,Xt,yt,Zt);
verifyEqual(testCase, isinf(fL), true)
verifyEqual(testCase, isnan(Y), true)
verifyEqual(testCase, isnan(dl), true)
end
function testVSDPLOW_example_primal_infeasible(testCase)
[blk,A,C,b] = example_primal_infeasible();
[~,Xt,yt,Zt,~] = mysdps(blk,A,C,b);
[fL,Y,dl] = vsdplow(blk,A,C,b,Xt,yt,Zt);
verifyEqual(testCase, fL, 1, 'RelTol', 2*eps())
% TODO: improving ray Y does not match with a) value from help string of
% vsdpinfeas or b) value from PDF documentation
%verifyEqual(testCase, Y, [-100.5998; -0.0060], 'RelTol', 1e-2)
%verifyEqual(testCase, Y, [-101.0835012952675; -0.01083501295267454], ...
% 'RelTol', 1e-2)
verifyEqual(testCase, dl > 0, true)
end
function testVSDPINFEAS_example_feasible(testCase)
[blk,A,C,b] = example_feasible();
[isinfeas,X,Y] = vsdpinfeas(blk,A,C,b,'p');
verifyEqual(testCase, isinfeas, 0)
verifyEqual(testCase, isnan(X), true)
verifyEqual(testCase, isnan(Y), true)
[isinfeas,X,Y] = vsdpinfeas(blk,A,C,b,'d');
verifyEqual(testCase, isinfeas, 0)
verifyEqual(testCase, isnan(X), true)
verifyEqual(testCase, isnan(Y), true)
end
function testVSDPINFEAS_example_DELTA_feasible(testCase)
[blk,A,C,b,~] = example_DELTA_feasible();
[isinfeas,X,Y] = vsdpinfeas(blk,A,C,b,'p');
verifyEqual(testCase, isinfeas, 0)
verifyEqual(testCase, isnan(X), true)
verifyEqual(testCase, isnan(Y), true)
[isinfeas,X,Y] = vsdpinfeas(blk,A,C,b,'d');
verifyEqual(testCase, isinfeas, 0)
verifyEqual(testCase, isnan(X), true)
verifyEqual(testCase, isnan(Y), true)
end
function testVSDPINFEAS_example_DELTA_infeasible(testCase)
% Note: should result in 'isinfeas = 1' in any case, but this is out of scope
% of VSDP.
[blk,A,C,b,~] = example_DELTA_infeasible();
[isinfeas,X,Y] = vsdpinfeas(blk,A,C,b,'p');
verifyEqual(testCase, isinfeas, 0)
verifyEqual(testCase, isnan(X), true)
verifyEqual(testCase, isnan(Y), true)
[isinfeas,X,Y] = vsdpinfeas(blk,A,C,b,'d');
verifyEqual(testCase, isinfeas, 0)
verifyEqual(testCase, isnan(X), true)
verifyEqual(testCase, isnan(Y), true)
end
function testVSDPINFEAS_example_primal_infeasible(testCase)
[blk,A,C,b] = example_primal_infeasible();
[isinfeas,X,Y] = vsdpinfeas(blk,A,C,b,'p');
verifyEqual(testCase, isinfeas, 1)
verifyEqual(testCase, isnan(X), true)
% TODO: improving ray Y does not match with a) value from help string of
% vsdpinfeas or b) value from PDF documentation
%verifyEqual(testCase, Y, [-100.5998; -0.0060], 'RelTol', 1e-2)
%verifyEqual(testCase, Y, [-101.0835012952675; -0.01083501295267454], ...
% 'RelTol', 1e-2)
[isinfeas,X,Y] = vsdpinfeas(blk,A,C,b,'d');
verifyEqual(testCase, isinfeas, 0)
verifyEqual(testCase, isnan(X), true)
verifyEqual(testCase, isnan(Y), true)
end
function testSDPLIB_ARCH4(testCase)
n = 2;
m = 174;
s = [161; 174];
% test sdpa_to_vsdp
[blk,A,C,b] = sdpa_to_vsdp(fullfile('sdplib_vsdp', 'arch4.dat-s'));
verifyEqual(testCase, blk, {'s', s(1); 's', s(2)})
verifyEqual(testCase, length(b), m)
for j = 1:n
verifyEqual(testCase, size(C{j}), [s(j), s(j)])
for i = 1:m
verifyEqual(testCase, size(A{i,j}), [s(j), s(j)])
end
end
% test vsdpcheck
[m,n] = vsdpcheck(blk,A,C,b);
verifyEqual(testCase, m, 174)
verifyEqual(testCase, n, 2)
% test SDPT3 conversion
[At,Ct] = vsdp_to_sdpt3(blk,A,C,b);
[AA,CC] = sdpt3_to_vsdp(blk,At,Ct,b);
verifyEqual(testCase, CC, C)
verifyEqual(testCase, AA, A, 'RelTol', 1e-8)
% test mysdps
[objt,Xt,yt,Zt,info] = mysdps(blk,A,C,b);
verifyEqual(testCase, size(objt), [1, 2])
verifyEqual(testCase, size(Xt), [2, 1])
verifyEqual(testCase, size(yt), size(b))
verifyEqual(testCase, size(Zt), [2, 1])
verifyEqual(testCase, objt(1), trace(C{1} * Xt{1}), 'RelTol', 1e-4)
verifyEqual(testCase, objt(2), b'*yt, 'RelTol', 1e-4)
verifyEqual(testCase, info, 0)
% test vsdpup
[fU,X,lb] = vsdpup(blk,A,C,b,Xt,yt,Zt);
verifyEqual(testCase, objt(2) <= fU, true)
verifyEqual(testCase, isscalar(X) && isnan(X), false);
verifyEqual(testCase, any(isnan(lb)), false);
% test vsdplow
[fL,Y,dl] = vsdplow(blk,A,C,b,Xt,yt,Zt);
verifyEqual(testCase, fL <= objt(1), true)
verifyEqual(testCase, isscalar(Y) && isnan(Y), false);
verifyEqual(testCase, any(isnan(dl)), false);
% test vsdpinfeas
[isinfeas,X,Y] = vsdpinfeas(blk,A,C,b,'p',Xt,yt,Zt);
verifyEqual(testCase, isinfeas, 0)
verifyEqual(testCase, isnan(X), true)
verifyEqual(testCase, isnan(Y), true)
[isinfeas,X,Y] = vsdpinfeas(blk,A,C,b,'d',Xt,yt,Zt);
verifyEqual(testCase, isinfeas, 0)
verifyEqual(testCase, isnan(X), true)
verifyEqual(testCase, isnan(Y), true)
end