DSDP
Functions
Semidefinite Blocks (Operational Routines)

Functions

int SDPConeAddADotX (SDPCone sdpcone, int blockj, double alpha, double x[], int nn, double adotx[], int m)
 Compute the inner products of a dense matrix X with the data matrices. More...
 
int SDPConeAddXVAV (SDPCone sdpcone, int blockj, double vin[], int n, double sum[], int mm)
 Compute $ v^T A_{i,j} v $ for i = 0 through m. More...
 
int SDPConeComputeS (SDPCone sdpcone, int blockj, double cc, double y[], int nvars, double r, int n, double s[], int nn)
 Compute the dual matrix S. More...
 
int SDPConeComputeX (SDPCone sdpcone, int blockj, int n, double x[], int nn)
 Compute the matrix X. More...
 
int SDPConeComputeXV (SDPCone sdpcone, int blockj, int *derror)
 Compute a factor V such that $ V V^T= X $. More...
 
int SDPConeGetBlockSize (SDPCone sdpcone, int blockj, int *n)
 Get the dimension of one block in the semidefinite cone. More...
 
int SDPConeGetNumberOfBlocks (SDPCone sdpcone, int *nblocks)
 Get the number of blocks in the semidefinite cone. More...
 
int SDPConeMatrixView (SDPCone sdpcone, int blockj)
 Print the dense array to the screen. More...
 
int SDPConeRestoreXArray (SDPCone sdpcone, int blockj, double *xx[], int *nn)
 Restore the dense array and set these pointers to null. More...
 
int SDPConeSetBlockSize (SDPCone sdpcone, int blockj, int n)
 Set the dimension of one block in the semidefinite cone. More...
 
int SDPConeSetSparsity (SDPCone sdpcone, int blockj, int nnz)
 Set the number of nonzero matrices in a block of the semidefinite cone. More...
 
int SDPConeSetXArray (SDPCone sdpcone, int blockj, int n, double xx[], int nn)
 Provide an array for the SDPCone object can use to store dense matrices. More...
 
int SDPConeXVMultiply (SDPCone sdpcone, int blockj, double vin[], double vout[], int n)
 Multiply an array by a factor V such that $ V V^T= X $. More...
 

Detailed Description

Additional routines that operate on the data.

#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}$.

Return values
0if successful

Function Documentation

◆ SDPConeAddADotX()

int SDPConeAddADotX ( SDPCone  sdpcone,
int  blockj,
double  alpha,
double  x[],
int  nn,
double  adotx[],
int  m 
)

Compute the inner products of a dense matrix X with the data matrices.

Parameters
sdpconesemidefinite cone
blockjblock number
alphamultiply inner product be this multiple
xthe dense array representing a matrix X.
nnlength of the array
adotxarray.
mthe length of the array and the number of variables y, plus two.

Definition at line 75 of file sdpcone.c.

◆ SDPConeAddXVAV()

int SDPConeAddXVAV ( SDPCone  sdpcone,
int  blockj,
double  vin[],
int  n,
double  sum[],
int  mm 
)

Compute $ v^T A_{i,j} v $ for i = 0 through m.

Parameters
sdpconethe SDP cone
blockjblock number
vinarray
ndimension of the block and the length of the two arrays.
suminput array
mmthe number of variables plus 2
See also
SDPConeAddADotX()

Definition at line 292 of file sdpcone.c.

Referenced by MaxCutRandomized(), and StableRandomized().

◆ SDPConeComputeS()

int SDPConeComputeS ( SDPCone  sdpcone,
int  blockj,
double  cc,
double  y[],
int  nvars,
double  r,
int  n,
double  s[],
int  nn 
)

Compute the dual matrix S.

Parameters
sdpconesemidefinite cone object
blockjblock number
ccthe multiple of the matrix C (or A_0)
yan array of containing the variables y
nvarsthe length of the array and the number of variables y
rthe multiple of the identity matrix to add
nthe dimension of the block
sarray to where the matrix S will be copied.
nnlength of the array s

Definition at line 42 of file sdpcone.c.

◆ SDPConeComputeX()

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

Compute the matrix X.

Parameters
sdpconesemidefinite cone
ndi
blockjblock number
nthe dimension of the block
xarray to where the matrix X will be copied.
nnlength of the array x
See also
DSDPComputeX()

Definition at line 191 of file sdpcone.c.

◆ SDPConeComputeXV()

int SDPConeComputeXV ( SDPCone  sdpcone,
int  blockj,
int *  derror 
)

Compute a factor V such that $ V V^T= X $.

Parameters
sdpconethe SDP cone
blockjblock number
derrornonzero if no such factor could be computed.
See also
SDPConeXVMultiply()

This routine is helpful in semidefinite relaxations of combinatorial problems.

Definition at line 325 of file sdpcone.c.

Referenced by MaxCutRandomized(), and StableRandomized().

◆ SDPConeGetBlockSize()

int SDPConeGetBlockSize ( SDPCone  sdpcone,
int  blockj,
int *  n 
)

Get the dimension of one block in the semidefinite cone.

Parameters
sdpconesemidefinite cone object
blockjblock number
*nset to the dimension of the block
See also
SDPConeSetBlockSize()

Definition at line 560 of file dsdpadddata.c.

Referenced by DSDPPrintData().

◆ SDPConeGetNumberOfBlocks()

int SDPConeGetNumberOfBlocks ( SDPCone  sdpcone,
int *  nblocks 
)

Get the number of blocks in the semidefinite cone.

Parameters
sdpconesemidefinite cone object
*nblocksset to the dimension of the block
See also
DSDPCreateSDPCone()

Definition at line 578 of file dsdpadddata.c.

Referenced by DSDPPrintData(), and DSDPPrintSolution().

◆ SDPConeMatrixView()

int SDPConeMatrixView ( SDPCone  sdpcone,
int  blockj 
)

Print the dense array to the screen.

Parameters
sdpconesemidefinite cone object
blockjblock number
See also
SDPConeGetXArray()

Definition at line 372 of file dsdpadddata.c.

◆ SDPConeRestoreXArray()

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

Restore the dense array and set these pointers to null.

Parameters
sdpconesemidefinite cone object
blockjblock number
xxaddress of an array for dense matrices
*nnthe length of the array
See also
SDPConeGetXArray()

Definition at line 351 of file dsdpadddata.c.

◆ SDPConeSetBlockSize()

int SDPConeSetBlockSize ( SDPCone  sdpcone,
int  blockj,
int  n 
)

Set the dimension of one block in the semidefinite cone.

Parameters
sdpconesemidefinite cone object
blockjblock number
ndimension of the block
Note
This routine is optional, but its use can help the object detect input errors.

Definition at line 535 of file dsdpadddata.c.

Referenced by SDPConeCheckN().

◆ SDPConeSetSparsity()

int SDPConeSetSparsity ( SDPCone  sdpcone,
int  blockj,
int  nnz 
)

Set the number of nonzero matrices in a block of the semidefinite cone.

Parameters
sdpconesemidefinite cone object
blockjblock number
nnznumber of nonzero matrices in the block
Note
This routine is optional, but its use can improve the memory allocation within the SDPCone object.

Definition at line 596 of file dsdpadddata.c.

◆ SDPConeSetXArray()

int SDPConeSetXArray ( SDPCone  sdpcone,
int  blockj,
int  n,
double  xx[],
int  nn 
)

Provide an array for the SDPCone object can use to store dense matrices.

Parameters
sdpconesemidefinite cone object
blockjblock number
ndimension of the block
xxarray for dense matrices
nnlength of array

This routine elimates the need to copy the solution X into a separate array.

See also
SDPConeGetXArray()

Definition at line 278 of file dsdpadddata.c.

◆ SDPConeXVMultiply()

int SDPConeXVMultiply ( SDPCone  sdpcone,
int  blockj,
double  vin[],
double  vout[],
int  n 
)

Multiply an array by a factor V such that $ V V^T= X $.

Parameters
sdpconethe SDP cone
blockjblock number
vininput array
voutthe product V vin
ndimension of the block and the length of the two arrays.
See also
SDPConeComputeXV()
SDPConeAddXVAV()

Definition at line 251 of file sdpcone.c.

Referenced by MaxCutRandomized(), and StableRandomized().