<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>DSDP: src/sdp/sdpcompute.c Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.4 --> <div id="top"> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">DSDP</div> </td> </tr> </tbody> </table> </div> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="dir_23046874d7fed141927c769a66d8e3a5.html">src</a> </li> <li class="navelem"><a class="el" href="dir_2c21778722bc8593635d5ebd154ac3f7.html">sdp</a> </li> </ul> </div> </div> <div class="header"> <div class="headertitle"> <div class="title">sdpcompute.c</div> </div> </div> <div class="contents"> <a href="sdpcompute_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#include "<a class="code" href="dsdpsdp_8h.html" title="Internal SDPCone data structures and routines.">dsdpsdp.h</a>"</span> <a name="l00002"></a>00002 <span class="preprocessor">#include "<a class="code" href="dsdpsys_8h.html" title="Error handling, printing, and profiling.">dsdpsys.h</a>"</span> <a name="l00008"></a>00008 <span class="comment">/*</span> <a name="l00009"></a>00009 <span class="comment">static int tt1=0,tt2=0;</span> <a name="l00010"></a>00010 <span class="comment"> DSDPEventLogBegin(tt1);</span> <a name="l00011"></a>00011 <span class="comment"> DSDPEventLogBegin(tt2);</span> <a name="l00012"></a>00012 <span class="comment"> DSDPEventLogEnd(tt2);</span> <a name="l00013"></a>00013 <span class="comment"> DSDPEventLogEnd(tt1);</span> <a name="l00014"></a>00014 <span class="comment"> if (tt1==0){DSDPEventLogRegister("SDP T1 Event",&tt1);}</span> <a name="l00015"></a>00015 <span class="comment"> if (tt2==0){DSDPEventLogRegister("SDP T2 Event",&tt2);}</span> <a name="l00016"></a>00016 <span class="comment">*/</span> <a name="l00017"></a>00017 <span class="preprocessor">#undef __FUNCT__ </span> <a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "SDPConeComputeHessian"</span> <a name="l00019"></a>00019 <span class="preprocessor"></span> <a name="l00030"></a><a class="code" href="sdpcompute_8c.html#a342d54641970a32dc4abd9c7b3d674a8">00030</a> <span class="keywordtype">int</span> <a class="code" href="dsdpsdp_8h.html#a3adb86d30c297ad0a4a0aadbcd8ae6ba" title="Compute the Hessian to the barrier term.">SDPConeComputeHessian</a>( <a class="code" href="structSDPCone__C.html" title="Internal structure for semidefinite cone.">SDPCone</a> sdpcone, <span class="keywordtype">double</span> mu, <a class="code" href="structDSDPSchurMat__C.html" title="Schur complement matrix whose solution is the Newton direction.">DSDPSchurMat</a> M, <a class="code" href="dsdpvec_8h.html#a421243d35437ad44ded3c1e34198e8e9" title="This object hold m+2 variables: a scaling of C, the y variables, and r.">DSDPVec</a> vrhs1, <a class="code" href="dsdpvec_8h.html#a421243d35437ad44ded3c1e34198e8e9" title="This object hold m+2 variables: a scaling of C, the y variables, and r.">DSDPVec</a> vrhs2){ <a name="l00031"></a>00031 <a name="l00032"></a>00032 <span class="keywordtype">int</span> i,k,kt,kk,m,n,rank,info; <a name="l00033"></a>00033 <span class="keywordtype">int</span> ncols,ii,idA; <a name="l00034"></a>00034 <span class="keywordtype">double</span> rtemp,ack,ggamma,bmu,scl; <a name="l00035"></a>00035 <span class="keywordtype">double</span> rhs1i,rhs2i; <a name="l00036"></a>00036 <a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65" title="Boolean variables.">DSDPTruth</a> method1; <a name="l00037"></a>00037 <a class="code" href="structSDPConeVec__C.html" title="Vector whose length corresponds to dimension of a block in a cone.">SDPConeVec</a> W,W2; <a name="l00038"></a>00038 <a class="code" href="dsdpvec_8h.html#a421243d35437ad44ded3c1e34198e8e9" title="This object hold m+2 variables: a scaling of C, the y variables, and r.">DSDPVec</a> MRowI=sdpcone->Work, Select=sdpcone->Work2; <a name="l00039"></a>00039 <a class="code" href="structDSDPDataMat__C.html" title="Symmetric data matrix for one block in the semidefinite cone.">DSDPDataMat</a> AA; <a name="l00040"></a>00040 <a class="code" href="structDSDPDualMat__C.html" title="Represents an S matrix for one block in the semidefinite cone.">DSDPDualMat</a> S; <a name="l00041"></a>00041 <a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> T; <a name="l00042"></a>00042 <a class="code" href="structDSDPDataTranspose.html" title="Internal structure for transpose of data.">DSDPDataTranspose</a> ATranspose=sdpcone->ATR; <a name="l00043"></a>00043 <a class="code" href="structSDPblk.html" title="Internal structure for block of semidefinite cone.">SDPblk</a> *blk=sdpcone->blk; <a name="l00044"></a>00044 DSDPIndex IS; <a name="l00045"></a>00045 <a name="l00046"></a>00046 <span class="comment">/* Evaluate M */</span> <a name="l00047"></a>00047 DSDPFunctionBegin; <a name="l00048"></a>00048 SDPConeValid(sdpcone); <a name="l00049"></a>00049 info=DSDPVecGetSize(vrhs1,&m);DSDPCHKERR(info); <a name="l00050"></a>00050 <a name="l00051"></a>00051 <span class="keywordflow">for</span> (i=0; i<m; i++){ <span class="comment">/* One row at a time */</span> <a name="l00052"></a>00052 <a name="l00053"></a>00053 <span class="comment">/* Which Coluns */</span> <a name="l00054"></a>00054 rhs1i=0;rhs2i=0; <a name="l00055"></a>00055 info=DSDPVecZero(MRowI);DSDPCHKERR(info); <a name="l00056"></a>00056 info=<a class="code" href="dsdpschurmat_8h.html#ac898fbdcd22765401a81682609dc897c" title="Get the scaling and nonzero pattern of each column in this row of the matrix.">DSDPSchurMatRowColumnScaling</a>(M,i,Select,&ncols); DSDPCHKERR(info); <a name="l00057"></a>00057 <span class="keywordflow">if</span> (ncols==0){<span class="keywordflow">continue</span>;} <a name="l00058"></a>00058 <a name="l00059"></a>00059 <span class="keywordflow">for</span> (kt=0; kt<ATranspose.nnzblocks[i]; kt++){ <span class="comment">/* Loop over all blocks */</span> <a name="l00060"></a>00060 kk=ATranspose.nzblocks[i][kt]; <a name="l00061"></a>00061 idA=ATranspose.idA[i][kt]; <a name="l00062"></a>00062 info=<a class="code" href="dsdpblock_8c.html#a4154d7692828019b8f2d0f407310188c" title="Get a data matrix from a block of data.">DSDPBlockGetMatrix</a>(&blk[kk].ADATA,idA,&ii,&scl,&AA);DSDPCHKBLOCKERR(kk,info); <a name="l00063"></a>00063 <span class="keywordflow">if</span> (ii!=i){DSDPSETERR2(8,<span class="stringliteral">"Data Transpose Error: var %d does not equal %d.\n"</span>,i,ii);} <a name="l00064"></a>00064 info = <a class="code" href="dsdpdatamat_8c.html#a935d091cc12e6ce7ec0a8126b4f18df1" title="Get the number of nonzero eigenvalues/eigenvectors for the matrix.">DSDPDataMatGetRank</a>(AA,&rank,blk[kk].n);DSDPCHKBLOCKERR(kk,info); <a name="l00065"></a>00065 <span class="keywordflow">if</span> (rank==0) <span class="keywordflow">continue</span>; <a name="l00066"></a>00066 <a name="l00067"></a>00067 T=blk[kk].T; S=blk[kk].S; W=blk[kk].W; W2=blk[kk].W2; <a name="l00068"></a>00068 n=blk[kk].n; ggamma=blk[kk].gammamu; bmu=blk[kk].bmu; IS=blk[kk].IS; <a name="l00069"></a>00069 <a name="l00070"></a>00070 method1=<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65ae6b2e53e51e94a5fa7204ceac78f824f">DSDP_TRUE</a>; <span class="comment">/* Simple heuristic */</span> <a name="l00071"></a>00071 <span class="keywordflow">if</span> (rank==1) method1=<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65a74385569aa7a59059a8847e2d39b754c">DSDP_FALSE</a>; <a name="l00072"></a>00072 <span class="keywordflow">if</span> (rank==2 && ncols<=n) method1=<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65a74385569aa7a59059a8847e2d39b754c">DSDP_FALSE</a>; <a name="l00073"></a>00073 <span class="keywordflow">if</span> (rank*rank*ncols<=n+1)method1=<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65a74385569aa7a59059a8847e2d39b754c">DSDP_FALSE</a>; <a name="l00074"></a>00074 <span class="keywordflow">if</span> (ncols*blk[kk].nnz < n*n/10) method1=<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65a74385569aa7a59059a8847e2d39b754c">DSDP_FALSE</a>; <a name="l00075"></a>00075 <span class="keywordflow">if</span> (ncols==1 && i==m-1)method1=<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65a74385569aa7a59059a8847e2d39b754c">DSDP_FALSE</a>; <a name="l00076"></a>00076 <span class="keywordflow">if</span> (n<5) method1=<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65ae6b2e53e51e94a5fa7204ceac78f824f">DSDP_TRUE</a>; <a name="l00077"></a>00077 <span class="keywordflow">if</span> (0==1) method1=<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65a74385569aa7a59059a8847e2d39b754c">DSDP_FALSE</a>; <a name="l00078"></a>00078 <span class="keywordflow">if</span> (method1==<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65ae6b2e53e51e94a5fa7204ceac78f824f">DSDP_TRUE</a>){info=<a class="code" href="dsdpxmat_8c.html#a9bf5b99c68ebd39086408bcdc430caa6" title="Zero matrix.">DSDPVMatZeroEntries</a>(T);DSDPCHKBLOCKERR(kk,info);} <a name="l00079"></a>00079 <span class="keywordflow">for</span> (k=0; k<rank; k++){ <a name="l00080"></a>00080 <a name="l00081"></a>00081 info=<a class="code" href="dsdpdatamat_8c.html#a5a0f6c719037c1998630768a34685414" title="Get an eigenvalue/vector pair.">DSDPDataMatGetEig</a>(AA,k,W,IS,&ack); DSDPCHKBLOCKERR(kk,info); <a name="l00082"></a>00082 <span class="keywordflow">if</span> (ack==0.0) <span class="keywordflow">continue</span>; <a name="l00083"></a>00083 ack*=scl; <a name="l00084"></a>00084 info=<a class="code" href="dsdpdualmat_8c.html#ae31b03506a9c2aa5ebd33f1e0a00308c" title="Multiply the inverse by a vector or solve the system of equations.">DSDPDualMatInverseMultiply</a>(S,IS,W,W2);DSDPCHKBLOCKERR(kk,info); <a name="l00085"></a>00085 <a name="l00086"></a>00086 <span class="comment">/* RHS terms */</span> <a name="l00087"></a>00087 info = <a class="code" href="sdpconevec_8c.html#aaf2acb6a6221592957980b795972776f" title="Inner product of two vectors.">SDPConeVecDot</a>(W,W2,&rtemp); DSDPCHKBLOCKERR(kk,info); <a name="l00088"></a>00088 <span class="keywordflow">if</span> (rtemp==0.0) <span class="keywordflow">continue</span>; <a name="l00089"></a>00089 rhs1i+=rtemp*ack*bmu; rhs2i+=rtemp*ack*ggamma*mu; <a name="l00090"></a>00090 ack*=(ggamma+bmu); <a name="l00091"></a>00091 <a name="l00092"></a>00092 <span class="keywordflow">if</span> (method1==<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65ae6b2e53e51e94a5fa7204ceac78f824f">DSDP_TRUE</a>){ <a name="l00093"></a>00093 info=<a class="code" href="dsdpxmat_8c.html#aaa8cdde5690e6a567cf6a9ea82bc90f2" title="Add outer product of a vector to the matrix.">DSDPVMatAddOuterProduct</a>(T,ack*mu,W2);DSDPCHKBLOCKERR(kk,info); <a name="l00094"></a>00094 } <span class="keywordflow">else</span> { <a name="l00095"></a>00095 info=<a class="code" href="dsdpblock_8c.html#ac40c42f8b658e8913c9e983443a7f86b" title="Set VAV[i] to aa * Alpha[i] * V' A[i] V.">DSDPBlockvAv</a>(&blk[kk].ADATA,ack*mu,Select,W2,MRowI);DSDPCHKBLOCKERR(kk,info); <a name="l00096"></a>00096 } <span class="comment">/* End row computations for rank kk of block kk */</span> <a name="l00097"></a>00097 <a name="l00098"></a>00098 } <span class="comment">/* End row computations for all of block kk */</span> <a name="l00099"></a>00099 <a name="l00100"></a>00100 <span class="keywordflow">if</span> (method1==<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65ae6b2e53e51e94a5fa7204ceac78f824f">DSDP_TRUE</a>){ <a name="l00101"></a>00101 info=<a class="code" href="dsdpblock_8c.html#ad44dbf8c3e12441b64fb7725fc6be04e" title="Compute inner product of XX with data matrices.">DSDPBlockADot</a>(&blk[kk].ADATA,1.0,Select,T,MRowI);DSDPCHKBLOCKERR(kk,info); <a name="l00102"></a>00102 } <span class="comment">/* End row computations for all of block ll */</span> <a name="l00103"></a>00103 } <span class="comment">/* End row computations for all blocks */</span> <a name="l00104"></a>00104 info=DSDPVecAddElement(vrhs1,i,rhs1i);DSDPCHKERR(info); <a name="l00105"></a>00105 info=DSDPVecAddElement(vrhs2,i,rhs2i);DSDPCHKERR(info); <a name="l00106"></a>00106 info=<a class="code" href="dsdpschurmat_8h.html#af719c02885dbf6f831e92e8f83ffa0b5" title="Add elements to a row of the Schur matrix.">DSDPSchurMatAddRow</a>(M,i,1.0,MRowI);DSDPCHKERR(info); <a name="l00107"></a>00107 } <a name="l00108"></a>00108 <a name="l00109"></a>00109 DSDPFunctionReturn(0); <a name="l00110"></a>00110 } <a name="l00111"></a>00111 <a name="l00112"></a>00112 <span class="preprocessor">#undef __FUNCT__ </span> <a name="l00113"></a>00113 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "SDPConeComputeRHS"</span> <a name="l00114"></a>00114 <span class="preprocessor"></span> <a name="l00125"></a><a class="code" href="sdpcompute_8c.html#ab98023107755ae6eaab00701bc237cef">00125</a> <span class="keywordtype">int</span> <a class="code" href="dsdpsdp_8h.html#a334c8bff3cbf28a420dbe7f93cbe33ab" title="Compute the gradient to the barrier term.">SDPConeComputeRHS</a>( <a class="code" href="structSDPCone__C.html" title="Internal structure for semidefinite cone.">SDPCone</a> sdpcone, <span class="keywordtype">int</span> blockj, <span class="keywordtype">double</span> mu, <a class="code" href="dsdpvec_8h.html#a421243d35437ad44ded3c1e34198e8e9" title="This object hold m+2 variables: a scaling of C, the y variables, and r.">DSDPVec</a> vrow, <a class="code" href="dsdpvec_8h.html#a421243d35437ad44ded3c1e34198e8e9" title="This object hold m+2 variables: a scaling of C, the y variables, and r.">DSDPVec</a> vrhs1, <a class="code" href="dsdpvec_8h.html#a421243d35437ad44ded3c1e34198e8e9" title="This object hold m+2 variables: a scaling of C, the y variables, and r.">DSDPVec</a> vrhs2){ <a name="l00126"></a>00126 <a name="l00127"></a>00127 <span class="keywordtype">int</span> info,i,ii,k,rank,nnzmats; <a name="l00128"></a>00128 <span class="keywordtype">double</span> dtmp,dyiscale=1,ack,scl,rtemp; <a name="l00129"></a>00129 <a class="code" href="structSDPblk.html" title="Internal structure for block of semidefinite cone.">SDPblk</a> *sdp=&sdpcone->blk[blockj]; <a name="l00130"></a>00130 <a class="code" href="structSDPConeVec__C.html" title="Vector whose length corresponds to dimension of a block in a cone.">SDPConeVec</a> W=sdp->W,W2=sdp->W2; <a name="l00131"></a>00131 <a class="code" href="structDSDPDataMat__C.html" title="Symmetric data matrix for one block in the semidefinite cone.">DSDPDataMat</a> AA; <a name="l00132"></a>00132 <a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> T=sdp->T; <a name="l00133"></a>00133 <a class="code" href="structDSDPDualMat__C.html" title="Represents an S matrix for one block in the semidefinite cone.">DSDPDualMat</a> S=sdp->S; <a name="l00134"></a>00134 <a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65" title="Boolean variables.">DSDPTruth</a> method1; <a name="l00135"></a>00135 DSDPIndex IS=sdp->IS; <a name="l00136"></a>00136 <a name="l00137"></a>00137 DSDPFunctionBegin; <a name="l00138"></a>00138 <a name="l00139"></a>00139 info=<a class="code" href="dsdpadddata_8c.html#a8043a5d379af0a18dcd0e5d4fd82387e" title="Check validity of parameter.">SDPConeCheckJ</a>(sdpcone,blockj);DSDPCHKERR(info); <a name="l00140"></a>00140 method1=<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65ae6b2e53e51e94a5fa7204ceac78f824f">DSDP_TRUE</a>; <a name="l00141"></a>00141 method1=<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65a74385569aa7a59059a8847e2d39b754c">DSDP_FALSE</a>; <a name="l00142"></a>00142 <a name="l00143"></a>00143 <span class="keywordflow">if</span> (method1==<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65ae6b2e53e51e94a5fa7204ceac78f824f">DSDP_TRUE</a>){ <a name="l00144"></a>00144 info=<a class="code" href="dsdpblock_8c.html#aa48f55168b6780852229dea20c3f1d38" title="Count how many data matrices are in a block of data.">DSDPBlockCountNonzeroMatrices</a>(&sdp->ADATA,&nnzmats);DSDPCHKERR(info); <a name="l00145"></a>00145 <span class="keywordflow">for</span> (i=0;i<nnzmats;i++){ <a name="l00146"></a>00146 info=<a class="code" href="dsdpblock_8c.html#a4154d7692828019b8f2d0f407310188c" title="Get a data matrix from a block of data.">DSDPBlockGetMatrix</a>(&sdp->ADATA,i,&ii,&scl,&AA);DSDPCHKERR(info); <a name="l00147"></a>00147 info=DSDPVecGetElement(vrow,ii,&dyiscale);DSDPCHKVARERR(ii,info); <a name="l00148"></a>00148 <span class="keywordflow">if</span> (dyiscale==0) <span class="keywordflow">continue</span>; <a name="l00149"></a>00149 info=<a class="code" href="dsdpdatamat_8c.html#a935d091cc12e6ce7ec0a8126b4f18df1" title="Get the number of nonzero eigenvalues/eigenvectors for the matrix.">DSDPDataMatGetRank</a>(AA,&rank,sdp->n);DSDPCHKVARERR(ii,info); <a name="l00150"></a>00150 <span class="keywordflow">for</span> (k=0; k<rank; k++){ <a name="l00151"></a>00151 info=<a class="code" href="dsdpdatamat_8c.html#a5a0f6c719037c1998630768a34685414" title="Get an eigenvalue/vector pair.">DSDPDataMatGetEig</a>(AA,k,W,IS,&ack); DSDPCHKVARERR(ii,info); <a name="l00152"></a>00152 <span class="keywordflow">if</span> (ack==0) <span class="keywordflow">continue</span>; <a name="l00153"></a>00153 info=<a class="code" href="dsdpdualmat_8c.html#ae31b03506a9c2aa5ebd33f1e0a00308c" title="Multiply the inverse by a vector or solve the system of equations.">DSDPDualMatInverseMultiply</a>(S,IS,W,W2);DSDPCHKVARERR(ii,info); <a name="l00154"></a>00154 info=<a class="code" href="sdpconevec_8c.html#aaf2acb6a6221592957980b795972776f" title="Inner product of two vectors.">SDPConeVecDot</a>(W,W2,&rtemp); DSDPCHKVARERR(ii,info); <a name="l00155"></a>00155 dtmp=rtemp*ack*mu*dyiscale*scl; <a name="l00156"></a>00156 info=DSDPVecAddElement(vrhs2,ii,dtmp);DSDPCHKVARERR(ii,info); <a name="l00157"></a>00157 } <a name="l00158"></a>00158 } <a name="l00159"></a>00159 <a name="l00160"></a>00160 } <span class="keywordflow">else</span> { <a name="l00161"></a>00161 info=<a class="code" href="dsdpxmat_8c.html#a9bf5b99c68ebd39086408bcdc430caa6" title="Zero matrix.">DSDPVMatZeroEntries</a>(T);DSDPCHKERR(info); <a name="l00162"></a>00162 info=<a class="code" href="dsdpdualmat_8c.html#a3dc27b759db28929d92bd3a63b632681" title="Add a multiple of the inverse to T.">DSDPDualMatInverseAdd</a>(S,mu,T);DSDPCHKERR(info); <a name="l00163"></a>00163 info=<a class="code" href="dsdpblock_8c.html#ad44dbf8c3e12441b64fb7725fc6be04e" title="Compute inner product of XX with data matrices.">DSDPBlockADot</a>(&sdp->ADATA,1.0,vrow,T,vrhs2);DSDPCHKERR(info); <a name="l00164"></a>00164 } <a name="l00165"></a>00165 <a name="l00166"></a>00166 DSDPFunctionReturn(0); <a name="l00167"></a>00167 } <a name="l00168"></a>00168 <a name="l00169"></a>00169 <span class="preprocessor">#undef __FUNCT__ </span> <a name="l00170"></a>00170 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "SDPConeMultiply"</span> <a name="l00171"></a>00171 <span class="preprocessor"></span> <a name="l00182"></a><a class="code" href="sdpcompute_8c.html#aa8720bd15d7c1c4fd43a4039f26b74c4">00182</a> <span class="keywordtype">int</span> <a class="code" href="dsdpsdp_8h.html#a1f6d75e7c4f9f16ffc5126a6c9faeee1" title="Compute the gradient to the barrier term.">SDPConeMultiply</a>(<a class="code" href="structSDPCone__C.html" title="Internal structure for semidefinite cone.">SDPCone</a> sdpcone, <span class="keywordtype">int</span> blockj, <span class="keywordtype">double</span> mu, <a class="code" href="dsdpvec_8h.html#a421243d35437ad44ded3c1e34198e8e9" title="This object hold m+2 variables: a scaling of C, the y variables, and r.">DSDPVec</a> vrow, <a class="code" href="dsdpvec_8h.html#a421243d35437ad44ded3c1e34198e8e9" title="This object hold m+2 variables: a scaling of C, the y variables, and r.">DSDPVec</a> vin, <a class="code" href="dsdpvec_8h.html#a421243d35437ad44ded3c1e34198e8e9" title="This object hold m+2 variables: a scaling of C, the y variables, and r.">DSDPVec</a> vout){ <a name="l00183"></a>00183 <a name="l00184"></a>00184 <span class="keywordtype">int</span> info,i,ii,k,rank,nnzmats; <a name="l00185"></a>00185 <span class="keywordtype">double</span> dd2,dtmp,dyiscale,ack,scl,vv; <a name="l00186"></a>00186 <a class="code" href="structSDPblk.html" title="Internal structure for block of semidefinite cone.">SDPblk</a> *sdp=&sdpcone->blk[blockj]; <a name="l00187"></a>00187 <a class="code" href="structSDPConeVec__C.html" title="Vector whose length corresponds to dimension of a block in a cone.">SDPConeVec</a> W=sdp->W,W2=sdp->W2; <a name="l00188"></a>00188 <a class="code" href="structDSDPDataMat__C.html" title="Symmetric data matrix for one block in the semidefinite cone.">DSDPDataMat</a> AA; <a name="l00189"></a>00189 <a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> T=sdp->T; <a name="l00190"></a>00190 <a class="code" href="structDSDPDSMat__C.html" title="Symmetric Delta S matrix for one block in the semidefinite cone.">DSDPDSMat</a> DS=sdp->DS; <a name="l00191"></a>00191 DSDPIndex IS=sdp->IS; <a name="l00192"></a>00192 <a class="code" href="structDSDPDualMat__C.html" title="Represents an S matrix for one block in the semidefinite cone.">DSDPDualMat</a> S=sdp->S; <a name="l00193"></a>00193 <a name="l00194"></a>00194 DSDPFunctionBegin; <a name="l00195"></a>00195 info=<a class="code" href="dsdpadddata_8c.html#a8043a5d379af0a18dcd0e5d4fd82387e" title="Check validity of parameter.">SDPConeCheckJ</a>(sdpcone,blockj);DSDPCHKERR(info); <a name="l00196"></a>00196 info=<a class="code" href="dsdpxmat_8c.html#a9bf5b99c68ebd39086408bcdc430caa6" title="Zero matrix.">DSDPVMatZeroEntries</a>(T); DSDPCHKERR(info); <a name="l00197"></a>00197 info=<a class="code" href="dsdpblock_8c.html#a8142db7eef0f4770bf79e05a81b01401" title="Sum the data matrices.">DSDPBlockASum</a>(&sdp->ADATA,-1.0,vin,T); DSDPCHKERR(info); <a name="l00198"></a>00198 info=<a class="code" href="dsdpdsmat_8c.html#a458ba9739ca12e14736a90034611951b" title="Set values into the matrix.">DSDPDSMatSetArray</a>(DS,T); DSDPCHKERR(info); <a name="l00199"></a>00199 info=<a class="code" href="dsdpblock_8c.html#aa48f55168b6780852229dea20c3f1d38" title="Count how many data matrices are in a block of data.">DSDPBlockCountNonzeroMatrices</a>(&sdp->ADATA,&nnzmats);DSDPCHKERR(info); <a name="l00200"></a>00200 <span class="keywordflow">for</span> (i=0;i<nnzmats;i++){ <a name="l00201"></a>00201 info=<a class="code" href="dsdpblock_8c.html#a4154d7692828019b8f2d0f407310188c" title="Get a data matrix from a block of data.">DSDPBlockGetMatrix</a>(&sdp->ADATA,i,&ii,&scl,&AA);DSDPCHKERR(info); <a name="l00202"></a>00202 info=DSDPVecGetElement(vrow,ii,&dyiscale);DSDPCHKVARERR(ii,info); <a name="l00203"></a>00203 <span class="keywordflow">if</span> (dyiscale==0) <span class="keywordflow">continue</span>; <a name="l00204"></a>00204 <a name="l00205"></a>00205 info=<a class="code" href="dsdpdatamat_8c.html#a935d091cc12e6ce7ec0a8126b4f18df1" title="Get the number of nonzero eigenvalues/eigenvectors for the matrix.">DSDPDataMatGetRank</a>(AA,&rank,sdp->n);DSDPCHKVARERR(ii,info); <a name="l00206"></a>00206 <span class="keywordflow">for</span> (dd2=0,k=0; k<rank; k++){ <a name="l00207"></a>00207 info=<a class="code" href="dsdpdatamat_8c.html#a5a0f6c719037c1998630768a34685414" title="Get an eigenvalue/vector pair.">DSDPDataMatGetEig</a>(AA,k,W,IS,&ack); DSDPCHKVARERR(ii,info); <a name="l00208"></a>00208 <span class="keywordflow">if</span> (ack==0) <span class="keywordflow">continue</span>; <a name="l00209"></a>00209 info=<a class="code" href="dsdpdualmat_8c.html#ae31b03506a9c2aa5ebd33f1e0a00308c" title="Multiply the inverse by a vector or solve the system of equations.">DSDPDualMatInverseMultiply</a>(S,IS,W,W2);DSDPCHKVARERR(ii,info); <a name="l00210"></a>00210 info=<a class="code" href="dsdpdsmat_8c.html#a3875114b5db6bec165ac6e9293862623" title="Compute the product x' A x.">DSDPDSMatVecVec</a>(DS,W2,&vv);DSDPCHKVARERR(ii,info); <a name="l00211"></a>00211 dd2+=vv*ack; <a name="l00212"></a>00212 } <a name="l00213"></a>00213 dtmp = dd2 * dyiscale *mu *scl; <a name="l00214"></a>00214 info=DSDPVecAddElement(vout,ii,dtmp);DSDPCHKVARERR(ii,info); <a name="l00215"></a>00215 } <a name="l00216"></a>00216 <a name="l00217"></a>00217 DSDPFunctionReturn(0); <a name="l00218"></a>00218 } <a name="l00219"></a>00219 <a name="l00220"></a>00220 <a name="l00221"></a>00221 <a name="l00222"></a>00222 <span class="preprocessor">#undef __FUNCT__ </span> <a name="l00223"></a>00223 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "SDPConeComputeXX"</span> <a name="l00224"></a>00224 <span class="preprocessor"></span> <a name="l00235"></a><a class="code" href="sdpcompute_8c.html#a75f84e7c513f300729984f191d47549f">00235</a> <span class="keywordtype">int</span> <a class="code" href="dsdpsdp_8h.html#a4b077e6275df502022d09162511c4712" title="Compute X.">SDPConeComputeXX</a>(<a class="code" href="structSDPCone__C.html" title="Internal structure for semidefinite cone.">SDPCone</a> sdpcone, <span class="keywordtype">int</span> blockj, <a class="code" href="dsdpvec_8h.html#a421243d35437ad44ded3c1e34198e8e9" title="This object hold m+2 variables: a scaling of C, the y variables, and r.">DSDPVec</a> DY, <span class="keywordtype">double</span> mu,<a class="code" href="structDSDPDualMat__C.html" title="Represents an S matrix for one block in the semidefinite cone.">DSDPDualMat</a> S, <a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> X){ <a name="l00236"></a>00236 <a name="l00237"></a>00237 <span class="keywordtype">int</span> info, i, ii,k, rank, n, nnzmats; <a name="l00238"></a>00238 <span class="keywordtype">double</span> dtmp,dyiscale,ack,scl; <a name="l00239"></a>00239 <a class="code" href="structSDPblk.html" title="Internal structure for block of semidefinite cone.">SDPblk</a> *sdp=&sdpcone->blk[blockj]; <a name="l00240"></a>00240 <a class="code" href="structSDPConeVec__C.html" title="Vector whose length corresponds to dimension of a block in a cone.">SDPConeVec</a> W=sdp->W,W2=sdp->W2; <a name="l00241"></a>00241 <a class="code" href="structDSDPDataMat__C.html" title="Symmetric data matrix for one block in the semidefinite cone.">DSDPDataMat</a> AA; <a name="l00242"></a>00242 DSDPIndex IS=sdp->IS; <a name="l00243"></a>00243 <a name="l00244"></a>00244 DSDPFunctionBegin; <a name="l00245"></a>00245 info=<a class="code" href="dsdpadddata_8c.html#a8043a5d379af0a18dcd0e5d4fd82387e" title="Check validity of parameter.">SDPConeCheckJ</a>(sdpcone,blockj);DSDPCHKERR(info); <a name="l00246"></a>00246 mu=mu*sdp->gammamu; n=sdp->n; <a name="l00247"></a>00247 info=<a class="code" href="dsdpxmat_8c.html#a9bf5b99c68ebd39086408bcdc430caa6" title="Zero matrix.">DSDPVMatZeroEntries</a>(X);DSDPCHKERR(info); <a name="l00248"></a>00248 info=<a class="code" href="dsdpblock_8c.html#aa48f55168b6780852229dea20c3f1d38" title="Count how many data matrices are in a block of data.">DSDPBlockCountNonzeroMatrices</a>(&sdp->ADATA,&nnzmats);DSDPCHKERR(info); <a name="l00249"></a>00249 <span class="keywordflow">for</span> (i=0;i<nnzmats;i++){ <a name="l00250"></a>00250 info=<a class="code" href="dsdpblock_8c.html#a4154d7692828019b8f2d0f407310188c" title="Get a data matrix from a block of data.">DSDPBlockGetMatrix</a>(&sdp->ADATA,i,&ii,&scl,&AA);DSDPCHKVARERR(ii,info); <a name="l00251"></a>00251 info=DSDPVecGetElement(DY,ii,&dyiscale);DSDPCHKVARERR(ii,info); <a name="l00252"></a>00252 <span class="keywordflow">if</span> (dyiscale==0) <span class="keywordflow">continue</span>; <a name="l00253"></a>00253 info=<a class="code" href="dsdpdatamat_8c.html#a935d091cc12e6ce7ec0a8126b4f18df1" title="Get the number of nonzero eigenvalues/eigenvectors for the matrix.">DSDPDataMatGetRank</a>(AA,&rank,n);DSDPCHKVARERR(ii,info); <a name="l00254"></a>00254 <span class="keywordflow">for</span> (k=0; k<rank; k++){ <a name="l00255"></a>00255 info = <a class="code" href="dsdpdatamat_8c.html#a5a0f6c719037c1998630768a34685414" title="Get an eigenvalue/vector pair.">DSDPDataMatGetEig</a>(AA,k,W,IS,&ack);DSDPCHKVARERR(ii,info); <a name="l00256"></a>00256 <span class="keywordflow">if</span> (ack==0) <span class="keywordflow">continue</span>; <a name="l00257"></a>00257 info=<a class="code" href="dsdpdualmat_8c.html#ae31b03506a9c2aa5ebd33f1e0a00308c" title="Multiply the inverse by a vector or solve the system of equations.">DSDPDualMatInverseMultiply</a>(S,IS,W,W2);DSDPCHKVARERR(ii,info); <a name="l00258"></a>00258 dtmp = ack * dyiscale * mu * scl; <a name="l00259"></a>00259 info=<a class="code" href="dsdpxmat_8c.html#aaa8cdde5690e6a567cf6a9ea82bc90f2" title="Add outer product of a vector to the matrix.">DSDPVMatAddOuterProduct</a>(X,dtmp,W2);DSDPCHKVARERR(ii,info); <a name="l00260"></a>00260 } <a name="l00261"></a>00261 } <a name="l00262"></a>00262 <a name="l00263"></a>00263 info=<a class="code" href="dsdpdualmat_8c.html#a3dc27b759db28929d92bd3a63b632681" title="Add a multiple of the inverse to T.">DSDPDualMatInverseAdd</a>(S,mu,X);DSDPCHKERR(info); <a name="l00264"></a>00264 DSDPFunctionReturn(0); <a name="l00265"></a>00265 } <a name="l00266"></a>00266 </pre></div></div> </div> <hr class="footer"/><address class="footer"><small>Generated on Wed Jun 8 2011 for DSDP by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address> </body> </html>