DSDP
Functions
Semidefinite Blocks (Advanced Data)

Functions

int SDPConeAddADenseVecMat (SDPCone sdpcone, int blockj, int vari, int n, double alpha, double val[], int nnz)
 Add a matrix $A_{i,j}$ in a dense format. More...
 
int SDPConeAddARankOneMat (SDPCone sdpcone, int blockj, int vari, int n, double alpha, int ishift, const int ind[], const double val[], int nnz)
 Add data matrix $A_{i,j}= alpha * v * v^T $ where v is a sparse vector. More...
 
int SDPConeAddASparseVecMat (SDPCone sdpcone, int blockj, int vari, int n, double alpha, int ishift, const int ind[], const double val[], int nnz)
 Add data matrix $A_{i,j}$ in a sparse format. More...
 
int SDPConeAddConstantMat (SDPCone sdpcone, int blockj, int vari, int n, double value)
 Add a matrix $A_{i,j}$ whose elements are all the same. More...
 
int SDPConeAddDataMatrix (SDPCone sdpcone, int blockj, int vari, int n, char format, struct DSDPDataMat_Ops *dsdpdataops, void *data)
 Add a data matrix $A_{i,j}$. More...
 
int SDPConeAddIdentity (SDPCone sdpcone, int blockj, int vari, int n, double val)
 Add a matrix $A_{i,j}$ that is a multiple of the identity matrix. More...
 
int SDPConeCheckData (SDPCone sdpcone)
 Check the matrix operations on a data matrix;. More...
 
int SDPConeGetStorageFormat (SDPCone sdpcone, int blockj, char *format)
 Get the storage format for the block. More...
 
int SDPConeRemoveDataMatrix (SDPCone sdpcone, int blockj, int vari)
 Remove the data matrix $A_{i,j}$ from the cone. More...
 
int SDPConeSetARankOneMat (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}= alpha * v * v^T $ where v is a sparse vector. More...
 
int SDPConeSetConstantMat (SDPCone sdpcone, int blockj, int vari, int n, double value)
 Set a matrix $A_{i,j}$ whose elements are all the same. More...
 
int SDPConeSetIdentity (SDPCone sdpcone, int blockj, int vari, int n, double val)
 Set a matrix $A_{i,j}$ to be a multiple of the identity matrix. More...
 
int SDPConeSetStorageFormat (SDPCone sdpcone, int blockj, char format)
 Set the dense storage format of a block in the semidefinite cone. More...
 
int SDPConeSetZeroMat (SDPCone sdpcone, int blockj, int vari, int n)
 Set a matrix $A_{i,j}$ whose elements are all equal zero. More...
 
int SDPConeUseFullSymmetricFormat (SDPCone sdpcone, int blockj)
 Use full symmetric format for the dense array. More...
 
int SDPConeUsePackedFormat (SDPCone sdpcone, int blockj)
 Use packed symmetric format for the dense array. More...
 
int SDPConeView2 (SDPCone sdpcone)
 Print the SDP cone to the screen in a second way. More...
 
int SDPConeView3 (SDPCone sdpcone)
 Print the SDP cone to the screen in a third way. More...
 

Detailed Description

Less frequently used routines to set data into the SDPCone object and operate on the variables.

#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

◆ SDPConeAddADenseVecMat()

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

Add 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 data (usually 1.0)
valarray of elements in the matrix
nnzlength of the previous two arrays
Note
DSDP will use the val array in many routines, but it will not modify or delete it until finished with DSDP.

The matrix

img208.gif

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

double val[]={3,2,0,0,6,0};
SDPConeAddADenseVecMat(sdpcone,j,i,3,1.0,val,6);
See also
SDPConeViewDataMatrix()
SDPConeSetASparseVecMat()
SDPConeSetADenseVecMat()

Definition at line 203 of file dsdpadddatamat.c.

Referenced by SDPConeSetADenseVecMat().

◆ SDPConeAddARankOneMat()

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

Add data matrix $A_{i,j}= alpha * v * v^T $ where v is a sparse vector.

Parameters
sdpconeSDP cone
blockjblock number j from 0 to nblocks
varivariable i from 0 through m
ndimension of the matrix
alphamultiple of the outer product
ishiftindex of first element in a dense vector (usually 0)
valarray of elements in the vector
indarray of indices representing the location of the nonzeros
nnzlength of the previous two arrays
Note
DSDP will use the two arrays throughout in many routines, but it will not modify or delete them.
See also
DSDPCreateSDPCone()
SDPConeViewDataMatrix()
SDPConeAddASparseVecMat()

Definition at line 478 of file dsdpadddatamat.c.

Referenced by SDPConeSetARankOneMat(), and SetStableSetData().

◆ SDPConeAddASparseVecMat()

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

Add 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 first element (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
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()
SDPConeGetStorageFormat()
SDPConeViewDataMatrix()
SDPConeSetBlockSize()

Definition at line 49 of file dsdpadddatamat.c.

Referenced by SDPConeSetASparseVecMat(), and SetStableSetData().

◆ SDPConeAddConstantMat()

int SDPConeAddConstantMat ( SDPCone  sdpcone,
int  blockj,
int  vari,
int  n,
double  value 
)

Add a matrix $A_{i,j}$ whose elements are all the same.

Parameters
sdpconeSDP cone
blockjblock number j from 0 to nblocks
varivariable i from 0 through m
ndimension of the matrix
valuethe value of each element in the matrix
See also
SDPConeAddADenseVecMat()

Definition at line 356 of file dsdpadddatamat.c.

Referenced by SDPConeSetConstantMat().

◆ SDPConeAddDataMatrix()

int SDPConeAddDataMatrix ( SDPCone  sdpcone,
int  blockj,
int  vari,
int  n,
char  format,
struct DSDPDataMat_Ops dsdpdataops,
void *  data 
)

Add a data matrix $A_{i,j}$.

Parameters
sdpconeSDP cone
blockjblock number j from 0 to nblocks
varivariable i from 0 through m
ndimension of the matrix
formatstorage format 'P' (default) or 'U'
dataaddress of a structure ( cast to void* ) with matrix data.
dsdpdataopsaddress of a structure of function pointers that operate on the matrix data
See also
SDPConeSetASparseVecMat()
SDPConeSetStorageFormat()
SDPConeSetBlockSize()
SDPConeCheckData()

Definition at line 154 of file dsdpadddata.c.

Referenced by SDPConeAddARankOneMat(), and SDPConeAddASparseVecMat().

◆ SDPConeAddIdentity()

int SDPConeAddIdentity ( SDPCone  sdpcone,
int  blockj,
int  vari,
int  n,
double  val 
)

Add a matrix $A_{i,j}$ that is a multiple of the identity matrix.

Parameters
sdpconeSDP cone
blockjblock number j from 0 to nblocks
varivariable i from 0 through m
ndimension of the matrix
valmultiple of identity matrix
See also
SDPConeAddASparseVecMat()

Definition at line 299 of file dsdpadddatamat.c.

Referenced by SDPConeSetIdentity().

◆ SDPConeCheckData()

int SDPConeCheckData ( SDPCone  sdpcone)

Check the matrix operations on a data matrix;.

Parameters
sdpconethe cone
See also
SDPConeView

Definition at line 692 of file dsdpadddata.c.

◆ SDPConeGetStorageFormat()

int SDPConeGetStorageFormat ( SDPCone  sdpcone,
int  blockj,
char *  format 
)

Get the storage format for the block.

Parameters
sdpconesemidefinite cone object
blockjblock number
formatformat the block
See also
SDPConeSetStorageFormat()
SDPConeGetXArray()
SDPConeSetASparseVecMat()
SDPConeSetADenseVecMat()

The default format is 'P' (packed symmetric format).

Definition at line 505 of file dsdpadddata.c.

Referenced by SDPConeAddADenseVecMat(), SDPConeAddARankOneMat(), SDPConeAddASparseVecMat(), SDPConeComputeS(), SDPConeComputeX(), SDPConeSetXArray(), SDPConeSetXMat(), and SDPConeViewX().

◆ SDPConeRemoveDataMatrix()

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

Remove the data matrix $A_{i,j}$ from the cone.

Parameters
sdpconeSDP cone
blockjblock number j from 0 to nblocks
varivariable i from 0 through m
See also
SDPConeView()

Definition at line 127 of file dsdpadddata.c.

Referenced by SDPConeSetADenseVecMat(), SDPConeSetARankOneMat(), SDPConeSetASparseVecMat(), SDPConeSetConstantMat(), and SDPConeSetIdentity().

◆ SDPConeSetARankOneMat()

int SDPConeSetARankOneMat ( 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}= alpha * v * v^T $ where v is a sparse vector.

Parameters
sdpconeSDP cone
blockjblock number j from 0 to nblocks
varivariable i from 0 through m
ndimension of the matrix
alphamultiple of the outer product
ishiftindex of first element in a dense vector (usually 0)
valarray of elements in the vector
indarray of indices representing the location of the nonzeros
nnzlength of the previous two arrays
Note
DSDP will use the two arrays throughout in many routines, but it will not modify or delete them.
See also
SDPConeViewDataMatrix()
SDPConeAddARankOneMat()

Definition at line 519 of file dsdpadddatamat.c.

◆ SDPConeSetConstantMat()

int SDPConeSetConstantMat ( SDPCone  sdpcone,
int  blockj,
int  vari,
int  n,
double  value 
)

Set a matrix $A_{i,j}$ whose elements are all the same.

Parameters
sdpconeSDP cone
blockjblock number j from 0 to nblocks
varivariable i from 0 through m
ndimension of the matrix
valuethe value of each element in the matrix
See also
SDPConeSetADenseVecMat()

Definition at line 391 of file dsdpadddatamat.c.

◆ SDPConeSetIdentity()

int SDPConeSetIdentity ( SDPCone  sdpcone,
int  blockj,
int  vari,
int  n,
double  val 
)

Set a matrix $A_{i,j}$ to be a multiple of the identity matrix.

Parameters
sdpconeSDP cone
blockjblock number j from 0 to nblocks
varivariable i from 0 through m
ndimension of the matrix
valmultiple of identity matrix
See also
SDPConeAddASparseVecMat()

Definition at line 334 of file dsdpadddatamat.c.

◆ SDPConeSetStorageFormat()

int SDPConeSetStorageFormat ( SDPCone  sdpcone,
int  blockj,
char  format 
)

Set the dense storage format of a block in the semidefinite cone.

Parameters
sdpconesemidefinite cone object
blockjblock number
formatformat the block
See also
SDPConeGetStorageFormat()
SDPConeUsePackedFormat()
SDPConeUseFullSymmetricFormat()

This routine determines the ordering of elements in the data matrices and the X matrix. The default format is 'P' (packed symmetric format), but the full symmetric format 'U' is also supported. The format used to factor the S matrix is independent of the format used for the data and X matrix.

Definition at line 479 of file dsdpadddata.c.

Referenced by SDPConeUseFullSymmetricFormat(), and SDPConeUsePackedFormat().

◆ SDPConeSetZeroMat()

int SDPConeSetZeroMat ( SDPCone  sdpcone,
int  blockj,
int  vari,
int  n 
)

Set a matrix $A_{i,j}$ whose elements are all equal zero.

Parameters
sdpconeSDP cone
blockjblock number j from 0 to nblocks
varivariable i from 0 through m
ndimension of the matrix
See also
SDPConeSetASparseVecMat()
SDPConeSetConstantMat()

Definition at line 414 of file dsdpadddatamat.c.

◆ SDPConeUseFullSymmetricFormat()

int SDPConeUseFullSymmetricFormat ( SDPCone  sdpcone,
int  blockj 
)

Use full symmetric format for the dense array.

Parameters
sdpconesemidefinite cone object
blockjblock number
See also
SDPConeGetXArray()
SDPConeSetASparseVecMat()
SDPConeSetADenseVecMat()
SDPConeSetStorageFormat()
SDPConeUsePackedFormat()
SDPConeCheckData()

In this format, an $n \times n$ symmetric matrix is represented by an array of length $ n^2 $. Each element of the array corresponds to an element of the matrix and the mapping is given below.

\[ \begin{array}{lllllllllll} [ a_{1,1} & \ldots & a_{1,n} & a_{2,1} & \ldots & a_{2,n} & \ldots & a_{n,1} & \ldots & a_{n,n} ] \\ \end{array} \]

but elements $a_{i,j}, i<j $ are not used.

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.

Note
Since DSDP uses BLAS and LAPACK for many of its operations, we refer to the half of matrix in use as the 'upper' triangular matrix.

Definition at line 414 of file dsdpadddata.c.

◆ SDPConeUsePackedFormat()

int SDPConeUsePackedFormat ( SDPCone  sdpcone,
int  blockj 
)

Use packed symmetric format for the dense array.

Parameters
sdpconesemidefinite cone object
blockjblock number
See also
SDPConeGetXArray()
SDPConeSetASparseVecMat()
SDPConeSetADenseVecMat()

In this format, an $n \times n$ symmetric matrix is represented by an array of length $\frac{n(n+1)}{2}$. Each element of the array corresponds to an element of the matrix and the mapping is given below.

\[ \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} \]

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.

Note
Since DSDP uses BLAS and LAPACK for many of its operations, we refer to the half of matrix in use as the 'upper' triangular matrix.

Definition at line 452 of file dsdpadddata.c.

◆ SDPConeView2()

int SDPConeView2 ( SDPCone  sdpcone)

Print the SDP cone to the screen in a second way.

Parameters
sdpconethe cone
See also
SDPConeViewDataMatrix()
SDPConeView()
SDPConeView3()

Definition at line 637 of file dsdpadddata.c.

◆ SDPConeView3()

int SDPConeView3 ( SDPCone  sdpcone)

Print the SDP cone to the screen in a third way.

Parameters
sdpconethe cone
See also
SDPConeViewDataMatrix()
SDPConeView()
SDPConeView2()

Definition at line 657 of file dsdpadddata.c.