Compress a list of block-diagonal symmetric matrices.
CA = pack(A,blocksizes) [CA,sel] = pack(A,blocksizes)
m-by-n real matrix of doubles, the entries of a list of block-diagonal symmetric matrices. n is the number of matrices stored into
b-by-1 real matrix of doubles, the sizes of the blocks.
p-by-n real matrix of doubles, a compressed representation of
1-by-s real matrix of doubles, the indices of the rows of
Awhich have been selected in
This function takes as input argument a list of
block-diagonal matrices stored in the m-by-n matrix
Only the non-zero entries of the block-diagonal matrices are stored.
n is the number of block-diagonal matrices,
while the integer
m is the number of nonzero entries of
one single block-diagonal matrix.
The function removes the symmetric entries, and returns in
the compressed representation of
CA matrix, the symmetric entries stored in
have been removed.
The rows which have been selected in
CA are stored in the vector
sel, so that, on output, we have
CA == A(sel,:).
For example, the matrix
is stored as
[1; 2; 3; 4; 5; 6; 7; 8; 9; 10]
This function is designed to be used when preparing the input arguments of the
In the following example, we compress a single block-diagonal symmetric matrix
This is the example presented in "SP: Software for Semidefinite Programming, User's Guide, Beta Version",
November 1994, L. Vandenberghe and S. Boyd, 1994, on page 5.
In the following example, we compress three block-diagonal symmetric matrices
// Define 3 symmetric block-diagonal matrices: F0, F1, F2 F0=[2,1,0,0; 1,2,0,0; 0,0,3,1; 0,0,1,3] F1=[1,2,0,0; 2,1,0,0; 0,0,1,3; 0,0,3,1] F2=[2,2,0,0; 2,2,0,0; 0,0,3,4; 0,0,4,4] // Define the size of the two blocks: // the first block has size 2, // the second block has size 2. blocksizes=[2,2]; // Extract the two blocks of the matrices. F01=F0(1:2,1:2); F02=F0(3:4,3:4); F11=F1(1:2,1:2); F12=F1(3:4,3:4); F21=F2(1:2,1:2); F22=F2(3:4,3:4); // Create 3 column vectors, containing nonzero entries // in F0, F1, F2. F0nnz = [F01(:);F02(:)]; F1nnz = [F11(:);F12(:)]; F2nnz = [F21(:);F22(:)]; // Create a 16-by-3 matrix, representing the // nonzero entries of the 3 matrices F0, F1, F2. A=[F0nnz,F1nnz,F2nnz] // Pack the list of matrices A into CA. [CA,sel] = pack(A,blocksizes) // Check that CA == A(sel,:) A(sel,:)
L. Vandenberghe and S. Boyd, " Semidefinite Programming," Informations Systems Laboratory, Stanford University, 1994.
Ju. E. Nesterov and M. J. Todd, "Self-Scaled Cones and Interior-Point Methods in Nonlinear Programming," Working Paper, CORE, Catholic University of Louvain, Louvain-la-Neuve, Belgium, April 1994.
SP: Software for Semidefinite Programming, User's Guide, Beta Version, November 1994, L. Vandenberghe and S. Boyd, 1994 http://www.ee.ucla.edu/~vandenbe/sp.html
- unpack — Uncompress a list of block-diagonal symmetric matrices.