9 #define __FUNCT__ "SDPConeComputeSS" 22 info=
DSDPBlockASum(&sdpcone->blk[blockj].ADATA,1,Y,SS); DSDPCHKBLOCKERR(blockj,info);
23 DSDPFunctionReturn(0);
27 #define __FUNCT__ "SDPConeComputeS" 42 int SDPConeComputeS(
SDPCone sdpcone,
int blockj,
double cc,
double y[],
int nvars,
double r,
int n,
double s[],
int nn){
48 info=
SDPConeCheckN(sdpcone,blockj,n);DSDPCHKBLOCKERR(blockj,info);
50 if (n<1){DSDPFunctionReturn(0);}
51 info=DSDPVecSetC(Y,-1.0*cc);
52 info=DSDPVecSetR(Y,-r);
53 for (i=0;i<nvars;i++){info=DSDPVecSetElement(Y,i+1,y[i]);}
58 DSDPFunctionReturn(0);
62 #define __FUNCT__ "SDPConeAddADotX" 79 double scl=blk[blockj].ADATA.scl;
86 info=DSDPVecSet(alpha,YW2);DSDPCHKBLOCKERR(blockj,info);
88 if (n<1){DSDPFunctionReturn(0);}
89 info=DSDPVecCreateWArray(&ADOTX,adotx,m);
92 info=
DSDPBlockADot(&blk[blockj].ADATA,1.0/scl,YW2,T,ADOTX);DSDPCHKBLOCKERR(blockj,info);
94 DSDPFunctionReturn(0);
98 #define __FUNCT__ "SDPConeComputeXDot" 115 double one=1.0,scl=blk[blockj].ADATA.scl;
117 info=DSDPVecZero(YW2);DSDPCHKBLOCKERR(blockj,info);
118 info=
DSDPBlockADot(&blk[blockj].ADATA,-1.0/scl,Y,X,YW2);DSDPCHKBLOCKERR(blockj,info);
119 info=DSDPVecGetR(YW2,xtrace);DSDPCHKBLOCKERR(blockj,info);
120 info=DSDPVecSum(YW2,tracexs);DSDPCHKBLOCKERR(blockj,info);
122 info=DSDPVecSet(one,YW2);DSDPCHKBLOCKERR(blockj,info);
123 info=
DSDPBlockADot(&blk[blockj].ADATA,1.0/scl,YW2,X,AX);DSDPCHKBLOCKERR(blockj,info);
124 DSDPFunctionReturn(0);
128 #define __FUNCT__ "SDPConeComputeX3" 142 double xshift=1e-12,xscale=1e-12;
153 DSDPLogInfo(0,2,
"Primal SDP Block %2.0f not PSD\n",blockj);
156 info=
SDPConeComputeXX(sdpcone,blockj,DY,mu,SS,X);DSDPCHKBLOCKERR(blockj,info);
162 DSDPLogInfo(0,10,
"VMat: shift diagonal: %4.2e, scale diagonal: %4.2e.\n",xshift,1+xscale);
165 xshift*=10;xscale*=10;
168 xshift=1e-12,xscale=1e-10;
171 DSDPLogInfo(0,10,
"XMat: shift diagonal: %4.2e, scale diagonal: %4.2e.\n",xshift,1+xscale);
173 DSDPFunctionReturn(0);
178 #define __FUNCT__ "SDPConeComputeX" 193 double mu=sdpcone->xmakermu;
194 double xnorm,xtrace,trxs;
196 DSDPVec DY=sdpcone->DYX,Y=sdpcone->YX,AX=sdpcone->Work;
200 info=
SDPConeCheckN(sdpcone,blockj,n);DSDPCHKBLOCKERR(blockj,info);
201 if (n<1){DSDPFunctionReturn(0);}
204 info=
SDPConeComputeX3(sdpcone,blockj,mu,Y,DY,T);DSDPCHKBLOCKERR(blockj,info);
205 info=
SDPConeComputeXDot(sdpcone,blockj,Y,T,AX,&xtrace,&xnorm,&trxs);DSDPCHKBLOCKERR(blockj,info);
207 DSDPFunctionReturn(0);
211 #define __FUNCT__ "SDPConeViewX" 229 info=
SDPConeCheckN(sdpcone,blockj,n);DSDPCHKBLOCKERR(blockj,info);
234 DSDPFunctionReturn(0);
238 #define __FUNCT__ "SDPConeXVMultiply" 258 info=
SDPConeCheckN(sdpcone,blockj,n);DSDPCHKBLOCKERR(blockj,info);
259 if (sdpcone->blk[blockj].n>1){
260 S=blk[blockj].S; SS=blk[blockj].SS;
261 V2=blk[blockj].W; V3=blk[blockj].W2;
262 info=SDPConeVecCreateWArray(&V1,vin,n);
263 info=SDPConeVecCreateWArray(&V4,vout,n);
275 DSDPFunctionReturn(0);
279 #define __FUNCT__ "SDPConeAddXVAV" 298 info=
SDPConeCheckN(sdpcone,blockj,n);DSDPCHKBLOCKERR(blockj,info);
300 info=DSDPVecSet(1.0,sdpcone->Work);DSDPCHKBLOCKERR(blockj,info);
301 if (sdpcone->blk[blockj].n>1){
302 info=SDPConeVecCreateWArray(&V2,vin,n);DSDPCHKERR(info);
303 info=DSDPVecCreateWArray(&Wout,sum,mm);DSDPCHKERR(info);
304 info=
DSDPBlockvAv(&blk[blockj].ADATA,1.0,sdpcone->Work,V2,Wout);DSDPCHKBLOCKERR(blockj,info);
306 DSDPFunctionReturn(0);
312 #define __FUNCT__ "SDPConeComputeXV" 336 info=
SDPConeCheckJ(sdpcone,blockj);DSDPCHKBLOCKERR(blockj,info);
337 if (sdpcone->blk[blockj].n>1){
338 Y=sdpcone->YX; DY=sdpcone->DYX; W=sdpcone->Work;
339 T=blk[blockj].T; S=blk[blockj].S; SS=blk[blockj].SS;
340 info=DSDPVecWAXPY(W,-1.0,DY,Y);DSDPCHKBLOCKERR(blockj,info);
343 info=DSDPVecGetR(W,&rr);
344 info=DSDPVecSetR(W,10*rr-1e-12);
355 info=DSDPVecGetR(Y,&rr);
356 info=DSDPVecSetR(Y,10*rr-1e-15);
361 DSDPFunctionReturn(0);
int SDPConeComputeXX(SDPCone, int, DSDPVec, double, DSDPDualMat, DSDPVMat)
Compute X.
int DSDPDualMatIsFull(DSDPDualMat S, DSDPTruth *full)
Factor the matrix.
DSDPTruth
Boolean variables.
int SDPConeVecScale(double alpha, SDPConeVec VV)
Compute the Euclidean norm.
struct DSDPVec_C DSDPVec
This object hold m+2 variables: a scaling of C, the y variables, and r.
int DSDPBlockASum(DSDPBlockData *ADATA, double aa, DSDPVec Yk, DSDPVMat XX)
Sum the data matrices.
int DSDPMakeVMatWithArray(char, double[], int, int, DSDPVMat *)
Allocate V matrix using the given array.
Error handling, printing, and profiling.
int SDPConeGetBlockSize(SDPCone sdpcone, int blockj, int *n)
Get the dimension of one block in the semidefinite cone.
int SDPConeComputeX(SDPCone sdpcone, int blockj, int n, double x[], int nn)
Compute the matrix X.
int DSDPVMatScaleDiagonal(DSDPVMat X, double dscale)
Scaling diagonal is useful for inner products and norms.
int DSDPDualMatCholeskySolveBackward(DSDPDualMat S, SDPConeVec B, SDPConeVec X)
Backward triangular solve.
int DSDPBlockvAv(DSDPBlockData *ADATA, double aa, DSDPVec Alpha, SDPConeVec V, DSDPVec VAV)
Set VAV[i] to aa * Alpha[i] * V' A[i] V.
int SDPConeCheckM(SDPCone sdpcone, int m)
Check validity of parameter.
int DSDPBlockADot(DSDPBlockData *ADATA, double aa, DSDPVec Alpha, DSDPVMat X, DSDPVec AX)
Compute inner product of XX with data matrices.
int SDPConeAddXVAV(SDPCone sdpcone, int blockj, double vin[], int n, double sum[], int mm)
Compute for i = 0 through m.
Vector whose length corresponds to dimension of a block in a cone.
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.
int DSDPDualMatCholeskyBackwardMultiply(DSDPDualMat S, SDPConeVec B, SDPConeVec X)
Multiply by triangular matrix.
int DSDPDualMatCholeskySolveForward(DSDPDualMat S, SDPConeVec B, SDPConeVec X)
Forward triangular solve.
int DSDPVMatDestroy(DSDPVMat *X)
Deallocate matrix.
Internal structure for block of semidefinite cone.
int SDPConeComputeSS(SDPCone sdpcone, int blockj, DSDPVec Y, DSDPVMat SS)
Sum the data matrices.
int DSDPDualMatInvert(DSDPDualMat S)
Invert the matrix.
int SDPConeComputeXV(SDPCone sdpcone, int blockj, int *derror)
Compute a factor V such that .
int DSDPDualMatCholeskyFactor(DSDPDualMat S, DSDPTruth *psdefinite)
Factor the matrix.
int SDPConeCheckJ(SDPCone sdpcone, int blockj)
Check validity of parameter.
Represents an S matrix for one block in the semidefinite cone.
int DSDPDualMatCholeskyForwardMultiply(DSDPDualMat S, SDPConeVec B, SDPConeVec X)
Multiply by triangular matrix.
int DSDPDualMatSetArray(DSDPDualMat S, DSDPVMat T)
Print the matrix.
int DSDPVMatZeroEntries(DSDPVMat X)
Zero matrix.
int SDPConeXVMultiply(SDPCone sdpcone, int blockj, double vin[], double vout[], int n)
Multiply an array by a factor V such that .
Internal structure for semidefinite cone.
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 SDPConeComputeX3(SDPCone sdpcone, int blockj, double mu, DSDPVec Y, DSDPVec DY, DSDPVMat X)
Compute the matrix X with the given information.
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.
int DSDPVMatView(DSDPVMat X)
Print matrix.
Dense symmetric matrix for one block in the semidefinite cone.
int DSDPVMatNormF2(DSDPVMat X, double *normf2)
Compute square of Frobenius norm of matrix.
int DSDPVMatShiftDiagonal(DSDPVMat X, double dadd)
Add something to diagonal elements.
Internal SDPCone data structures and routines.
int SDPConeComputeXDot(SDPCone sdpcone, int blockj, DSDPVec Y, DSDPVMat X, DSDPVec AX, double *xtrace, double *xnorm, double *tracexs)
Compute inner product of X with the Data, S, and norm of X.
int SDPConeViewX(SDPCone sdpcone, int blockj, int n, double x[], int nn)
Print a dense array X to the screen.