Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > df736a3bc446df5b16150bebb7296274 > files > 161

DSDP-devel-5.8-2.fc14.i686.rpm

<!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/solver/dualimpl.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&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;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&#160;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_03c647d51c93e018646ff83aa2eeb169.html">solver</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">dualimpl.c</div>  </div>
</div>
<div class="contents">
<a href="dualimpl_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 &quot;<a class="code" href="dsdp_8h.html" title="Internal data structure for the DSDP solver.">dsdp.h</a>&quot;</span>
<a name="l00002"></a>00002 <span class="preprocessor">#include &quot;<a class="code" href="dsdpsys_8h.html" title="Error handling, printing, and profiling.">dsdpsys.h</a>&quot;</span>
<a name="l00019"></a>00019 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00020"></a>00020 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPComputeObjective&quot;</span>
<a name="l00021"></a><a class="code" href="dualimpl_8c.html#ade971b0448ca3865a60e16bc6a3f61b6">00021</a> <span class="preprocessor"></span><span class="keywordtype">int</span> <a class="code" href="dsdp_8h.html#a7024b7b5dbbc5914d29e5ac7a1eba545" title="Compute the objective function (DD).">DSDPComputeObjective</a>(<a class="code" href="structDSDP__C.html" title="Internal structures for the DSDP solver.">DSDP</a> dsdp, <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> Y, <span class="keywordtype">double</span> *ddobj){
<a name="l00022"></a>00022   <span class="keywordtype">int</span> info;
<a name="l00023"></a>00023   DSDPFunctionBegin;
<a name="l00024"></a>00024   info = DSDPVecDot(Y,dsdp-&gt;b,ddobj);DSDPCHKERR(info);
<a name="l00025"></a>00025   DSDPFunctionReturn(0);
<a name="l00026"></a>00026 }
<a name="l00027"></a>00027 
<a name="l00028"></a>00028 
<a name="l00043"></a>00043 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00044"></a>00044 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPComputeDY&quot;</span>
<a name="l00045"></a><a class="code" href="dualimpl_8c.html#ae9746c99c29220feb14216cb1d034438">00045</a> <span class="preprocessor"></span><span class="keywordtype">int</span> <a class="code" href="dsdp_8h.html#ab857999f0834880cea633350bd673f2e" title="Compute the step direction.">DSDPComputeDY</a>(<a class="code" href="structDSDP__C.html" title="Internal structures for the DSDP solver.">DSDP</a> dsdp, <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> DY, <span class="keywordtype">double</span> *pnorm){
<a name="l00046"></a>00046   <span class="keywordtype">int</span> info;
<a name="l00047"></a>00047   <span class="keywordtype">double</span> ppnorm,ddy1=fabs(1.0/mu*dsdp-&gt;schurmu),ddy2=-1.0;
<a name="l00048"></a>00048   DSDPFunctionBegin;
<a name="l00049"></a>00049   info=<a class="code" href="dsdp_8h.html#a2291b15b24f36be603dbca274db5997f" title="Compute the right-hand side of the linear system that determines the step direction.">DSDPComputeRHS</a>(dsdp,mu,dsdp-&gt;rhs); DSDPCHKERR(info);
<a name="l00050"></a>00050   info=DSDPVecWAXPBY(DY,ddy1,dsdp-&gt;dy1,ddy2,dsdp-&gt;dy2);DSDPCHKERR(info);
<a name="l00051"></a>00051   info=<a class="code" href="dsdp_8h.html#a73cd29fb4b7bf78f8bb0454d17d2bf27" title="Compute proximity to a point on the central path.">DSDPComputePNorm</a>(dsdp,mu,DY,&amp;ppnorm);DSDPCHKERR(info);
<a name="l00052"></a>00052   <span class="keywordflow">if</span> (ppnorm&lt;0){ <span class="comment">/* If pnorm &lt; 0 there are SMW numerical issues */</span>
<a name="l00053"></a>00053     DSDPLogInfo(0,2,<span class="stringliteral">&quot;Problem with PNORM: %4.4e &lt; 0 \n&quot;</span>,ppnorm);
<a name="l00054"></a>00054     <span class="comment">/*    ppnorm=1.0; */</span>
<a name="l00055"></a>00055   }
<a name="l00056"></a>00056   *pnorm=ppnorm;
<a name="l00057"></a>00057   DSDPFunctionReturn(0);
<a name="l00058"></a>00058 }
<a name="l00059"></a>00059 
<a name="l00075"></a>00075 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00076"></a>00076 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPComputePDY&quot;</span>
<a name="l00077"></a><a class="code" href="dualimpl_8c.html#a47c056885b38e1c30552f1fdf63aa2dc">00077</a> <span class="preprocessor"></span><span class="keywordtype">int</span> <a class="code" href="dsdp_8h.html#a8cb81d731067999f226e1999d3ddfa9e" title="Compute the step direction.">DSDPComputePDY</a>(<a class="code" href="structDSDP__C.html" title="Internal structures for the DSDP solver.">DSDP</a> dsdp, <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> DY, <span class="keywordtype">double</span> *pnorm){
<a name="l00078"></a>00078   <span class="keywordtype">int</span> info;
<a name="l00079"></a>00079   <span class="keywordtype">double</span> ppnorm,ddy1=-fabs(1.0/mu*dsdp-&gt;schurmu),ddy2=1.0;
<a name="l00080"></a>00080   DSDPFunctionBegin;
<a name="l00081"></a>00081   info=<a class="code" href="dsdp_8h.html#a2291b15b24f36be603dbca274db5997f" title="Compute the right-hand side of the linear system that determines the step direction.">DSDPComputeRHS</a>(dsdp,mu,dsdp-&gt;rhs); DSDPCHKERR(info);
<a name="l00082"></a>00082   info=DSDPVecWAXPBY(DY,ddy1,dsdp-&gt;dy1,ddy2,dsdp-&gt;dy2);DSDPCHKERR(info);
<a name="l00083"></a>00083   info=<a class="code" href="dsdp_8h.html#a73cd29fb4b7bf78f8bb0454d17d2bf27" title="Compute proximity to a point on the central path.">DSDPComputePNorm</a>(dsdp,mu,DY,&amp;ppnorm);DSDPCHKERR(info);
<a name="l00084"></a>00084   <span class="keywordflow">if</span> (ppnorm&lt;0){ <span class="comment">/* If pnorm &lt; 0 there are SMW numerical issues */</span>
<a name="l00085"></a>00085     DSDPLogInfo(0,2,<span class="stringliteral">&quot;Problem with PNORM: %4.4e &lt; 0 \n&quot;</span>,ppnorm);
<a name="l00086"></a>00086     <span class="comment">/*    ppnorm=1.0; */</span>
<a name="l00087"></a>00087   }
<a name="l00088"></a>00088   *pnorm=ppnorm;
<a name="l00089"></a>00089   DSDPFunctionReturn(0);
<a name="l00090"></a>00090 }
<a name="l00091"></a>00091 
<a name="l00103"></a>00103 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00104"></a>00104 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPComputePDY1&quot;</span>
<a name="l00105"></a><a class="code" href="dualimpl_8c.html#a42e0148527b8d4da6f793d25aeabba1e">00105</a> <span class="preprocessor"></span><span class="keywordtype">int</span> <a class="code" href="dsdp_8h.html#abc6cd551af4104fb327a5a411908e303" title="Compute an affine step direction dy1.">DSDPComputePDY1</a>(<a class="code" href="structDSDP__C.html" title="Internal structures for the DSDP solver.">DSDP</a> dsdp, <span class="keywordtype">double</span> mur, <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> DY1){
<a name="l00106"></a>00106   <span class="keywordtype">int</span> info;
<a name="l00107"></a>00107   <span class="keywordtype">double</span> ddy1=-fabs(mur*dsdp-&gt;schurmu);
<a name="l00108"></a>00108   DSDPFunctionBegin;
<a name="l00109"></a>00109   info=DSDPVecScaleCopy(dsdp-&gt;dy1,ddy1,DY1); DSDPCHKERR(info);
<a name="l00110"></a>00110   DSDPFunctionReturn(0);
<a name="l00111"></a>00111 }
<a name="l00112"></a>00112 
<a name="l00123"></a>00123 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00124"></a>00124 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPComputeNewY&quot;</span>
<a name="l00125"></a><a class="code" href="dualimpl_8c.html#a25fac2666851c33d052ea10b4f375d50">00125</a> <span class="preprocessor"></span><span class="keywordtype">int</span> <a class="code" href="dsdp_8h.html#a52e26571b924b453d5359a32fbcdb469" title="Update the Y variables.">DSDPComputeNewY</a>(<a class="code" href="structDSDP__C.html" title="Internal structures for the DSDP solver.">DSDP</a> dsdp, <span class="keywordtype">double</span> beta, <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> Y){
<a name="l00126"></a>00126   <span class="keywordtype">int</span> info;
<a name="l00127"></a>00127   <span class="keywordtype">double</span> rtemp;
<a name="l00128"></a>00128   DSDPFunctionBegin;
<a name="l00129"></a>00129   info=DSDPVecWAXPY(Y,beta,dsdp-&gt;dy,dsdp-&gt;y);DSDPCHKERR(info);
<a name="l00130"></a>00130   info=DSDPVecGetR(Y,&amp;rtemp);DSDPCHKERR(info);
<a name="l00131"></a>00131   rtemp=DSDPMin(0,rtemp);
<a name="l00132"></a>00132   info=<a class="code" href="dsdpschurmat_8c.html#a50ec9f401f7a0b426e6cfca3b5eedaa5" title="Set up the data structure.">DSDPSchurMatSetR</a>(dsdp-&gt;M,rtemp);DSDPCHKERR(info);
<a name="l00133"></a>00133   info=DSDPVecSetR(Y,rtemp);DSDPCHKERR(info);
<a name="l00134"></a>00134   info=DSDPApplyFixedVariables(dsdp-&gt;M,Y);DSDPCHKERR(info);
<a name="l00135"></a>00135   DSDPFunctionReturn(0);
<a name="l00136"></a>00136 }
<a name="l00137"></a>00137 
<a name="l00148"></a>00148 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00149"></a>00149 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPComputePY&quot;</span>
<a name="l00150"></a><a class="code" href="dualimpl_8c.html#a1a8d3bb0e53d87e9c7d5b5cb50027880">00150</a> <span class="preprocessor"></span><span class="keywordtype">int</span> <a class="code" href="dsdp_8h.html#ac068c96b0701cef420a6ef074690acbd" title="Compute PY = Y - beta DY for use in computing X.">DSDPComputePY</a>(<a class="code" href="structDSDP__C.html" title="Internal structures for the DSDP solver.">DSDP</a> dsdp, <span class="keywordtype">double</span> beta, <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> PY){
<a name="l00151"></a>00151   <span class="keywordtype">int</span> info;
<a name="l00152"></a>00152   DSDPFunctionBegin;
<a name="l00153"></a>00153   info=DSDPVecWAXPY(PY,beta,dsdp-&gt;dy,dsdp-&gt;y);DSDPCHKERR(info);
<a name="l00154"></a>00154   info=DSDPApplyFixedVariables(dsdp-&gt;M,PY);DSDPCHKERR(info);
<a name="l00155"></a>00155   DSDPFunctionReturn(0);
<a name="l00156"></a>00156 }
<a name="l00157"></a>00157 
<a name="l00175"></a>00175 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00176"></a>00176 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPComputeRHS&quot;</span>
<a name="l00177"></a><a class="code" href="dualimpl_8c.html#a3c7a92ba2ca993e7b5ceac1809f92646">00177</a> <span class="preprocessor"></span><span class="keywordtype">int</span> <a class="code" href="dsdp_8h.html#a2291b15b24f36be603dbca274db5997f" title="Compute the right-hand side of the linear system that determines the step direction.">DSDPComputeRHS</a>(<a class="code" href="structDSDP__C.html" title="Internal structures for the DSDP solver.">DSDP</a> dsdp, <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> RHS){
<a name="l00178"></a>00178   <span class="keywordtype">int</span> info;
<a name="l00179"></a>00179   <span class="keywordtype">double</span> ddrhs1=1.0/mu*dsdp-&gt;schurmu,ddrhs2=-( mu/fabs(mu) );
<a name="l00180"></a>00180   DSDPFunctionBegin;
<a name="l00181"></a>00181   info=DSDPVecWAXPBY(RHS,ddrhs1,dsdp-&gt;rhs1,ddrhs2,dsdp-&gt;rhs2);DSDPCHKERR(info);
<a name="l00182"></a>00182   DSDPFunctionReturn(0);
<a name="l00183"></a>00183 }
<a name="l00184"></a>00184 
<a name="l00185"></a>00185 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00186"></a>00186 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPComputePNorm&quot;</span>
<a name="l00187"></a>00187 <span class="preprocessor"></span>
<a name="l00200"></a><a class="code" href="dualimpl_8c.html#ace7a480a9db39d6149f780bfb8934c92">00200</a> <span class="keywordtype">int</span> <a class="code" href="dsdp_8h.html#a73cd29fb4b7bf78f8bb0454d17d2bf27" title="Compute proximity to a point on the central path.">DSDPComputePNorm</a>(<a class="code" href="structDSDP__C.html" title="Internal structures for the DSDP solver.">DSDP</a> dsdp, <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> DY, <span class="keywordtype">double</span> *pnorm){
<a name="l00201"></a>00201   <span class="keywordtype">int</span> info;
<a name="l00202"></a>00202   <span class="keywordtype">double</span> ppnorm=0;
<a name="l00203"></a>00203   DSDPFunctionBegin;
<a name="l00204"></a>00204   info=<a class="code" href="dsdp_8h.html#a2291b15b24f36be603dbca274db5997f" title="Compute the right-hand side of the linear system that determines the step direction.">DSDPComputeRHS</a>(dsdp,mu,dsdp-&gt;rhs); DSDPCHKERR(info);
<a name="l00205"></a>00205   info = DSDPVecDot(dsdp-&gt;rhs,DY,&amp;ppnorm);DSDPCHKERR(info);
<a name="l00206"></a>00206   ppnorm/=dsdp-&gt;schurmu;
<a name="l00207"></a>00207   <span class="keywordflow">if</span> (ppnorm &gt;= 0){  <span class="comment">/* Theoretically True */</span>
<a name="l00208"></a>00208     *pnorm=sqrt(ppnorm);
<a name="l00209"></a>00209   } <span class="keywordflow">else</span> {
<a name="l00210"></a>00210     DSDPLogInfo(0,2,<span class="stringliteral">&quot;Problem with PNORM: %4.4e is not positive.\n&quot;</span>,ppnorm);
<a name="l00211"></a>00211     *pnorm=ppnorm;
<a name="l00212"></a>00212   }
<a name="l00213"></a>00213   <span class="keywordflow">if</span> (*pnorm!=*pnorm){DSDPSETERR1(1,<span class="stringliteral">&quot;Problem with PNORM: %4.4e is not positive.\n&quot;</span>,ppnorm);}
<a name="l00214"></a>00214   DSDPFunctionReturn(0);
<a name="l00215"></a>00215 }
<a name="l00216"></a>00216 
<a name="l00228"></a>00228 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00229"></a>00229 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPComputeDualityGap&quot;</span>
<a name="l00230"></a><a class="code" href="dualimpl_8c.html#a239b00881a43da268e3d413f5b942d41">00230</a> <span class="preprocessor"></span><span class="keywordtype">int</span> <a class="code" href="dsdp_8h.html#a5cad8f283551874464395089d3aa76b0" title="Compute the current duality gap.">DSDPComputeDualityGap</a>(<a class="code" href="structDSDP__C.html" title="Internal structures for the DSDP solver.">DSDP</a> dsdp, <span class="keywordtype">double</span> mu, <span class="keywordtype">double</span> *gap){
<a name="l00231"></a>00231   <span class="keywordtype">int</span> info;
<a name="l00232"></a>00232   <span class="keywordtype">double</span> newgap=0,pnorm;
<a name="l00233"></a>00233   <span class="keywordtype">double</span> smu=1.0/dsdp-&gt;schurmu;
<a name="l00234"></a>00234   DSDPFunctionBegin;
<a name="l00235"></a>00235   info=<a class="code" href="dsdp_8h.html#ab857999f0834880cea633350bd673f2e" title="Compute the step direction.">DSDPComputeDY</a>(dsdp,mu,dsdp-&gt;dy,&amp;pnorm); DSDPCHKERR(info);
<a name="l00236"></a>00236   info=DSDPVecDot(dsdp-&gt;dy,dsdp-&gt;rhs2,&amp;newgap);DSDPCHKERR(info);
<a name="l00237"></a>00237   newgap = (newgap*smu+dsdp-&gt;np)*mu;
<a name="l00238"></a>00238   <span class="keywordflow">if</span> (newgap&lt;=0){
<a name="l00239"></a>00239     DSDPLogInfo(0,2,<span class="stringliteral">&quot;GAP :%4.4e&lt;0: Problem\n&quot;</span>,newgap);
<a name="l00240"></a>00240   } <span class="keywordflow">else</span> {
<a name="l00241"></a>00241     DSDPLogInfo(0,2,<span class="stringliteral">&quot;Duality Gap: %12.8e, Update primal objective: %12.8e\n&quot;</span>,newgap,dsdp-&gt;ddobj+newgap);
<a name="l00242"></a>00242   }
<a name="l00243"></a>00243   newgap=DSDPMax(0,newgap);
<a name="l00244"></a>00244   *gap=newgap;
<a name="l00245"></a>00245   DSDPFunctionReturn(0);
<a name="l00246"></a>00246 }
<a name="l00247"></a>00247 
<a name="l00259"></a>00259 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00260"></a>00260 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPComputePotential&quot;</span>
<a name="l00261"></a><a class="code" href="dualimpl_8c.html#a14101d8412929ea2d5b247c8f469efab">00261</a> <span class="preprocessor"></span><span class="keywordtype">int</span> <a class="code" href="dsdp_8h.html#ad744efbd87d4166f470ecae129535533" title="Compute the potential of the given point.">DSDPComputePotential</a>(<a class="code" href="structDSDP__C.html" title="Internal structures for the DSDP solver.">DSDP</a> dsdp, <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> y, <span class="keywordtype">double</span>  logdet, <span class="keywordtype">double</span> *potential){
<a name="l00262"></a>00262   <span class="keywordtype">int</span> info;
<a name="l00263"></a>00263   <span class="keywordtype">double</span> dpotential,gap,ddobj;
<a name="l00264"></a>00264   DSDPFunctionBegin;
<a name="l00265"></a>00265   info=<a class="code" href="dsdp_8h.html#a7024b7b5dbbc5914d29e5ac7a1eba545" title="Compute the objective function (DD).">DSDPComputeObjective</a>(dsdp,y,&amp;ddobj);DSDPCHKERR(info);
<a name="l00266"></a>00266   gap=dsdp-&gt;ppobj-ddobj;
<a name="l00267"></a>00267   <span class="keywordflow">if</span> (gap&gt;0) dpotential=dsdp-&gt;rho*log(gap)-logdet;
<a name="l00268"></a>00268   <span class="keywordflow">else</span> {dpotential=dsdp-&gt;potential+1;}
<a name="l00269"></a>00269   *potential=dpotential;
<a name="l00270"></a>00270   DSDPLogInfo(0,9,<span class="stringliteral">&quot;Gap: %4.4e, Log Determinant: %4.4e, Log Gap: %4.4e\n&quot;</span>,gap,logdet,log(gap));
<a name="l00271"></a>00271   DSDPFunctionReturn(0);
<a name="l00272"></a>00272 }
<a name="l00273"></a>00273 
<a name="l00285"></a>00285 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00286"></a>00286 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPComputePotential2&quot;</span>
<a name="l00287"></a><a class="code" href="dualimpl_8c.html#a8094f58e48c4584240d121b5240980e0">00287</a> <span class="preprocessor"></span><span class="keywordtype">int</span> <a class="code" href="dsdp_8h.html#a021e787b6bab6efdc2fda0230dfe633c" title="Compute the objective function plus the barrier function.">DSDPComputePotential2</a>(<a class="code" href="structDSDP__C.html" title="Internal structures for the DSDP solver.">DSDP</a> dsdp, <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> y, <span class="keywordtype">double</span> mu, <span class="keywordtype">double</span> logdet, <span class="keywordtype">double</span> *potential){
<a name="l00288"></a>00288   <span class="keywordtype">int</span> info;
<a name="l00289"></a>00289   <span class="keywordtype">double</span> ddobj;
<a name="l00290"></a>00290   DSDPFunctionBegin;
<a name="l00291"></a>00291   info=<a class="code" href="dsdp_8h.html#a7024b7b5dbbc5914d29e5ac7a1eba545" title="Compute the objective function (DD).">DSDPComputeObjective</a>(dsdp,y,&amp;ddobj);DSDPCHKERR(info);
<a name="l00292"></a>00292   *potential=-(ddobj + mu*logdet)*dsdp-&gt;schurmu;
<a name="l00293"></a>00293   *potential=-(ddobj/mu + logdet)*dsdp-&gt;schurmu;
<a name="l00294"></a>00294   DSDPFunctionReturn(0);
<a name="l00295"></a>00295 }
<a name="l00296"></a>00296 
<a name="l00297"></a>00297 
<a name="l00307"></a>00307 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00308"></a>00308 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPSetY&quot;</span>
<a name="l00309"></a><a class="code" href="dualimpl_8c.html#ae70dc913134a365755e9bb1496aedc67">00309</a> <span class="preprocessor"></span><span class="keywordtype">int</span> <a class="code" href="dsdp_8h.html#afc317ccad82c19d57f4ffc60812749b5" title="Update the solver with these y variables.">DSDPSetY</a>(<a class="code" href="structDSDP__C.html" title="Internal structures for the DSDP solver.">DSDP</a> dsdp, <span class="keywordtype">double</span> beta, <span class="keywordtype">double</span> logdet, <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> ynew){
<a name="l00310"></a>00310   <span class="keywordtype">int</span> info;
<a name="l00311"></a>00311   <span class="keywordtype">double</span> r1,r2,rr,pp;
<a name="l00312"></a>00312   DSDPFunctionBegin;
<a name="l00313"></a>00313   info=DSDPVecGetR(dsdp-&gt;y,&amp;r1);DSDPCHKERR(info);
<a name="l00314"></a>00314   info=DSDPVecGetR(ynew,&amp;r2);DSDPCHKERR(info);
<a name="l00315"></a>00315   <span class="keywordflow">if</span> (r2==0&amp;&amp;r1!=0){dsdp-&gt;rflag=1;} <span class="keywordflow">else</span> {dsdp-&gt;rflag=0;};
<a name="l00316"></a>00316   info=DSDPVecCopy(ynew,dsdp-&gt;y);DSDPCHKERR(info);
<a name="l00317"></a>00317   info = <a class="code" href="dsdp_8h.html#a7024b7b5dbbc5914d29e5ac7a1eba545" title="Compute the objective function (DD).">DSDPComputeObjective</a>(dsdp,dsdp-&gt;y,&amp;dsdp-&gt;ddobj);DSDPCHKERR(info);
<a name="l00318"></a>00318   <span class="comment">/* Correct ppobj if ppobj &lt; ddobj , which can happen when dual infeasibility is present */</span>
<a name="l00319"></a>00319   <span class="keywordflow">if</span> (dsdp-&gt;ppobj&lt;=dsdp-&gt;ddobj){
<a name="l00320"></a>00320     dsdp-&gt;ppobj=dsdp-&gt;ddobj+2*dsdp-&gt;mu * dsdp-&gt;np;
<a name="l00321"></a>00321     DSDPLogInfo(0,2,<span class="stringliteral">&quot;Primal Objective Not Right.  Assigned: %8.8e\n&quot;</span>,dsdp-&gt;ppobj);
<a name="l00322"></a>00322   }
<a name="l00323"></a>00323   info=DSDPVecGetR(ynew,&amp;rr);DSDPCHKERR(info);
<a name="l00324"></a>00324   info=DSDPVecGetR(dsdp-&gt;b,&amp;pp);DSDPCHKERR(info);
<a name="l00325"></a>00325   dsdp-&gt;dobj=dsdp-&gt;ddobj-rr*pp;
<a name="l00326"></a>00326   DSDPLogInfo(0,2,<span class="stringliteral">&quot;Duality Gap: %4.4e, Potential: %4.4e \n&quot;</span>,dsdp-&gt;dualitygap,dsdp-&gt;potential);
<a name="l00327"></a>00327   dsdp-&gt;dualitygap=dsdp-&gt;ppobj-dsdp-&gt;ddobj;
<a name="l00328"></a>00328   dsdp-&gt;mu=(dsdp-&gt;dualitygap)/(dsdp-&gt;np);
<a name="l00329"></a>00329   dsdp-&gt;dstep=beta;
<a name="l00330"></a>00330   dsdp-&gt;logdet=logdet;
<a name="l00331"></a>00331   info=<a class="code" href="dsdp_8h.html#ad744efbd87d4166f470ecae129535533" title="Compute the potential of the given point.">DSDPComputePotential</a>(dsdp,dsdp-&gt;y,dsdp-&gt;logdet,&amp;dsdp-&gt;potential);DSDPCHKERR(info);
<a name="l00332"></a>00332   DSDPLogInfo(0,2,<span class="stringliteral">&quot;Duality Gap: %4.4e, Potential: %4.4e \n&quot;</span>,dsdp-&gt;dualitygap,dsdp-&gt;potential);
<a name="l00333"></a>00333   DSDPFunctionReturn(0);
<a name="l00334"></a>00334 }
<a name="l00335"></a>00335 
<a name="l00336"></a>00336 
<a name="l00337"></a>00337 <span class="preprocessor">#undef __FUNCT__  </span>
<a name="l00338"></a>00338 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPSetRR&quot;</span>
<a name="l00339"></a>00339 <span class="preprocessor"></span>
<a name="l00345"></a><a class="code" href="dualimpl_8c.html#a67e08bd1a58037e3685583f69f1221db">00345</a> <span class="keywordtype">int</span> <a class="code" href="dsdp_8h.html#a0f6f666ce8aa2c5a80a8ccfe105c6558" title="Set variable r.">DSDPSetRR</a>(<a class="code" href="structDSDP__C.html" title="Internal structures for the DSDP solver.">DSDP</a> dsdp,<span class="keywordtype">double</span> res){ 
<a name="l00346"></a>00346   <span class="keywordtype">int</span> info;
<a name="l00347"></a>00347   DSDPFunctionBegin;
<a name="l00348"></a>00348   DSDPValid(dsdp);
<a name="l00349"></a>00349   info=DSDPVecSetR(dsdp-&gt;y,-res);DSDPCHKERR(info);
<a name="l00350"></a>00350   DSDPFunctionReturn(0);
<a name="l00351"></a>00351 }
<a name="l00352"></a>00352 
<a name="l00353"></a>00353 <span class="preprocessor">#undef __FUNCT__  </span>
<a name="l00354"></a>00354 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPGetRR&quot;</span>
<a name="l00355"></a>00355 <span class="preprocessor"></span>
<a name="l00361"></a><a class="code" href="dualimpl_8c.html#a9cfabc30697ee97817abcbe4ebdb2cd3">00361</a> <span class="keywordtype">int</span> <a class="code" href="dsdp_8h.html#af433c52034d6fcfdafe637e66851808c" title="Get variable r.">DSDPGetRR</a>(<a class="code" href="structDSDP__C.html" title="Internal structures for the DSDP solver.">DSDP</a> dsdp,<span class="keywordtype">double</span> *res){ 
<a name="l00362"></a>00362   <span class="keywordtype">int</span> info;
<a name="l00363"></a>00363   DSDPFunctionBegin;
<a name="l00364"></a>00364   DSDPValid(dsdp);
<a name="l00365"></a>00365   info=DSDPVecGetR(dsdp-&gt;y,res);DSDPCHKERR(info);
<a name="l00366"></a>00366   *res=-*res;
<a name="l00367"></a>00367   <span class="keywordflow">if</span> (*res==0) *res=0;
<a name="l00368"></a>00368   DSDPFunctionReturn(0);
<a name="l00369"></a>00369 }
<a name="l00370"></a>00370 
<a name="l00371"></a>00371 
<a name="l00372"></a>00372 <span class="preprocessor">#undef __FUNCT__  </span>
<a name="l00373"></a>00373 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPObjectiveGH&quot;</span>
<a name="l00374"></a>00374 <span class="preprocessor"></span>
<a name="l00381"></a><a class="code" href="dualimpl_8c.html#af8caa73bd3107d3919d8cbee0c868da0">00381</a> <span class="keywordtype">int</span> <a class="code" href="dsdp_8h.html#a3d8e928c37fdc4ffc624f204930b29c1" title="Compute gradient of dual objective.">DSDPObjectiveGH</a>( <a class="code" href="structDSDP__C.html" title="Internal structures for the DSDP solver.">DSDP</a> dsdp , <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 name="l00382"></a>00382   <span class="keywordtype">int</span> i,info,m;
<a name="l00383"></a>00383   <span class="keywordtype">double</span> rtemp,dd;
<a name="l00384"></a>00384 
<a name="l00385"></a>00385   DSDPFunctionBegin;
<a name="l00386"></a>00386   info=DSDPVecGetSize(vrhs1,&amp;m); DSDPCHKERR(info);
<a name="l00387"></a>00387   <span class="keywordflow">for</span> (i=0;i&lt;m;i++){
<a name="l00388"></a>00388     info=<a class="code" href="dsdpschurmat_8h.html#aa882207cc05ef20b3ee13203d38d39ef" title="Determine with the cone should compute this diagonal element of M and RHS.">DSDPSchurMatVariableCompute</a>(M,i,&amp;dd); DSDPCHKERR(info);
<a name="l00389"></a>00389     <span class="keywordflow">if</span> (dd){
<a name="l00390"></a>00390       info=DSDPVecGetElement(dsdp-&gt;b,i,&amp;rtemp);DSDPCHKERR(info);
<a name="l00391"></a>00391       info=DSDPVecAddElement(vrhs1,i,rtemp);DSDPCHKERR(info);
<a name="l00392"></a>00392     }
<a name="l00393"></a>00393   }
<a name="l00394"></a>00394   DSDPFunctionReturn(0);
<a name="l00395"></a>00395 }
<a name="l00396"></a>00396 
<a name="l00397"></a>00397 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00398"></a>00398 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPCheckForUnboundedObjective&quot;</span>
<a name="l00399"></a>00399 <span class="preprocessor"></span><span class="keywordtype">int</span> DSDPCheckForUnboundedObjective(<a class="code" href="structDSDP__C.html" title="Internal structures for the DSDP solver.">DSDP</a> dsdp, <a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65" title="Boolean variables.">DSDPTruth</a> *unbounded){
<a name="l00400"></a>00400   <span class="keywordtype">int</span> info;
<a name="l00401"></a>00401   <span class="keywordtype">double</span> dtemp;
<a name="l00402"></a>00402   <a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65" title="Boolean variables.">DSDPTruth</a> psdefinite;
<a name="l00403"></a>00403   DSDPFunctionBegin;
<a name="l00404"></a>00404   *unbounded=<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65a74385569aa7a59059a8847e2d39b754c">DSDP_FALSE</a>;
<a name="l00405"></a>00405   info = DSDPVecDot(dsdp-&gt;b,dsdp-&gt;dy2,&amp;dtemp);DSDPCHKERR(info);
<a name="l00406"></a>00406   <span class="keywordflow">if</span> ( dtemp &lt; 0 /* &amp;&amp; dsdp-&gt;r==0 &amp;&amp; dsdp-&gt;ddobj &gt; 0 */) {  
<a name="l00407"></a>00407     info = DSDPVecScaleCopy(dsdp-&gt;dy2,-1.0,dsdp-&gt;ytemp); DSDPCHKERR(info);
<a name="l00408"></a>00408     info = <a class="code" href="dsdp_8h.html#a0866ec107b5c60afbec8a9bda9caa22d" title="Compute the dual variables S in each cone.">DSDPComputeSS</a>(dsdp,dsdp-&gt;ytemp,<a class="code" href="dsdpbasictypes_8h.html#ae47666e7e5d77002110e20ef9ebb634baa8adedc328d310fc0bb1b04a9091bad1">PRIMAL_FACTOR</a>,&amp;psdefinite);DSDPCHKERR(info);
<a name="l00409"></a>00409     <span class="keywordflow">if</span> (psdefinite == <a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65ae6b2e53e51e94a5fa7204ceac78f824f">DSDP_TRUE</a>){
<a name="l00410"></a>00410       psdefinite=<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65a74385569aa7a59059a8847e2d39b754c">DSDP_FALSE</a>;
<a name="l00411"></a>00411       <span class="keywordflow">while</span>(psdefinite==<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65a74385569aa7a59059a8847e2d39b754c">DSDP_FALSE</a>){ <span class="comment">/* Dual point should be a certificate of dual unboundedness, and be dual feasible */</span>
<a name="l00412"></a>00412         info=<a class="code" href="dsdp_8h.html#a0866ec107b5c60afbec8a9bda9caa22d" title="Compute the dual variables S in each cone.">DSDPComputeSS</a>(dsdp,dsdp-&gt;ytemp,<a class="code" href="dsdpbasictypes_8h.html#ae47666e7e5d77002110e20ef9ebb634baa8adedc328d310fc0bb1b04a9091bad1">PRIMAL_FACTOR</a>,&amp;psdefinite);DSDPCHKERR(info);
<a name="l00413"></a>00413         <span class="keywordflow">if</span> (psdefinite == <a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65ae6b2e53e51e94a5fa7204ceac78f824f">DSDP_TRUE</a>) <span class="keywordflow">break</span>;
<a name="l00414"></a>00414         info=DSDPVecScale(2.0,dsdp-&gt;ytemp); DSDPCHKERR(info);
<a name="l00415"></a>00415       }
<a name="l00416"></a>00416       info = DSDPVecCopy(dsdp-&gt;ytemp,dsdp-&gt;y); DSDPCHKERR(info);
<a name="l00417"></a>00417       info = <a class="code" href="dsdp_8h.html#acd704d80e2686ff321f3a63bc3c3b63f" title="Save the current solution for later computation of X.">DSDPSaveYForX</a>(dsdp,1.0e-12,1.0);DSDPCHKERR(info);
<a name="l00418"></a>00418       info = <a class="code" href="dsdp_8h.html#a7024b7b5dbbc5914d29e5ac7a1eba545" title="Compute the objective function (DD).">DSDPComputeObjective</a>(dsdp,dsdp-&gt;y,&amp;dsdp-&gt;ddobj);DSDPCHKERR(info);
<a name="l00419"></a>00419       info = DSDPVecNormalize(dsdp-&gt;y); DSDPCHKERR(info);
<a name="l00420"></a>00420       *unbounded=<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65ae6b2e53e51e94a5fa7204ceac78f824f">DSDP_TRUE</a>;
<a name="l00421"></a>00421     }
<a name="l00422"></a>00422   }
<a name="l00423"></a>00423   DSDPFunctionReturn(0);
<a name="l00424"></a>00424 }
<a name="l00425"></a>00425 
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Wed Jun 8 2011 for DSDP by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>