The code in this directory was used for the experiments in the paper
''Decomposition methods for sparse matrix nearness problems,''
by Y. Sun and L. Vandenberghe 
(available at www.seas.ucla.edu/~vandenbe/publications).

Latest code update: March 2015

The following software packages are optional:

 - CVX (http://cvxr.com/cvx/download/) 
   (only if comparing against interior point methods is desired)
 
The symbolic code is adapted from CHOMPACK: http://chompack.readthedocs.org/en/latest/
===========================================================================
LIST OF CODE 

1) MAIN SCRIPT
main.m - step by step example of how we generate and solve problems

EXAMPLE FILE
can_61.mat - A simple 61 x 61 sparse matrix example 
             (from UF sparse matrix collection: 
              http://www.cise.ufl.edu/research/sparse/matrices/)

SOLVERS 

 - proxgrad.m : proximal gradient solver 

 - bcd.m : block coordinate descent (or Dykstra's method)

 - dr.m : Douglas-Rachford method

 - IPM.m : wrapper for interior point methods, called through CVX 


SIMPLE_PROJECTIONS 

 - proj_PSD.m : projection onto dense positive semidefinite cone

 - proj_nPSD.m : projection onto dense negative semidefinite cone

 - proj_Schoenberg.m : projection onto the set 
                      {X : c' * X * c <= 0, for all c' * ones(n,1) = 0}
                      (D^n_0 in paper)

 - proj_Schoenberg_dual.m : projection onto the dual of the previous set 
                      {V' * X * V : X is negative semidefinite, V is n x n-1, V'*V = I, V'*ones(n,1) = 0}
                      (dual of D^n_0 in paper)

 - proj_consistency.m : projection onto the set
                        {(X,U1, U2, ... Ul) : X_{bk,bk} = Uk, k = 1,...,l}
                        where X is a sparse matrix, Uk are dense matrices 
                        of order |bk|, and bk are the cliques of the 
                        extended sparsity pattern

 - proj_sum_consistency.m : projection onto the set
                        {(X,U1, U2, ... Ul) : X = sum_k Pk' * Uk * Pk}
                        where X is a sparse matrix, Uk are dense matrices 
                        of order |bk|,  bk are the cliques of the 
                        extended sparsity pattern, and Z = Pk'*Uk*Pk is an 
                        n x n sparse matrix with Z_{bk,bk} = Uk and 0 
                        everywhere else.


COMMON 

 - symbolic.m and directory : code for generating chordal extension of 
                              sparse pattern and identifying cliques. 
                              (A MATLAB version of Python code written 
                              primarily by Martin Andersen)

 - chordal_embedding.m : wrapper function around symbolic.m that also gives 
                         sparsity pattern for merged and unmerged cliques

 - project_over_cliques.m : repeats a given projection over a list of 
                            submatrices

 - preprocess_opts.m : formats variables opts structure for first order 
                       solvers (preprocessing)

 - max_overlap : calculates the maximum number of times an index appears 
                 in a clique. (This is the Lipschitz constant for proxgrad.)

 - sparsemat2vec.m : converts X to U where X is a sparse matrix with 
                     chordal pattern E and U = (vec(U1), vec(U2)...) where 
                     X_{bk,bk} = Uk, bk are the cliques of E

 - vec2sparsemat.m : converts U to X where is a sparse matrix with 
                     chordal pattern E and U = (vec(U1), vec(U2)...) where 
                     X_{bk,bk} = Uk, bk are the cliques of E

 - vec : vectorize matrix

 - spdiag : outputs sparse diagonal matrix with given values along diagonal
