DSDP
Functions
Semidefinite Blocks (Basics)

Functions

int SDPConeGetXArray (SDPCone sdpcone, int blockj, double *xx[], int *nn)
 After applying the solver, set a pointer to the array in the object with the solution X. More...
 
int SDPConeSetADenseVecMat (SDPCone sdpcone, int blockj, int vari, int n, double alpha, double val[], int nnz)
 Set a matrix $A_{i,j}$ in a dense format. More...
 
int SDPConeSetASparseVecMat (SDPCone sdpcone, int blockj, int vari, int n, double alpha, int ishift, const int ind[], const double val[], int nnz)
 Set data matrix $A_{i,j}$ in a sparse format. More...
 
int SDPConeViewDataMatrix (SDPCone sdpcone, int blockj, int vari)
 Print a data matrix to the screen. More...
 
int SDPConeViewX (SDPCone sdpcone, int blockj, int n, double x[], int nn)
 Print a dense array X to the screen. More...
 

Detailed Description

Routines that create the SDPCone object, set the data, and get the solution for problems.

#include dsdp5.h

In DSDP Standard Form, a semidefinite program is given by the pair of problems

\[ \begin{array}{llllllllll} (P) \ \ \ & \mbox{minimize} & {\displaystyle \sum_{j=0}^{n_b-1} C_j \bullet X_j } &\mbox{subject to}& {\displaystyle \sum_{j=0}^{n_b-1} A_{i,j} \bullet X_{j} = b_i } ,& i=1,\ldots, m, & & X_j \succeq 0, \\ \end{array} \]

\[ \begin{array}{lllllllll} (D) \ \ \ & \mbox{maximize} & {\displaystyle \sum_{i=1}^m b_i \ y_i } &\mbox{subject to}&{\displaystyle \sum_{i=1}^m A_{i,j}y_i + S_{j} } = C_{j}, & j=0, \ldots, n_b-1, & S_j \succeq 0 \\ \end{array} \]

where the data $A_{i,j}$ and $C_j$ are symmetric matrices of the same dimension and the inner product of two $n \times n$ matrices $C=(c_{k,l})$ and $X=(x_{k,l})$ is defined by $ C \bullet X := trace (C^T X) = \sum_{k,l}c_{k,l} x_{k,l} $.

Blocks are labelled from 0 to nblocks, where nblocks is the total number of blocks in the SDPCone object.

Variables y are numbered 1 through m. Variable 0 designates the C matrices, which are also denoted $ A_{0,j}$.

By default, this cone represents symmetric $ n \times n$ matrices in packed symmetric format. This format uses an array of length $ n(n+1)/2 $ and orders the the elements of the matrix as follows:

\[ \begin{array}{llllllll} [ a_{1,1} & a_{2,1} & a_{2,2} & a_{3,1} & a_{3,2} & a_{3,3} & \ldots & a_{n,n} ] \\ \end{array}. \]

Return values
0if successful

Function Documentation

◆ SDPConeGetXArray()

int SDPConeGetXArray ( SDPCone  sdpcone,
int  blockj,
double *  xx[],
int *  nn 
)

After applying the solver, set a pointer to the array in the object with the solution X.

Parameters
sdpconesemidefinite cone object
blockjblock number
xxaddress of an array for dense matrices
*nnthe length of the array
See also
DSDPSolve()
DSDPComputeX()
SDPConeViewX()
DSDP dsdp;
SDPCone sdpcone;
double *xx;
int nn;
DSDPSolve(dsdp);
SDPConeGetXArray(sdpcone,0,&xx,&nn);
SDPConeViewX(sdpcone,0,xx,nn);
SDPConeRestoreXArray(sdpcone,0,&xx,&nn);

DSDP uses a single dense array to add data matrices, compute the matrix X, and take the inner product of X with the data matrices.

Therefore, the ordering of elements in this array must also be used in the data matrices.

Definition at line 328 of file dsdpadddata.c.

◆ SDPConeSetADenseVecMat()

int SDPConeSetADenseVecMat ( SDPCone  sdpcone,
int  blockj,
int  vari,
int  n,
double  alpha,
double  val[],
int  nnz 
)

Set a matrix $A_{i,j}$ in a dense format.

Parameters
sdpconeSDP cone
blockjblock number j from 0 to nblocks
varivariable i from 0 through m
ndimension of the matrix
alphamultiple of the data (usually 1.0)
valarray of elements in the matrix
nnzlength of the array

For example, the matrix

img208.gif

can be inserted into the cone in packed symmetric format as follows

double val[]={3,2,0,0,6,0};
SDPConeSetDenseAVecMat(sdpcone,j,i,3,1.0,val,6);
Note
DSDP will use the val array in many routines, but it will not modify or delete it.
See also
SDPConeViewDataMatrix()
SDPConeSetASparseVecMat()

Definition at line 265 of file dsdpadddatamat.c.

◆ SDPConeSetASparseVecMat()

int SDPConeSetASparseVecMat ( SDPCone  sdpcone,
int  blockj,
int  vari,
int  n,
double  alpha,
int  ishift,
const int  ind[],
const double  val[],
int  nnz 
)

Set data matrix $A_{i,j}$ in a sparse format.

Parameters
sdpconeSDP cone
blockjblock number j from 0 to nblocks
varivariable i from 0 through m
ndimension of the matrix
ishiftindex of $ a_{1,1} $ (usually 0)
alphamultiple of the data (usually 1)
valarray of elements in the matrix
indarray of indices representing the location of the elements
nnzlength of the previous two arrays

For example, the matrix

img208.gif

can be inserted into the cone in packed symmetric format in several ways.

Using the ordering of the packed symmetric format, we can index each element of the matrix with an integer between 0 and n(n+1)/2-1 (inclusive). If the first element in the val array is $a_{1,1}$, the first element in the ind array should be 0 .

If the second element in the val array is $a_{2,1}$, then the second element in ind array should be 1 (the second element in dense representation). If the third element in the val array is $a_{3,2}$, then the third element in ind array should be 4. Explicitly,

double val1[]={3,2,6};
int ind1[]={0,1,4};
SDPConeSetASparseVecMat(sdpcone,j,i,3,1.0,0,ind1,val1,3);

If we index the elements from 1 through n(n+1)/2, we can use

double val2[]={3,2,6};
int ind2[]={1,2,5};
SDPConeSetASparseVecMat(sdpcone,j,i,3,1.0,1,ind2,val2,3);

The ordering of the elements in the array can be changed and zero elements can be included.

double val3[]={6,3,0,2};
int ind3[]={4,0,2,1};
SDPConeSetASparseVecMat(sdpcone,j,i,3,1.0,0,ind3,val3,4);

The elements can also be scaled.

double val1[]={6,4,12};
int ind1[]={0,1,4};
SDPConeSetASparseVecMat(sdpcone,j,i,3,0.5,0,ind1,val1,3);
Note
DSDP will use the two arrays throughout in many routines, but it will not modify or delete them until finished with DSDP.
See also
DSDPCreateSDPCone()
DSDPSetDualObjective()
SDPConeViewDataMatrix()

Definition at line 152 of file dsdpadddatamat.c.

Referenced by SetStableSetData().

◆ SDPConeViewDataMatrix()

int SDPConeViewDataMatrix ( SDPCone  sdpcone,
int  blockj,
int  vari 
)

Print a data matrix to the screen.

Parameters
sdpconesemidefinite cone object
blockjblock number
varivariable number from 0 through m
See also
SDPConeView()

Definition at line 205 of file dsdpadddata.c.

Referenced by SetStableSetData().

◆ SDPConeViewX()

int SDPConeViewX ( SDPCone  sdpcone,
int  blockj,
int  n,
double  x[],
int  nn 
)

Print a dense array X to the screen.

Parameters
sdpconesemidefinite cone
blockjblock number
nthe dimension of the block
xdense matrix array.
nnlength of the array x
See also
SDPConeGetXArray()

Definition at line 223 of file sdpcone.c.