18#define __FUNCT__ "SDPConeComputeHessian"
32 int i,k,kt,kk,m,n,rank,info;
34 double rtemp,ack,ggamma,bmu,scl;
38 DSDPVec MRowI=sdpcone->Work, Select=sdpcone->Work2;
48 SDPConeValid(sdpcone);
49 info=DSDPVecGetSize(vrhs1,&m);DSDPCHKERR(info);
55 info=DSDPVecZero(MRowI);DSDPCHKERR(info);
57 if (ncols==0){
continue;}
59 for (kt=0; kt<ATranspose.nnzblocks[i]; kt++){
60 kk=ATranspose.nzblocks[i][kt];
61 idA=ATranspose.idA[i][kt];
63 if (ii!=i){DSDPSETERR2(8,
"Data Transpose Error: var %d does not equal %d.\n",i,ii);}
65 if (rank==0)
continue;
67 T=blk[kk].T; S=blk[kk].S; W=blk[kk].W; W2=blk[kk].W2;
68 n=blk[kk].n; ggamma=blk[kk].gammamu; bmu=blk[kk].bmu; IS=blk[kk].IS;
74 if (ncols*blk[kk].nnz < n*n/10) method1=
DSDP_FALSE;
79 for (k=0; k<rank; k++){
82 if (ack==0.0)
continue;
88 if (rtemp==0.0)
continue;
89 rhs1i+=rtemp*ack*bmu; rhs2i+=rtemp*ack*ggamma*mu;
95 info=
DSDPBlockvAv(&blk[kk].ADATA,ack*mu,Select,W2,MRowI);DSDPCHKBLOCKERR(kk,info);
101 info=
DSDPBlockADot(&blk[kk].ADATA,1.0,Select,T,MRowI);DSDPCHKBLOCKERR(kk,info);
104 info=DSDPVecAddElement(vrhs1,i,rhs1i);DSDPCHKERR(info);
105 info=DSDPVecAddElement(vrhs2,i,rhs2i);DSDPCHKERR(info);
109 DSDPFunctionReturn(0);
113#define __FUNCT__ "SDPConeComputeRHS"
127 int info,i,ii,k,rank,nnzmats;
128 double dtmp,dyiscale=1,ack,scl,rtemp;
129 SDPblk *sdp=&sdpcone->blk[blockj];
135 DSDPIndex IS=sdp->IS;
145 for (i=0;i<nnzmats;i++){
147 info=DSDPVecGetElement(vrow,ii,&dyiscale);DSDPCHKVARERR(ii,info);
148 if (dyiscale==0)
continue;
150 for (k=0; k<rank; k++){
152 if (ack==0)
continue;
155 dtmp=rtemp*ack*mu*dyiscale*scl;
156 info=DSDPVecAddElement(vrhs2,ii,dtmp);DSDPCHKVARERR(ii,info);
163 info=
DSDPBlockADot(&sdp->ADATA,1.0,vrow,T,vrhs2);DSDPCHKERR(info);
166 DSDPFunctionReturn(0);
170#define __FUNCT__ "SDPConeMultiply"
184 int info,i,ii,k,rank,nnzmats;
185 double dd2,dtmp,dyiscale,ack,scl,vv;
186 SDPblk *sdp=&sdpcone->blk[blockj];
191 DSDPIndex IS=sdp->IS;
197 info=
DSDPBlockASum(&sdp->ADATA,-1.0,vin,T); DSDPCHKERR(info);
200 for (i=0;i<nnzmats;i++){
202 info=DSDPVecGetElement(vrow,ii,&dyiscale);DSDPCHKVARERR(ii,info);
203 if (dyiscale==0)
continue;
206 for (dd2=0,k=0; k<rank; k++){
208 if (ack==0)
continue;
213 dtmp = dd2 * dyiscale *mu *scl;
214 info=DSDPVecAddElement(vout,ii,dtmp);DSDPCHKVARERR(ii,info);
217 DSDPFunctionReturn(0);
223#define __FUNCT__ "SDPConeComputeXX"
237 int info, i, ii,k, rank, n, nnzmats;
238 double dtmp,dyiscale,ack,scl;
239 SDPblk *sdp=&sdpcone->blk[blockj];
242 DSDPIndex IS=sdp->IS;
246 mu=mu*sdp->gammamu; n=sdp->n;
249 for (i=0;i<nnzmats;i++){
251 info=DSDPVecGetElement(DY,ii,&dyiscale);DSDPCHKVARERR(ii,info);
252 if (dyiscale==0)
continue;
254 for (k=0; k<rank; k++){
256 if (ack==0)
continue;
258 dtmp = ack * dyiscale * mu * scl;
264 DSDPFunctionReturn(0);
int SDPConeCheckJ(SDPCone sdpcone, int blockj)
Check validity of parameter.
DSDPTruth
Boolean variables.
int DSDPBlockGetMatrix(DSDPBlockData *ADATA, int id, int *vari, double *scl, DSDPDataMat *A)
Get a data matrix from a block of data.
int DSDPBlockASum(DSDPBlockData *ADATA, double aa, DSDPVec Yk, DSDPVMat XX)
Sum the data matrices.
int DSDPBlockCountNonzeroMatrices(DSDPBlockData *ADATA, int *nzmats)
Count how many data matrices are in a block of data.
int DSDPBlockvAv(DSDPBlockData *ADATA, double aa, DSDPVec Alpha, SDPConeVec V, DSDPVec VAV)
Set VAV[i] to aa * Alpha[i] * V' A[i] V.
int DSDPBlockADot(DSDPBlockData *ADATA, double aa, DSDPVec Alpha, DSDPVMat X, DSDPVec AX)
Compute inner product of XX with data matrices.
int DSDPDataMatGetEig(DSDPDataMat A, int rr, SDPConeVec V, DSDPIndex S, double *eigenvalue)
Get an eigenvalue/vector pair.
int DSDPDataMatGetRank(DSDPDataMat A, int *rank, int n)
Get the number of nonzero eigenvalues/eigenvectors for the matrix.
int DSDPDSMatVecVec(DSDPDSMat A, SDPConeVec X, double *vAv)
Compute the product x' A x.
int DSDPDSMatSetArray(DSDPDSMat A, DSDPVMat T)
Set values into the matrix.
int DSDPDualMatInverseAdd(DSDPDualMat S, double alpha, DSDPVMat T)
Add a multiple of the inverse to T.
int DSDPDualMatInverseMultiply(DSDPDualMat S, DSDPIndex IS, SDPConeVec B, SDPConeVec X)
Multiply the inverse by a vector or solve the system of equations.
int DSDPSchurMatRowColumnScaling(DSDPSchurMat, int, DSDPVec, int *)
Get the scaling and nonzero pattern of each column in this row of the matrix.
int DSDPSchurMatAddRow(DSDPSchurMat, int, double, DSDPVec)
Add elements to a row of the Schur matrix.
Internal SDPCone data structures and routines.
Error handling, printing, and profiling.
struct DSDPVec_C DSDPVec
This object hold m+2 variables: a scaling of C, the y variables, and r.
int DSDPVMatZeroEntries(DSDPVMat X)
Zero matrix.
int DSDPVMatAddOuterProduct(DSDPVMat X, double alpha, SDPConeVec V)
Add outer product of a vector to the matrix.
int SDPConeComputeHessian(SDPCone sdpcone, double mu, DSDPSchurMat M, DSDPVec vrhs1, DSDPVec vrhs2)
Compute the Hessian to the barrier term.
int SDPConeComputeXX(SDPCone sdpcone, int blockj, DSDPVec DY, double mu, DSDPDualMat S, DSDPVMat X)
Compute X.
int SDPConeMultiply(SDPCone sdpcone, int blockj, double mu, DSDPVec vrow, DSDPVec vin, DSDPVec vout)
Compute the gradient to the barrier term.
int SDPConeComputeRHS(SDPCone sdpcone, int blockj, double mu, DSDPVec vrow, DSDPVec vrhs1, DSDPVec vrhs2)
Compute the gradient to the barrier term.
int SDPConeVecDot(SDPConeVec V1, SDPConeVec V2, double *ans)
Inner product of two vectors.
Symmetric Delta S matrix for one block in the semidefinite cone.
Symmetric data matrix for one block in the semidefinite cone.
Internal structure for transpose of data.
Represents an S matrix for one block in the semidefinite cone.
Schur complement matrix whose solution is the Newton direction.
Dense symmetric matrix for one block in the semidefinite cone.
Vector whose length corresponds to dimension of a block in a cone.
Internal structure for semidefinite cone.
Internal structure for block of semidefinite cone.