8 #define __FUNCT__ "SDPConeCheckI" 17 SDPConeValid(sdpcone);
18 if (vari<0 || vari>sdpcone->m) {
19 DSDPSETERR2(1,
"Bad Data Matrix: variable: %d (Max: %d)\n",vari,sdpcone->m+1);}
20 DSDPFunctionReturn(0);
24 #define __FUNCT__ "SDPConeCheckJ" 33 SDPConeValid(sdpcone);
34 if (blockj<0 || blockj>= sdpcone->nblocks) {
35 DSDPSETERR2(2,
"Bad Data Matrix: Block: %d (Max: %d)\n",blockj,sdpcone->nblocks-1);}
36 DSDPFunctionReturn(0);
40 #define __FUNCT__ "SDPConeCheckN" 52 if (sdpcone->blk[blockj].n==0 && n>0){info=
SDPConeSetBlockSize(sdpcone,blockj,n);DSDPCHKERR(info);}
53 if (sdpcone->blk[blockj].n != n){
54 DSDPSETERR3(3,
"Check Dimension of Data Matrix: Block: %d, %d -- expecting %d\n",
55 blockj,n,sdpcone->blk[blockj].n);
57 DSDPFunctionReturn(0);
61 #define __FUNCT__ "SDPConeCheckM" 70 SDPConeValid(sdpcone);
72 DSDPSETERR1(4,
"Check dimension of array. This problem has %d variables\n",sdpcone->m);}
73 DSDPFunctionReturn(0);
77 #define __FUNCT__ "SDPConeValidStorageFormat" 86 if (format!=
'P' && format !=
'U'){
87 DSDPSETERR1(4,
"Check format of Block: %c is not supported! Use P or U. \n",format);
89 DSDPFunctionReturn(0);
93 #define __FUNCT__ "SDPConeCheckStorageFormat" 106 if (sdpcone->blk[blockj].format==
'N'){
107 sdpcone->blk[blockj].format = format;
109 if (sdpcone->blk[blockj].format != format){
110 DSDPSETERR3(4,
"Check format of Data Matrix: Block: %d, %c -- expecting %c\n",
111 blockj,format,sdpcone->blk[blockj].format);
113 DSDPFunctionReturn(0);
117 #define __FUNCT__ "SDPConeRemoveDataMatrix" 133 DSDPFunctionReturn(0);
137 #define __FUNCT__ "SDPConeAddDataMatrix" 161 info=DSDPBlockAddDataMatrix(&sdpcone->blk[blockj].ADATA,vari,dsdpdataops,data);DSDPCHKERR(info);
162 DSDPFunctionReturn(0);
166 #define __FUNCT__ "SDPConeSetRMatrix" 183 int vari=sdpcone->m+1;
189 info=DSDPBlockSetDataMatrix(&sdpcone->blk[blockj].ADATA,vari,dsdpdataops,data);DSDPCHKERR(info);
190 DSDPFunctionReturn(0);
195 #define __FUNCT__ "SDPConeViewDataMatrix" 206 int info,ii,vari2,nnzmats;
212 for (ii=0;ii<nnzmats; ii++){
213 info=
DSDPBlockGetMatrix(&sdpcone->blk[blockj].ADATA,ii,&vari2,0,&AA);DSDPCHKVARERR(vari,info);
216 DSDPFunctionReturn(0);
220 #define __FUNCT__ "SDPConeClearVMatrix" 231 SDPConeValid(sdpcone);
234 DSDPFunctionReturn(0);
239 #define __FUNCT__ "SDPConeSetXMat" 253 SDPConeValid(sdpcone);
255 DSDPLogInfo(0,10,
"Create block X Mat: Block: %d, size: %d.\n",blockj,n);
258 sdpcone->blk[blockj].T=T;
259 DSDPFunctionReturn(0);
263 #define __FUNCT__ "SDPConeSetXArray" 286 DSDPLogInfo(0,10,
"Set block X array: Block: %d, size: %d.\n",blockj,n);
289 sdpcone->blk[blockj].T=T;
290 DSDPFunctionReturn(0);
294 #define __FUNCT__ "SDPConeGetXArray" 332 info=
DSDPVMatExist(sdpcone->blk[blockj].T,&flag);DSDPCHKERR(info);
334 DSDPSETERR(6,
"No X Array available, Call DSDPSetup() or SDPConeSetXArray.\n");}
336 DSDPFunctionReturn(0);
340 #define __FUNCT__ "SDPConeRestoreXArray" 355 info=
DSDPVMatExist(sdpcone->blk[blockj].T,&flag);DSDPCHKERR(info);
357 DSDPSETERR(6,
"No X Array available, Call DSDPSetup() or SDPConeSetXArray.\n");}
359 DSDPFunctionReturn(0);
363 #define __FUNCT__ "SDPConeMatrixView" 376 info=
DSDPVMatView(sdpcone->blk[blockj].T);DSDPCHKERR(info);
377 DSDPFunctionReturn(0);
381 #define __FUNCT__ "SDPConeUseFullSymmetricFormat" 418 DSDPFunctionReturn(0);
422 #define __FUNCT__ "SDPConeUsePackedFormat" 456 DSDPFunctionReturn(0);
460 #define __FUNCT__ "SDPConeSetStorageFormat" 484 sdpcone->blk[blockj].format=format;
485 DSDPFunctionReturn(0);
489 #define __FUNCT__ "SDPConeGetStorageFormat" 509 *format=sdpcone->blk[blockj].format;
510 if (*format==
'N') *format=
'P';
511 DSDPFunctionReturn(0);
515 #define __FUNCT__ "SDPConeScaleBarrier" 516 int SDPConeScaleBarrier(
SDPCone sdpcone,
int blockj,
double ggamma){
520 sdpcone->blk[blockj].gammamu=ggamma;
521 DSDPFunctionReturn(0);
525 #define __FUNCT__ "SDPConeSetBlockSize" 538 DSDPLogInfo(0,10,
"Set block size: Block: %d, size: %d.\n",blockj,n);
540 n0=sdpcone->blk[blockj].n;
541 if (n0==n){DSDPFunctionReturn(0);}
543 DSDPSETERR2(5,
"Block %d Size previously set to %d \n",blockj,n0); }
544 sdpcone->blk[blockj].n=n;
546 DSDPFunctionReturn(0);
550 #define __FUNCT__ "SDPConeGetBlockSize" 564 *n=sdpcone->blk[blockj].n;
565 DSDPFunctionReturn(0);
577 #define __FUNCT__ "SDPConeGetNumberOfBlocks" 580 SDPConeValid(sdpcone);
581 *nblocks=sdpcone->nblocks;
582 DSDPFunctionReturn(0);
586 #define __FUNCT__ "SDPConeSetSparsity" 599 DSDPLogInfo(0,10,
"Set block nonzeros: Block: %d, Nonzero Matrices: %d.\n",blockj,nnz);
601 if (nnz>sdpcone->m) nnz=sdpcone->m;
603 DSDPFunctionReturn(0);
608 #define __FUNCT__ "SDPConeView" 620 for (blockj=0; blockj<sdpcone->nblocks; blockj++){
621 printf(
"Block: %d, Dimension: %d\n",blockj,sdpcone->blk[blockj].n);
622 info=
DSDPBlockView(&sdpcone->blk[blockj].ADATA);DSDPCHKERR(info);
624 DSDPFunctionReturn(0);
628 #define __FUNCT__ "SDPConeView2" 640 for (blockj=0; blockj<sdpcone->nblocks; blockj++){
641 printf(
"Block: %d, Dimension: %d\n",blockj,sdpcone->blk[blockj].n);
642 info=
DSDPBlockView2(&sdpcone->blk[blockj].ADATA);DSDPCHKERR(info);
644 DSDPFunctionReturn(0);
648 #define __FUNCT__ "SDPConeView3" 658 int blockj,id,n,info,nnzmats;
660 for (blockj=0; blockj<sdpcone->nblocks; blockj++){
661 n=sdpcone->blk[blockj].n;
662 printf(
"Block: %d \n",blockj);
663 printf(
" Dimension: %d\n",n);
664 info=DSDPDSMatGetType(sdpcone->blk[blockj].DS,&
id);
666 printf(
" DS Matrix Type: Dense, Using LAPACK\n");
668 printf(
" DS Matrix Type: %d\n",
id);
670 info=DSDPDualMatGetType(sdpcone->blk[blockj].S,&
id);
672 printf(
" Dual Matrix Type: Dense, Using LAPACK\n");
674 printf(
" Dual Matrix Type: %d\n",
id);
677 printf(
" Number of Data Matrices: %d of %d\n",nnzmats-1,sdpcone->m+1);
678 printf(
" Number of Data Nonzeros: %d\n",sdpcone->blk[blockj].nnz);
680 DSDPFunctionReturn(0);
685 #define __FUNCT__ "SDPConeCheckData" 693 int i,ii,blockj,nnzmats,info;
702 for (blockj=0; blockj<sdpcone->nblocks; blockj++){
703 T=sdpcone->blk[blockj].T;DS=sdpcone->blk[blockj].DS;
704 W=sdpcone->blk[blockj].W;W2=sdpcone->blk[blockj].W2;
705 S1=sdpcone->blk[blockj].S;S2=sdpcone->blk[blockj].SS;
706 IS=sdpcone->blk[blockj].IS;
707 printf(
"Block: %d\n",blockj);
709 info=DSDPDSMatCheck(DS,W,W2,T);DSDPCHKERR(info);
710 info=DSDPDualMatCheck(S1,W,W2,IS,T);DSDPCHKERR(info);
711 info=DSDPDualMatCheck(S2,W,W2,IS,T);DSDPCHKERR(info);
714 for (ii=0;ii<nnzmats;ii++){
717 printf(
" Variable: %d, \n",i);
721 DSDPFunctionReturn(0);
int DSDPVMatExist(DSDPVMat X, int *flag)
Answer whether the array has been allocated or not.
int DSDPBlockRemoveDataMatrix(DSDPBlockData *ADATA, int vari)
Remove a data matrix.
int DSDPVMatGetArray(DSDPVMat X, double **v, int *nn)
Get the array that stores the matrix.
int DSDPMakeVMatWithArray(char, double[], int, int, DSDPVMat *)
Allocate V matrix using the given array.
Error handling, printing, and profiling.
int DSDPBlockView(DSDPBlockData *ADATA)
Print the structure of the block.
int SDPConeSetStorageFormat(SDPCone sdpcone, int blockj, char format)
Set the dense storage format of a block in the semidefinite cone.
int SDPConeGetBlockSize(SDPCone sdpcone, int blockj, int *n)
Get the dimension of one block in the semidefinite cone.
int DSDPVMatRestoreArray(DSDPVMat X, double **v, int *nn)
Restore the array that stores the matrix.
int SDPConeCheckData(SDPCone sdpcone)
Check the matrix operations on a data matrix;.
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.
int DSDPDataMatCheck(DSDPDataMat AA, SDPConeVec W, DSDPIndex IS, DSDPVMat XX)
Check correctness of operations on the data.
int SDPConeRestoreXArray(SDPCone sdpcone, int blockj, double *xx[], int *nn)
Restore the dense array and set these pointers to null.
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.
int SDPConeUseFullSymmetricFormat(SDPCone sdpcone, int blockj)
Use full symmetric format for the dense array.
int SDPConeCheckM(SDPCone sdpcone, int m)
Check validity of parameter.
int DSDPBlockCountNonzeroMatrices(DSDPBlockData *ADATA, int *nzmats)
Count how many data matrices are in a block of data.
int DSDPVMatInitialize(DSDPVMat *B)
Set pointers to null.
int SDPConeSetRMatrix(SDPCone sdpcone, int blockj, int n, char format, struct DSDPDataMat_Ops *dsdpdataops, void *data)
Add identity to dual matrix.
int SDPConeViewDataMatrix(SDPCone sdpcone, int blockj, int vari)
Print a data matrix to the screen.
int SDPConeGetNumberOfBlocks(SDPCone sdpcone, int *nblocks)
Get the number of blocks in the semidefinite cone.
Vector whose length corresponds to dimension of a block in a cone.
Symmetric data matrix for one block in the semidefinite cone.
int DSDPBlockView2(DSDPBlockData *ADATA)
Print the data.
int SDPConeRemoveDataMatrix(SDPCone sdpcone, int blockj, int vari)
Remove the data matrix from the cone.
int DSDPVMatDestroy(DSDPVMat *X)
Deallocate matrix.
Table of function pointers that operate on the data matrix.
int SDPConeCheckStorageFormat(SDPCone sdpcone, int blockj, char format)
Check validity of parameters.
int SDPConeSetXMat(SDPCone sdpcone, int blockj, int n)
Create X matrix.
int DSDPBlockDataAllocate(DSDPBlockData *ADATA, int nnz)
Allocate some structures.
int SDPConeValidStorageFormat(SDPCone sdpcone, char format)
Check validity of parameter.
int SDPConeCheckJ(SDPCone sdpcone, int blockj)
Check validity of parameter.
int SDPConeUsePackedFormat(SDPCone sdpcone, int blockj)
Use packed symmetric format for the dense array.
Represents an S matrix for one block in the semidefinite cone.
int SDPConeCheckI(SDPCone sdpcone, int vari)
Check validity of parameter.
int SDPConeView2(SDPCone sdpcone)
Print the SDP cone to the screen in a second way.
int SDPConeView(SDPCone sdpcone)
Print the SDPCone to the screen;.
int SDPConeMatrixView(SDPCone sdpcone, int blockj)
Print the dense array to the screen.
int SDPConeView3(SDPCone sdpcone)
Print the SDP cone to the screen in a third way.
int DSDPVMatCheck(DSDPVMat X, SDPConeVec W1, SDPConeVec W2)
Test correctness of operations.
int DSDPBlockGetMatrix(DSDPBlockData *ADATA, int id, int *vari, double *scl, DSDPDataMat *A)
Get a data matrix from a block of data.
int SDPConeSetBlockSize(SDPCone sdpcone, int blockj, int n)
Set the dimension of one block in the semidefinite cone.
Internal structure for semidefinite cone.
int SDPConeSetSparsity(SDPCone sdpcone, int blockj, int nnz)
Set the number of nonzero matrices in a block of the semidefinite cone.
int SDPConeClearVMatrix(SDPCone sdpcone, int blockj, int n)
Free V matrix.
int SDPConeGetStorageFormat(SDPCone sdpcone, int blockj, char *format)
Get the storage format for the block.
int SDPConeCheckN(SDPCone sdpcone, int blockj, int n)
Check validity of parameter.
int DSDPMakeVMat(char, int, DSDPVMat *)
Allocate V matrix.
Symmetric Delta S matrix for one block in the semidefinite cone.
int DSDPVMatView(DSDPVMat X)
Print matrix.
Dense symmetric matrix for one block in the semidefinite cone.
int DSDPDataMatView(DSDPDataMat A)
Print matrix.
int SDPConeAddDataMatrix(SDPCone sdpcone, int blockj, int vari, int n, char format, struct DSDPDataMat_Ops *dsdpdataops, void *data)
Add a data matrix .
Internal SDPCone data structures and routines.