Logo Search packages:      
Sourcecode: dsdp version File versions  Download package

int SDPConeComputeRHS ( SDPCone  sdpcone,
int  blockj,
double  mu,
DSDPVec  vrow,
DSDPVec  vrhs1,
DSDPVec  vrhs2 
)

Compute the gradient to the barrier term.

Parameters:
sdpcone semidefinite cone
blockj block of the cone.
mu barrier parameter
vrow scalar to multiply each element of gradient.
vrhs1 dual objectvive gradient.
vrhs2 barrier gradient

Definition at line 125 of file sdpcompute.c.

References SDPblk::ADATA, SDPCone_C::blk, DSDP_FALSE, DSDP_TRUE, DSDPBlockADot(), DSDPBlockCountNonzeroMatrices(), DSDPBlockGetMatrix(), DSDPDataMatGetEig(), DSDPDataMatGetRank(), DSDPDualMatInverseAdd(), DSDPDualMatInverseMultiply(), DSDPVMatZeroEntries(), SDPblk::IS, SDPblk::n, SDPblk::S, SDPConeCheckJ(), SDPConeVecDot(), SDPblk::T, SDPblk::W, and SDPblk::W2.

                                                                                                          {

  int info,i,ii,k,rank,nnzmats;
  double dtmp,dyiscale=1,ack,scl,rtemp;
  SDPblk *sdp=&sdpcone->blk[blockj];
  SDPConeVec W=sdp->W,W2=sdp->W2;
  DSDPDataMat AA;
  DSDPVMat T=sdp->T;
  DSDPDualMat S=sdp->S;
  DSDPTruth method1;
  DSDPIndex IS=sdp->IS;

  DSDPFunctionBegin;

  info=SDPConeCheckJ(sdpcone,blockj);DSDPCHKERR(info);
  method1=DSDP_TRUE;
  method1=DSDP_FALSE;

  if (method1==DSDP_TRUE){
    info=DSDPBlockCountNonzeroMatrices(&sdp->ADATA,&nnzmats);DSDPCHKERR(info);
    for (i=0;i<nnzmats;i++){
      info=DSDPBlockGetMatrix(&sdp->ADATA,i,&ii,&scl,&AA);DSDPCHKERR(info);
      info=DSDPVecGetElement(vrow,ii,&dyiscale);DSDPCHKVARERR(ii,info);
      if (dyiscale==0) continue;
      info=DSDPDataMatGetRank(AA,&rank,sdp->n);DSDPCHKVARERR(ii,info);
      for (k=0; k<rank; k++){
      info=DSDPDataMatGetEig(AA,k,W,IS,&ack); DSDPCHKVARERR(ii,info);
      if (ack==0) continue;
      info=DSDPDualMatInverseMultiply(S,IS,W,W2);DSDPCHKVARERR(ii,info);
      info=SDPConeVecDot(W,W2,&rtemp); DSDPCHKVARERR(ii,info);
      dtmp=rtemp*ack*mu*dyiscale*scl;
      info=DSDPVecAddElement(vrhs2,ii,dtmp);DSDPCHKVARERR(ii,info);
      }
    }
    
  } else {
    info=DSDPVMatZeroEntries(T);DSDPCHKERR(info);
    info=DSDPDualMatInverseAdd(S,mu,T);DSDPCHKERR(info);
    info=DSDPBlockADot(&sdp->ADATA,1.0,vrow,T,vrhs2);DSDPCHKERR(info);
  }
  
  DSDPFunctionReturn(0);
}


Generated by  Doxygen 1.6.0   Back to index