-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial merge of latest SDPT3 source from authors
- Loading branch information
Showing
132 changed files
with
1,298 additions
and
1,312 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
SDPT3 Version 4.0 | ||
A MATLAB software for semidefinite-quadratic-linear programming | ||
Copyright (c) 1997 by | ||
Kim-Chuan Toh, Michael J. Todd, and Reha H. Tutuncu | ||
|
||
If you find this software useful for your work, please cite the | ||
followings: | ||
|
||
[1] K.C. Toh, M.J. Todd, and R.H. Tutuncu, | ||
SDPT3 --- a Matlab software package for semidefinite programming, | ||
Optimization Methods and Software, 11 (1999), pp. 545--581. | ||
[2] R.H Tutuncu, K.C. Toh, and M.J. Todd, | ||
Solving semidefinite-quadratic-linear programs using SDPT3, | ||
Mathematical Programming Ser. B, 95 (2003), pp. 189--217. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,53 @@ | ||
%%************************************************************************* | ||
%% ToeplitzApprox: find the nearest symmetric positive definite Toeplitz | ||
%% matrix to a given symmetric matrix F. | ||
%% | ||
%% | ||
%% max -y(n+1) | ||
%% s.t. T(y(1:n)) + y(n+1)*B >= 0 | ||
%% [I 0 ] + sum_{k=1}^n y(k) [0 gam(k)*e_k ] + y(n+1)*B >= 0 | ||
%% [0 -beta] [gam(k)*e_k' -2q(k) ] | ||
%% | ||
%% where B = diag([zeros(n,1); 1]) | ||
%% q(1) = - Tr(F); q(k+1) = -sum of upper and lower kth diagonals of F | ||
%% gam(1) = sqrt(n); gam(k) = sqrt(2*(n-k+1)) for k=2:n | ||
%% beta = norm(F,'fro')^2 | ||
%%************************************************************************* | ||
|
||
function [blk,At,C,b] = ToeplitzApprox(F) | ||
|
||
n = length(F); | ||
gam = sqrt([n, 2*(n-1:-1:1)]); | ||
q = zeros(n,1); | ||
q(1) = -sum(diag(F)); | ||
for k=1:n-1 | ||
q(k+1) = -2*sum(diag(F,k)); | ||
end | ||
beta = norm(F,'fro')^2; | ||
|
||
blk{1,1} = 's'; blk{1,2} = n+1; | ||
blk{2,1} = 's'; blk{2,2} = n+1; | ||
|
||
b = [zeros(n,1); -1]; | ||
C{1,1} = sparse(n+1,n+1); | ||
C{2,1} = spdiags([ones(n,1); -beta],0,n+1,n+1); | ||
|
||
Acell = cell(1,n+1); | ||
Acell{1} = -spdiags([ones(n,1); 0],0,n+1,n+1); | ||
for k = 1:n-1 | ||
tmp = -spdiags([ones(n,1); 0],k,n+1,n+1); | ||
Acell{k+1} = tmp + tmp'; | ||
end | ||
Acell{n+1} = -spconvert([n+1,n+1,1]); | ||
At(1,1) = svec(blk(1,:),Acell,1); | ||
|
||
for k = 1:n | ||
Acell{k} = -spconvert([k, n+1, gam(k); n+1, k, gam(k); n+1, n+1, -2*q(k)]); | ||
end | ||
Acell{n+1} = -spconvert([n+1,n+1,1]); | ||
At(2,1) = svec(blk(2,:),Acell,1); | ||
%%*********************************************************************** | ||
%%************************************************************************* | ||
%% ToeplitzApprox: find the nearest symmetric positive definite Toeplitz | ||
%% matrix to a given symmetric matrix F. | ||
%% | ||
%% max -y(n+1) | ||
%% s.t. T(y(1:n)) + y(n+1)*B >= 0 | ||
%% [I 0 ] + sum_{k=1}^n y(k) [0 gam(k)*e_k ] + y(n+1)*B >= 0 | ||
%% [0 -beta] [gam(k)*e_k' -2q(k) ] | ||
%% | ||
%% where B = diag([zeros(n,1); 1]) | ||
%% q(1) = - Tr(F); q(k+1) = -sum of upper and lower kth diagonals of F | ||
%% gam(1) = sqrt(n); gam(k) = sqrt(2*(n-k+1)) for k=2:n | ||
%% beta = norm(F,'fro')^2 | ||
%%***************************************************************** | ||
%% SDPT3: version 4.0 | ||
%% Copyright (c) 1997 by | ||
%% Kim-Chuan Toh, Michael J. Todd, Reha H. Tutuncu | ||
%% Last Modified: 16 Sep 2004 | ||
%%***************************************************************** | ||
|
||
function [blk,At,C,b] = ToeplitzApprox(F) | ||
|
||
n = length(F); | ||
gam = sqrt([n, 2*(n-1:-1:1)]); | ||
q = zeros(n,1); | ||
q(1) = -sum(diag(F)); | ||
for k=1:n-1 | ||
q(k+1) = -2*sum(diag(F,k)); | ||
end | ||
beta = norm(F,'fro')^2; | ||
|
||
blk{1,1} = 's'; blk{1,2} = n+1; | ||
blk{2,1} = 's'; blk{2,2} = n+1; | ||
|
||
b = [zeros(n,1); -1]; | ||
C{1,1} = sparse(n+1,n+1); | ||
C{2,1} = spdiags([ones(n,1); -beta],0,n+1,n+1); | ||
|
||
Acell = cell(1,n+1); | ||
Acell{1} = -spdiags([ones(n,1); 0],0,n+1,n+1); | ||
for k = 1:n-1 | ||
tmp = -spdiags([ones(n,1); 0],k,n+1,n+1); | ||
Acell{k+1} = tmp + tmp'; | ||
end | ||
Acell{n+1} = -spconvert([n+1,n+1,1]); | ||
At(1,1) = svec(blk(1,:),Acell,1); | ||
|
||
for k = 1:n | ||
Acell{k} = -spconvert([k, n+1, gam(k); n+1, k, gam(k); n+1, n+1, -2*q(k)]); | ||
end | ||
Acell{n+1} = -spconvert([n+1,n+1,1]); | ||
At(2,1) = svec(blk(2,:),Acell,1); | ||
%%*********************************************************************** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,47 @@ | ||
%%************************************************************************* | ||
%% ToeplitzApproxSQQ: find the nearest symmetric positive definite Toeplitz | ||
%% matrix to a given symmetric matrix F. | ||
%% | ||
%% max -y0 | ||
%% s.t. y0*B + T(y) (S>=) 0 | ||
%% [y0; gam.*y] + [0; q./gam] (Q>=) 0 | ||
%% | ||
%% where B = diag([zeros(n,1); 1]) | ||
%% q(1) = - Tr(F); q(k+1) = -sum of upper and lower kth diagonals of F | ||
%% gam(1) = sqrt(n); gam(k) = sqrt(2*(n-k+1)) for k=2:n | ||
%%************************************************************************* | ||
|
||
function [blk,At,C,b] = ToeplitzApproxSQQ(F) | ||
|
||
n = length(F); | ||
gam = sqrt([n, 2*(n-1:-1:1)]'); | ||
q = zeros(n,1); | ||
q(1) = -sum(diag(F)); | ||
for k=1:n-1 | ||
q(k+1) = -2*sum(diag(F,k)); | ||
end | ||
beta = norm(F,'fro')^2; | ||
|
||
blk{1,1} = 's'; blk{1,2} = n+1; | ||
blk{2,1} = 'q'; blk{2,2} = n+1; | ||
|
||
b = [-1; zeros(n,1)]; | ||
C{1,1} = sparse(n+1,n+1); | ||
C{2,1} = [0; q./gam]; | ||
|
||
Acell = cell(1,n+1); | ||
Acell{1} = -spconvert([n+1,n+1,1]); | ||
Acell{2} = -spdiags([ones(n,1); 0],0,n+1,n+1); | ||
for k = 1:n-1 | ||
tmp = -spdiags([ones(n,1); 0],k,n+1,n+1); | ||
Acell{k+2} = tmp + tmp'; | ||
end | ||
At(1,1) = svec(blk(1,:),Acell,1); | ||
|
||
At{2,1} = -spdiags([1; gam],0,n+1,n+1); | ||
%%************************************************************************* | ||
%% ToeplitzApproxSQQ: find the nearest symmetric positive definite Toeplitz | ||
%% matrix to a given symmetric matrix F. | ||
%% | ||
%% max -y0 | ||
%% s.t. y0*B + T(y) (S>=) 0 | ||
%% [y0; gam.*y] + [0; q./gam] (Q>=) 0 | ||
%% | ||
%% where B = diag([zeros(n,1); 1]) | ||
%% q(1) = - Tr(F); q(k+1) = -sum of upper and lower kth diagonals of F | ||
%% gam(1) = sqrt(n); gam(k) = sqrt(2*(n-k+1)) for k=2:n | ||
%%***************************************************************** | ||
%% SDPT3: version 4.0 | ||
%% Copyright (c) 1997 by | ||
%% Kim-Chuan Toh, Michael J. Todd, Reha H. Tutuncu | ||
%% Last Modified: 16 Sep 2004 | ||
%%***************************************************************** | ||
|
||
function [blk,At,C,b] = ToeplitzApproxSQQ(F) | ||
|
||
n = length(F); | ||
gam = sqrt([n, 2*(n-1:-1:1)]'); | ||
q = zeros(n,1); | ||
q(1) = -sum(diag(F)); | ||
for k=1:n-1 | ||
q(k+1) = -2*sum(diag(F,k)); | ||
end | ||
beta = norm(F,'fro')^2; | ||
|
||
blk{1,1} = 's'; blk{1,2} = n+1; | ||
blk{2,1} = 'q'; blk{2,2} = n+1; | ||
|
||
b = [-1; zeros(n,1)]; | ||
C{1,1} = sparse(n+1,n+1); | ||
C{2,1} = [0; q./gam]; | ||
|
||
Acell = cell(1,n+1); | ||
Acell{1} = -spconvert([n+1,n+1,1]); | ||
Acell{2} = -spdiags([ones(n,1); 0],0,n+1,n+1); | ||
for k = 1:n-1 | ||
tmp = -spdiags([ones(n,1); 0],k,n+1,n+1); | ||
Acell{k+2} = tmp + tmp'; | ||
end | ||
At(1,1) = svec(blk(1,:),Acell,1); | ||
|
||
At{2,1} = -spdiags([1; gam],0,n+1,n+1); | ||
%%*********************************************************************** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.