<!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/printsdpa.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">printsdpa.c</div> </div> </div> <div class="contents"> <a href="printsdpa_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="dsdp5_8h.html" title="The API to DSDP for those applications using DSDP as a subroutine library.">dsdp5.h</a>"</span> <a name="l00006"></a>00006 <span class="keyword">static</span> <span class="keywordtype">void</span> DprintfD(FILE*fp, <span class="keywordtype">double</span> d1){ <a name="l00007"></a>00007 <span class="keywordtype">int</span> i1=(int)d1,i2=(<span class="keywordtype">int</span>)(d1*100),i3=(<span class="keywordtype">int</span>)(d1*10000),i4=(<span class="keywordtype">int</span>)(d1*10000000); <a name="l00008"></a>00008 <span class="keywordflow">if</span> ( d1==(<span class="keywordtype">double</span>)i1){ fprintf(fp,<span class="stringliteral">"%2.0f "</span>,d1); <a name="l00009"></a>00009 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (d1==(<span class="keywordtype">double</span>)i2/100.0){ fprintf(fp,<span class="stringliteral">"%4.2f "</span>,d1); <a name="l00010"></a>00010 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (d1==(<span class="keywordtype">double</span>)i3/10000.0){ fprintf(fp,<span class="stringliteral">"%6.4f "</span>,d1); <a name="l00011"></a>00011 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (d1==(<span class="keywordtype">double</span>)i4/1000000.0){ fprintf(fp,<span class="stringliteral">"%8.6f "</span>,d1); <a name="l00012"></a>00012 } <span class="keywordflow">else</span> { fprintf(fp,<span class="stringliteral">"%22.22e "</span>,d1); <a name="l00013"></a>00013 } <a name="l00014"></a>00014 <span class="keywordflow">return</span>; <a name="l00015"></a>00015 } <a name="l00016"></a>00016 <a name="l00017"></a>00017 <span class="keyword">static</span> <span class="keywordtype">void</span> Dprintf(FILE*fp, <span class="keywordtype">int</span> i1, <span class="keywordtype">int</span> i2, <span class="keywordtype">int</span> i3, <span class="keywordtype">int</span> i4, <span class="keywordtype">double</span> d1){ <a name="l00018"></a>00018 <span class="keywordflow">if</span> (fabs(d1)<1e-30){<span class="keywordflow">return</span>;} <a name="l00019"></a>00019 fprintf(fp,<span class="stringliteral">"%d %d %d %d "</span>,i1,i2,i3+1,i4+1); <a name="l00020"></a>00020 <span class="keywordflow">if</span> (i1==0) <a name="l00021"></a>00021 DprintfD(fp,-d1); <a name="l00022"></a>00022 <span class="keywordflow">else</span> <a name="l00023"></a>00023 DprintfD(fp,d1); <a name="l00024"></a>00024 fprintf(fp,<span class="stringliteral">"\n"</span>); <a name="l00025"></a>00025 <span class="keywordflow">return</span>; <a name="l00026"></a>00026 } <a name="l00027"></a>00027 <a name="l00028"></a>00028 <a name="l00029"></a>00029 <span class="preprocessor">#undef __FUNCT__ </span> <a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DPrintUpperRightMatrix"</span> <a name="l00031"></a>00031 <span class="preprocessor"></span><span class="keyword">static</span> <span class="keywordtype">void</span> DPrintUpperRightMatrix(<span class="keywordtype">int</span> constraint, <span class="keywordtype">int</span> block, <span class="keywordtype">double</span> amat[], <span class="keywordtype">int</span> n, FILE*fp){ <a name="l00032"></a>00032 <span class="keywordtype">int</span> col,row; <a name="l00033"></a>00033 <span class="keywordflow">for</span> (row=0;row<n;row++){ <a name="l00034"></a>00034 <span class="keywordflow">for</span> (col=0;col<=row;col++){ <a name="l00035"></a>00035 <span class="keywordflow">if</span> (fabs(amat[col])>1.0e-20){ <a name="l00036"></a>00036 Dprintf(fp,constraint,block,col,row,amat[col]); <a name="l00037"></a>00037 } <a name="l00038"></a>00038 } <a name="l00039"></a>00039 amat+=(row+1); <a name="l00040"></a>00040 } <a name="l00041"></a>00041 <span class="keywordflow">return</span>; <a name="l00042"></a>00042 } <a name="l00043"></a>00043 <a name="l00044"></a>00044 <span class="preprocessor">#undef __FUNCT__ </span> <a name="l00045"></a>00045 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DPrintUpperFullMatrix"</span> <a name="l00046"></a>00046 <span class="preprocessor"></span><span class="keyword">static</span> <span class="keywordtype">void</span> DPrintUpperFullMatrix(<span class="keywordtype">int</span> constraint, <span class="keywordtype">int</span> block, <span class="keywordtype">double</span> amat[], <span class="keywordtype">int</span> n, FILE*fp){ <a name="l00047"></a>00047 <span class="keywordtype">int</span> col,row; <a name="l00048"></a>00048 <span class="keywordflow">for</span> (row=0;row<n;row++){ <a name="l00049"></a>00049 <span class="keywordflow">for</span> (col=0;col<=row;col++){ <a name="l00050"></a>00050 <span class="keywordflow">if</span> (fabs(amat[col])>1.0e-20){ <a name="l00051"></a>00051 Dprintf(fp,constraint,block,col,row,amat[col]); <a name="l00052"></a>00052 } <a name="l00053"></a>00053 } <a name="l00054"></a>00054 amat+=n; <a name="l00055"></a>00055 } <a name="l00056"></a>00056 <span class="keywordflow">return</span>; <a name="l00057"></a>00057 } <a name="l00058"></a>00058 <a name="l00059"></a>00059 <span class="preprocessor">#undef __FUNCT__ </span> <a name="l00060"></a>00060 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DPrintMatrix"</span> <a name="l00061"></a>00061 <span class="preprocessor"></span><span class="keyword">static</span> <span class="keywordtype">void</span> DPrintMatrix(<span class="keywordtype">char</span> UPLQ, <span class="keywordtype">int</span> constraint, <span class="keywordtype">int</span> block, <span class="keywordtype">double</span> amat[], <span class="keywordtype">int</span> n, FILE*fp){ <a name="l00062"></a>00062 <span class="keywordflow">if</span> (UPLQ==<span class="charliteral">'P'</span>){ <a name="l00063"></a>00063 DPrintUpperRightMatrix(constraint,block,amat,n,fp); <a name="l00064"></a>00064 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (UPLQ==<span class="charliteral">'U'</span>){ <a name="l00065"></a>00065 DPrintUpperFullMatrix(constraint,block,amat,n,fp); <a name="l00066"></a>00066 } <a name="l00067"></a>00067 <span class="keywordflow">return</span>; <a name="l00068"></a>00068 } <a name="l00069"></a>00069 <a name="l00070"></a>00070 <span class="preprocessor">#undef __FUNCT__ </span> <a name="l00071"></a>00071 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DPrintLPArray"</span> <a name="l00072"></a>00072 <span class="preprocessor"></span><span class="keyword">static</span> <span class="keywordtype">int</span> DPrintLPArray(<span class="keywordtype">int</span> cc, <span class="keywordtype">int</span> block, <span class="keywordtype">double</span> *vv, <span class="keywordtype">int</span> n, FILE *fp ){ <a name="l00073"></a>00073 <span class="keywordtype">int</span> i; <a name="l00074"></a>00074 <span class="keywordflow">for</span> (i=0;i<n;i++){ <a name="l00075"></a>00075 <span class="keywordflow">if</span> ( fabs(vv[i]) > 0){ <a name="l00076"></a>00076 Dprintf(fp,cc,block,i,i,vv[i]); <a name="l00077"></a>00077 } <a name="l00078"></a>00078 } <a name="l00079"></a>00079 <span class="keywordflow">return</span> 0; <a name="l00080"></a>00080 } <a name="l00081"></a>00081 <a name="l00082"></a>00082 <a name="l00083"></a>00083 <span class="preprocessor">#undef __FUNCT__ </span> <a name="l00084"></a>00084 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPPrintSolution"</span> <a name="l00085"></a>00085 <span class="preprocessor"></span> <a name="l00094"></a><a class="code" href="group__Examples.html#ga716726788d17d15b6148571132c0dfa7">00094</a> <span class="keywordtype">int</span> <a class="code" href="group__Examples.html#ga716726788d17d15b6148571132c0dfa7" title="Print solution in SDPA format.">DSDPPrintSolution</a>(FILE *fp,<a class="code" href="structDSDP__C.html" title="Internal structures for the DSDP solver.">DSDP</a> dsdp,<a class="code" href="structSDPCone__C.html" title="Internal structure for semidefinite cone.">SDPCone</a> sdpcone, <a class="code" href="dsdp5_8h.html#ab974b47d582ebca94a1486e5bb0cdd18" title="The LPCone object points to blocks of data that specify linear scalar inequality constraints.">LPCone</a> lpcone){ <a name="l00095"></a>00095 <span class="keywordtype">int</span> i,kk,info,n,nn,lpn=0,nblocks,nvars; <a name="l00096"></a>00096 <span class="keywordtype">double</span> *ss,*xx,*y,*lparray; <a name="l00097"></a>00097 <span class="keywordtype">char</span> UPLQ; <a name="l00098"></a>00098 <a name="l00099"></a>00099 info=<a class="code" href="group__DSDPSolution.html#gae212bb3666f5c021f9d310a49438e94b" title="Copy the number of variables y.">DSDPGetNumberOfVariables</a>(dsdp,&nvars);DSDPCHKERR(info); <a name="l00100"></a>00100 DSDPCALLOC2(&y,<span class="keywordtype">double</span>,(nvars+2),&info);DSDPCHKERR(info); <a name="l00101"></a>00101 info=<a class="code" href="group__SDPRoutines.html#ga1b36d9b0d9411f3a46dafbeffddc8def" title="Get the number of blocks in the semidefinite cone.">SDPConeGetNumberOfBlocks</a>(sdpcone,&nblocks);DSDPCHKERR(info); <a name="l00102"></a>00102 <a name="l00103"></a>00103 <span class="keywordflow">if</span> (lpcone){info=<a class="code" href="group__LPRoutines.html#ga397a75ac119afb25a2aea1b583de789d" title="Get the array used to store the x variables.">LPConeGetXArray</a>(lpcone,&xx,&lpn);DSDPCHKERR(info);nblocks--;} <a name="l00104"></a>00104 DSDPCALLOC2(&lparray,<span class="keywordtype">double</span>,(lpn+1),&info);DSDPCHKERR(info); <a name="l00105"></a>00105 <span class="comment">/* Deleted at Borcher's request.</span> <a name="l00106"></a>00106 <span class="comment"> fprintf(fp,"%d \n%d \n",nvars,nblocks);</span> <a name="l00107"></a>00107 <span class="comment"> for (i=0;i<nblocks; i++){</span> <a name="l00108"></a>00108 <span class="comment"> info=SDPConeGetBlockSize(sdpcone,i,&n);DSDPCHKERR(info);</span> <a name="l00109"></a>00109 <span class="comment"> fprintf(fp,"%d ",n);</span> <a name="l00110"></a>00110 <span class="comment"> }</span> <a name="l00111"></a>00111 <span class="comment"> if (lpcone){ fprintf(fp,"%d ",-lpn); }</span> <a name="l00112"></a>00112 <span class="comment"> fprintf(fp," \n");</span> <a name="l00113"></a>00113 <span class="comment"> */</span> <a name="l00114"></a>00114 <a name="l00115"></a>00115 info=<a class="code" href="group__DSDPBasic.html#ga816a784dde863f6a35a2f5d8786a3441" title="Copies the variables y into an array.">DSDPGetY</a>(dsdp,y+1,nvars);DSDPCHKERR(info); <a name="l00116"></a>00116 y[0]=1.0;y[nvars+1]=0; <a name="l00117"></a>00117 info=<a class="code" href="group__DSDPSolution.html#gacfa8e29ecd7eaaeb6a4e31eb07961de3" title="Copy the infeasibility in (D), or the variable r in (DD).">DSDPGetR</a>(dsdp,y+nvars+1);DSDPCHKERR(info); <a name="l00118"></a>00118 <span class="keywordflow">for</span> (i=0; i<nvars; i++){ DprintfD(fp,-y[i+1]);} <a name="l00119"></a>00119 fprintf(fp,<span class="stringliteral">" \n"</span>); <a name="l00120"></a>00120 <a name="l00121"></a>00121 <span class="comment">/* Print Dual Matrix Solution */</span> <a name="l00122"></a>00122 <span class="keywordflow">for</span> (kk=0;kk<nblocks;kk++){ <a name="l00123"></a>00123 info=<a class="code" href="group__SDPRoutines.html#gada3cc6468c592a2e40b4f78b0def507c" title="Get the dimension of one block in the semidefinite cone.">SDPConeGetBlockSize</a>(sdpcone,kk,&n);DSDPCHKERR(info); <a name="l00124"></a>00124 info=<a class="code" href="group__SDPBasic.html#ga9e7744a5c7fbe87642979e2b41bc2c00" title="After applying the solver, set a pointer to the array in the object with the solution X...">SDPConeGetXArray</a>(sdpcone,kk,&ss,&nn);DSDPCHKERR(info); <a name="l00125"></a>00125 info=<a class="code" href="group__SDPRoutines.html#ga1ef87e3c016d9668efaa8240bec4383b" title="Compute the dual matrix S.">SDPConeComputeS</a>(sdpcone,kk,y[0],y+1,nvars,y[nvars+1],n,ss,nn);DSDPCHKERR(info); <a name="l00126"></a>00126 info=<a class="code" href="group__SDPData.html#gabb32703bcca3a703fbbb591ee6737118" title="Get the storage format for the block.">SDPConeGetStorageFormat</a>(sdpcone,kk,&UPLQ);DSDPCHKERR(info); <a name="l00127"></a>00127 DPrintMatrix(UPLQ,1,kk+1,ss,n,fp); <a name="l00128"></a>00128 info=<a class="code" href="group__SDPRoutines.html#gafd7a739bd01013be7e96f4069d526524" title="Restore the dense array and set these pointers to null.">SDPConeRestoreXArray</a>(sdpcone,kk,&ss,&nn);DSDPCHKERR(info); <a name="l00129"></a>00129 } <a name="l00130"></a>00130 <span class="keywordflow">if</span> (lpcone){ <a name="l00131"></a>00131 info=<a class="code" href="group__LPRoutines.html#gae8b986e2ffe6accd28f82f8fd7571287" title="Copy the variables s into the spedified array.">LPConeCopyS</a>(lpcone,lparray,lpn);DSDPCHKERR(info); <a name="l00132"></a>00132 info=DPrintLPArray(1,nblocks+1,lparray,lpn,fp);DSDPCHKERR(info); <a name="l00133"></a>00133 } <a name="l00134"></a>00134 <a name="l00135"></a>00135 info=<a class="code" href="group__DSDPBasic.html#gacd271769549030ce365597101946220b" title="Compute the X variables.">DSDPComputeX</a>(dsdp);DSDPCHKERR(info); <a name="l00136"></a>00136 <span class="comment">/* Print Primal Solution */</span> <a name="l00137"></a>00137 <span class="keywordflow">for</span> (kk=0; kk<nblocks; kk++){ <a name="l00138"></a>00138 info=<a class="code" href="group__SDPRoutines.html#gada3cc6468c592a2e40b4f78b0def507c" title="Get the dimension of one block in the semidefinite cone.">SDPConeGetBlockSize</a>(sdpcone,kk,&n);DSDPCHKERR(info); <a name="l00139"></a>00139 info=<a class="code" href="group__SDPData.html#gabb32703bcca3a703fbbb591ee6737118" title="Get the storage format for the block.">SDPConeGetStorageFormat</a>(sdpcone,kk,&UPLQ);DSDPCHKERR(info); <a name="l00140"></a>00140 info=<a class="code" href="group__SDPBasic.html#ga9e7744a5c7fbe87642979e2b41bc2c00" title="After applying the solver, set a pointer to the array in the object with the solution X...">SDPConeGetXArray</a>(sdpcone,kk,&xx,&nn);DSDPCHKERR(info); <a name="l00141"></a>00141 DPrintMatrix(UPLQ,2,kk+1,xx,n,fp); <a name="l00142"></a>00142 info=<a class="code" href="group__SDPRoutines.html#gafd7a739bd01013be7e96f4069d526524" title="Restore the dense array and set these pointers to null.">SDPConeRestoreXArray</a>(sdpcone,kk,&xx,&nn);DSDPCHKERR(info); <a name="l00143"></a>00143 } <a name="l00144"></a>00144 <span class="keywordflow">if</span> (lpcone){ <a name="l00145"></a>00145 info=<a class="code" href="group__LPRoutines.html#ga397a75ac119afb25a2aea1b583de789d" title="Get the array used to store the x variables.">LPConeGetXArray</a>(lpcone,&xx,&nn);DSDPCHKERR(info); <a name="l00146"></a>00146 info=DPrintLPArray(2,nblocks+1,xx,nn,fp);DSDPCHKERR(info); <a name="l00147"></a>00147 } <a name="l00148"></a>00148 <a name="l00149"></a>00149 DSDPFREE(&y,&info); <a name="l00150"></a>00150 <span class="keywordflow">return</span> 0; <a name="l00151"></a>00151 } <a name="l00152"></a>00152 <a name="l00153"></a>00153 <a name="l00154"></a>00154 <span class="preprocessor">#undef __FUNCT__ </span> <a name="l00155"></a>00155 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPPrintData"</span> <a name="l00156"></a>00156 <span class="preprocessor"></span> <a name="l00164"></a><a class="code" href="group__Examples.html#ga3407a19db2d6789625316f4194072ff3">00164</a> <span class="keywordtype">int</span> <a class="code" href="group__Examples.html#ga3407a19db2d6789625316f4194072ff3" title="Print data in SDPA format to a file named "output.sdpa".">DSDPPrintData</a>(<a class="code" href="structDSDP__C.html" title="Internal structures for the DSDP solver.">DSDP</a> dsdp, <a class="code" href="structSDPCone__C.html" title="Internal structure for semidefinite cone.">SDPCone</a> sdpcone, <a class="code" href="dsdp5_8h.html#ab974b47d582ebca94a1486e5bb0cdd18" title="The LPCone object points to blocks of data that specify linear scalar inequality constraints.">LPCone</a> lpcone){ <a name="l00165"></a>00165 <a name="l00166"></a>00166 <span class="keywordtype">int</span> info,nblocks,i,nvars,n,nn,kk,lpblock=0,lpn=0; <a name="l00167"></a>00167 <span class="keywordtype">double</span> *ss,*y=0,*vv=0; <a name="l00168"></a>00168 <span class="keywordtype">char</span> filename[100]=<span class="stringliteral">""</span>; <a name="l00169"></a>00169 <span class="keywordtype">char</span> UPLQ; <a name="l00170"></a>00170 FILE *fp; <a name="l00171"></a>00171 <a name="l00172"></a>00172 info=<a class="code" href="group__DSDPSolution.html#gae212bb3666f5c021f9d310a49438e94b" title="Copy the number of variables y.">DSDPGetNumberOfVariables</a>(dsdp,&nvars);DSDPCHKERR(info); <a name="l00173"></a>00173 DSDPCALLOC2(&y,<span class="keywordtype">double</span>,(nvars+3),&info);DSDPCHKERR(info); <a name="l00174"></a>00174 info=<a class="code" href="group__SDPRoutines.html#ga1b36d9b0d9411f3a46dafbeffddc8def" title="Get the number of blocks in the semidefinite cone.">SDPConeGetNumberOfBlocks</a>(sdpcone,&nblocks);DSDPCHKERR(info); <a name="l00175"></a>00175 strncat(filename,<span class="stringliteral">"output.sdpa"</span>,50); <a name="l00176"></a>00176 <span class="comment">/* fp=fopen(filename,"w"); */</span> <a name="l00177"></a>00177 fp=fopen(<span class="stringliteral">"input.sdpa"</span>,<span class="stringliteral">"w"</span>); <a name="l00178"></a>00178 <span class="keywordflow">if</span> (lpcone){ <a name="l00179"></a>00179 info=<a class="code" href="group__LPRoutines.html#gaf67de731657b5f9eedb51ba2de2d0eb6" title="Get the dimension is the number of variables x, which equals the number of slack variables s...">LPConeGetDimension</a>(lpcone,&lpn);DSDPCHKERR(info); <a name="l00180"></a>00180 DSDPCALLOC2(&vv,<span class="keywordtype">double</span>,lpn,&info);DSDPCHKERR(info); <a name="l00181"></a>00181 lpblock=1; <a name="l00182"></a>00182 info=<a class="code" href="group__SDPRoutines.html#gada3cc6468c592a2e40b4f78b0def507c" title="Get the dimension of one block in the semidefinite cone.">SDPConeGetBlockSize</a>(sdpcone,nblocks-1,&n);DSDPCHKERR(info); <a name="l00183"></a>00183 <span class="keywordflow">if</span> (n==0){nblocks--;} <a name="l00184"></a>00184 } <a name="l00185"></a>00185 fprintf(fp,<span class="stringliteral">"%d \n%d\n"</span>,nvars,nblocks+lpblock); <a name="l00186"></a>00186 <span class="keywordflow">for</span> (kk=0;kk<nblocks;kk++){ <a name="l00187"></a>00187 info=<a class="code" href="group__SDPRoutines.html#gada3cc6468c592a2e40b4f78b0def507c" title="Get the dimension of one block in the semidefinite cone.">SDPConeGetBlockSize</a>(sdpcone,kk,&n);DSDPCHKERR(info); <a name="l00188"></a>00188 fprintf(fp,<span class="stringliteral">"%d "</span>,n); <a name="l00189"></a>00189 } <a name="l00190"></a>00190 <span class="keywordflow">if</span> (lpcone){ <a name="l00191"></a>00191 fprintf(fp,<span class="stringliteral">"%d "</span>,-lpn); <a name="l00192"></a>00192 } <a name="l00193"></a>00193 fprintf(fp,<span class="stringliteral">"\n"</span>); <a name="l00194"></a>00194 info=<a class="code" href="group__DSDPSolution.html#gace8935e125caba22d3f4d28b045dadb6" title="Copies the variables b from solver into an array.">DSDPCopyB</a>(dsdp,y,nvars); <a name="l00195"></a>00195 <span class="keywordflow">for</span> (i=0;i<nvars;i++){ <a name="l00196"></a>00196 DprintfD(fp,y[i]); <a name="l00197"></a>00197 } <a name="l00198"></a>00198 fprintf(fp,<span class="stringliteral">"\n"</span>); <a name="l00199"></a>00199 <a name="l00200"></a>00200 <span class="keywordflow">for</span> (i=0;i<=nvars;i++){ <a name="l00201"></a>00201 <span class="keywordflow">for</span> (kk=0;kk<nvars+2;kk++) y[kk]=0.0; <a name="l00202"></a>00202 <span class="keywordflow">if</span> (i==0){y[i]=1.0;} <span class="keywordflow">else</span> {y[i]=-1.0; } <a name="l00203"></a>00203 <span class="keywordflow">for</span> (kk=0;kk<nblocks;kk++){ <a name="l00204"></a>00204 info=<a class="code" href="group__SDPRoutines.html#gada3cc6468c592a2e40b4f78b0def507c" title="Get the dimension of one block in the semidefinite cone.">SDPConeGetBlockSize</a>(sdpcone,kk,&n);DSDPCHKERR(info); <a name="l00205"></a>00205 info=<a class="code" href="group__SDPBasic.html#ga9e7744a5c7fbe87642979e2b41bc2c00" title="After applying the solver, set a pointer to the array in the object with the solution X...">SDPConeGetXArray</a>(sdpcone,kk,&ss,&nn);DSDPCHKERR(info); <a name="l00206"></a>00206 info=<a class="code" href="group__SDPRoutines.html#ga1ef87e3c016d9668efaa8240bec4383b" title="Compute the dual matrix S.">SDPConeComputeS</a>(sdpcone,kk,y[0],y+1,nvars,y[nvars+1],n,ss,nn);DSDPCHKERR(info); <a name="l00207"></a>00207 info=<a class="code" href="group__SDPData.html#gabb32703bcca3a703fbbb591ee6737118" title="Get the storage format for the block.">SDPConeGetStorageFormat</a>(sdpcone,kk,&UPLQ);DSDPCHKERR(info); <a name="l00208"></a>00208 DPrintMatrix(UPLQ,i,kk+1,ss,n,fp); <a name="l00209"></a>00209 } <a name="l00210"></a>00210 } <a name="l00211"></a>00211 <span class="keywordflow">if</span> (lpcone && lpn>0){ <a name="l00212"></a>00212 info=<a class="code" href="group__LPRoutines.html#gaf67de731657b5f9eedb51ba2de2d0eb6" title="Get the dimension is the number of variables x, which equals the number of slack variables s...">LPConeGetDimension</a>(lpcone,&lpn);DSDPCHKERR(info); <a name="l00213"></a>00213 <span class="keywordflow">for</span> (i=0;i<=nvars;i++){ <a name="l00214"></a>00214 info=<a class="code" href="dsdplp_8c.html#a3a3ba3a5a4bb6ed5cec6e2ff424436c1" title="Get one column (or row) of the LP data.">LPConeGetData</a>(lpcone,i,vv,lpn);DSDPCHKERR(info); <a name="l00215"></a>00215 info=DPrintLPArray(i,nblocks+1,vv,lpn,fp);DSDPCHKERR(info); <a name="l00216"></a>00216 } <a name="l00217"></a>00217 } <a name="l00218"></a>00218 DSDPFREE(&y,&info); <a name="l00219"></a>00219 <span class="keywordflow">if</span> (vv){ <a name="l00220"></a>00220 DSDPFREE(&vv,&info); <a name="l00221"></a>00221 } <a name="l00222"></a>00222 fclose(fp); <a name="l00223"></a>00223 <a name="l00224"></a>00224 <span class="keywordflow">return</span> 0; <a name="l00225"></a>00225 } </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>