Sophie

Sophie

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

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: examples/dsdp.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_0a4f0a65bb1e36a4913e16ae18cb477d.html">examples</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">dsdp.c</div>  </div>
</div>
<div class="contents">
<a href="dsdp_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;mex.h&quot;</span>
<a name="l00002"></a>00002 <span class="preprocessor">#include &quot;<a class="code" href="dsdp5_8h.html" title="The API to DSDP for those applications using DSDP as a subroutine library.">dsdp5.h</a>&quot;</span>
<a name="l00003"></a>00003 <span class="preprocessor">#include &lt;math.h&gt;</span>
<a name="l00004"></a>00004 
<a name="l00005"></a>00005 <span class="comment">/* #define K_IN prhs[0] */</span>
<a name="l00006"></a>00006 <span class="preprocessor">#define CA_IN prhs[1]</span>
<a name="l00007"></a>00007 <span class="preprocessor"></span><span class="preprocessor">#define B_IN prhs[0]</span>
<a name="l00008"></a>00008 <span class="preprocessor"></span><span class="preprocessor">#define PARS_IN prhs[2]</span>
<a name="l00009"></a>00009 <span class="preprocessor"></span><span class="preprocessor">#define Y_IN prhs[3]</span>
<a name="l00010"></a>00010 <span class="preprocessor"></span><span class="preprocessor">#define STAT_OUT plhs[0]</span>
<a name="l00011"></a>00011 <span class="preprocessor"></span><span class="preprocessor">#define Y_OUT plhs[1]</span>
<a name="l00012"></a>00012 <span class="preprocessor"></span><span class="preprocessor">#define X_OUT plhs[2]</span>
<a name="l00013"></a>00013 <span class="preprocessor"></span><span class="keyword">static</span> <span class="keywordtype">int</span> DSDPPrintStats2(<a class="code" href="structDSDP__C.html" title="Internal structures for the DSDP solver.">DSDP</a>, <span class="keywordtype">void</span>*);
<a name="l00014"></a>00014 <span class="keyword">static</span> <span class="keywordtype">int</span> CountNonzeroMatrices(<span class="keywordtype">double</span>*,<span class="keywordtype">int</span>,<span class="keywordtype">int</span>,<span class="keywordtype">int</span>,<span class="keywordtype">int</span>*,<span class="keywordtype">int</span>*,<span class="keywordtype">int</span>*);
<a name="l00015"></a>00015 <span class="keyword">static</span> <span class="keywordtype">int</span> CheckForConstantMat(<span class="keywordtype">double</span>*,<span class="keywordtype">int</span>,<span class="keywordtype">int</span>);
<a name="l00016"></a>00016 
<a name="l00017"></a>00017 <span class="keyword">static</span> <span class="keywordtype">int</span> printlevel=10;
<a name="l00018"></a>00018 <span class="preprocessor">#define CHKERR(a)  { if (a){mexWarnMsgTxt(&quot;DSDP Numerical Error&quot;); } }</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span>
<a name="l00020"></a>00020 <span class="preprocessor">#define mexErrMsgTxt(a); mexPrintf(&quot;Error: &quot;); mexWarnMsgTxt(a); return;</span>
<a name="l00021"></a>00021 <span class="preprocessor"></span>
<a name="l00035"></a><a class="code" href="group__Examples.html#ga6a215cbfde54f82a3ce599228fc3fce5">00035</a> <span class="keywordtype">void</span> <a class="code" href="group__Examples.html#ga6a215cbfde54f82a3ce599228fc3fce5" title="Call DSDP from the Matlab environment.">mexFunction</a>(<span class="keywordtype">int</span> nlhs, mxArray *plhs[],
<a name="l00036"></a>00036                  <span class="keywordtype">int</span> nrhs, <span class="keyword">const</span> mxArray *prhs[]){
<a name="l00037"></a>00037   
<a name="l00038"></a>00038   mxArray  *CA_cell_pr,*X_cell_pr;
<a name="l00039"></a>00039   <span class="keyword">const</span> mxArray  *OPTIONS_FIELD;
<a name="l00040"></a>00040   mxArray  *STAT_FIELD;
<a name="l00041"></a>00041   <span class="keywordtype">int</span>     i,j,k,ii,itmp,index,info;
<a name="l00042"></a>00042   <span class="keywordtype">int</span>    *air, *ajc, *air2, *ajc2, *str,*iptr;
<a name="l00043"></a>00043   <span class="keywordtype">int</span>   nvars,nb,mC,nC,m1,n1,m2,n2;
<a name="l00044"></a>00044   <span class="keywordtype">int</span>   nsubs=2, subs[2];
<a name="l00045"></a>00045   <span class="keywordtype">int</span>   iscellCA;
<a name="l00046"></a>00046   <span class="keywordtype">int</span>   its,reuse=4,print_info=1,printsummary=0;
<a name="l00047"></a>00047   <span class="keywordtype">int</span>   ijnnz,spot,n,nn=0,nzmats,vecn;
<a name="l00048"></a>00048   <span class="keywordtype">int</span> it1,it2;
<a name="l00049"></a>00049   <span class="keywordtype">int</span> nsdpblocks=0,sdpblockj=0,sdpnmax=1,lpnmax=1,stat1=1,xmaker=0;
<a name="l00050"></a>00050   <span class="keywordtype">int</span> sspot,nsubblocks,blockj;
<a name="l00051"></a>00051   <span class="keywordtype">int</span> jj,tnnz,tnnz2;
<a name="l00052"></a>00052   <span class="keywordtype">int</span> maxit=1000,fastblas=1,rpos=0,drho=1,iloginfo=0,aggressive=0;
<a name="l00053"></a>00053   <span class="keywordtype">double</span> penalty=1e8,rho=4,zbar=1e10,cc=0,r0=-1,mu0=-1,ylow,yhigh,gaptol=1e-6,pnormtol=1e30;
<a name="l00054"></a>00054   <span class="keywordtype">double</span> maxtrust=1e30,steptol=0.01,inftol=1e-8,lpb=1.0,dbound=1e20,infptol=1e-4;
<a name="l00055"></a>00055   <span class="keywordtype">double</span> dtmp,pstep,dstep,pnorm,mu;
<a name="l00056"></a>00056   <span class="keywordtype">double</span> *blockn,datanorm[3];
<a name="l00057"></a>00057   <span class="keywordtype">double</span> *aval,*aval2,*bval,*yout,*y0=0,*xout,*stat;
<a name="l00058"></a>00058   <span class="keywordtype">double</span> pobj,dobj,dinf;
<a name="l00059"></a>00059   <a class="code" href="structDSDP__C.html" title="Internal structures for the DSDP solver.">DSDP</a> dsdp;
<a name="l00060"></a>00060   <a class="code" href="structSDPCone__C.html" title="Internal structure for semidefinite cone.">SDPCone</a>  sdpcone=0;
<a name="l00061"></a>00061   <a class="code" href="dsdpbasictypes_8h.html#a2a68c4cccb1289043bf9b59a58f55b3a" title="There are many reasons to terminate the solver.">DSDPTerminationReason</a> reason;
<a name="l00062"></a>00062   <a class="code" href="dsdpbasictypes_8h.html#a7c124046b4ddae3d637157242af2df90" title="Formulations (P) and (D) can be feasible and bounded, feasible and unbounded, or infeasible.">DSDPSolutionType</a> pdfeasible;
<a name="l00063"></a>00063   <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=0;
<a name="l00064"></a>00064   <a class="code" href="dsdp5_8h.html#a266598a85e3c9c12e8706e21cf7f0f45" title="The BCone object points to lower and upper bounds on the variable y in (D).">BCone</a> bcone=0;
<a name="l00065"></a>00065   <span class="keywordtype">char</span> conetype[30];
<a name="l00066"></a>00066   <span class="keywordtype">int</span> nfields=25;
<a name="l00067"></a>00067   <span class="keyword">const</span> <span class="keywordtype">char</span> *fnames[25]={<span class="stringliteral">&quot;stype&quot;</span>,<span class="stringliteral">&quot;obj&quot;</span>,<span class="stringliteral">&quot;pobj&quot;</span>,<span class="stringliteral">&quot;dobj&quot;</span>,<span class="stringliteral">&quot;stopcode&quot;</span>,<span class="stringliteral">&quot;termcode&quot;</span>,<span class="stringliteral">&quot;iterates&quot;</span>,<span class="stringliteral">&quot;r&quot;</span>,<span class="stringliteral">&quot;mu&quot;</span>,
<a name="l00068"></a>00068                           <span class="stringliteral">&quot;pstep&quot;</span>,<span class="stringliteral">&quot;dstep&quot;</span>,<span class="stringliteral">&quot;pnorm&quot;</span>,<span class="stringliteral">&quot;gaphist&quot;</span>,<span class="stringliteral">&quot;infeashist&quot;</span>,<span class="stringliteral">&quot;errors&quot;</span>,
<a name="l00069"></a>00069                           <span class="stringliteral">&quot;datanorm&quot;</span>,<span class="stringliteral">&quot;ynorm&quot;</span>,<span class="stringliteral">&quot;boundy&quot;</span>,<span class="stringliteral">&quot;penalty&quot;</span>,<span class="stringliteral">&quot;tracex&quot;</span>,<span class="stringliteral">&quot;reuse&quot;</span>,<span class="stringliteral">&quot;rho&quot;</span>,<span class="stringliteral">&quot;xy&quot;</span>,<span class="stringliteral">&quot;xdy&quot;</span>,<span class="stringliteral">&quot;xmu&quot;</span>};
<a name="l00070"></a>00070   
<a name="l00071"></a>00071   <span class="keywordflow">if</span> (nrhs &lt; 2){
<a name="l00072"></a>00072     mexErrMsgTxt(<span class="stringliteral">&quot;Two input arguments required.  See help for details. &quot;</span>);}
<a name="l00073"></a>00073   <span class="keywordflow">if</span> (nrhs &gt; 4){
<a name="l00074"></a>00074     mexErrMsgTxt(<span class="stringliteral">&quot;Fewer input arguments required.  See help for details. &quot;</span>);}
<a name="l00075"></a>00075   <span class="keywordflow">if</span> (nlhs &lt; 2){
<a name="l00076"></a>00076     mexErrMsgTxt(<span class="stringliteral">&quot;Two output arguments required.  See help for details. &quot;</span>);}
<a name="l00077"></a>00077   <span class="keywordflow">if</span> (nlhs &gt; 3){
<a name="l00078"></a>00078     mexErrMsgTxt(<span class="stringliteral">&quot;Fewer output arguments required.  See help for details. &quot;</span>);}
<a name="l00079"></a>00079 
<a name="l00080"></a>00080   <span class="keywordflow">if</span> (!mxIsDouble(B_IN) || mxIsSparse(B_IN)){
<a name="l00081"></a>00081     mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: 1ST input must be a dense vector of doubles&quot;</span>); }
<a name="l00082"></a>00082   nvars = mxGetM(B_IN);
<a name="l00083"></a>00083   nb = mxGetN(B_IN);    
<a name="l00084"></a>00084   <span class="keywordflow">if</span> (nb &gt; 1){
<a name="l00085"></a>00085     mexErrMsgTxt(<span class="stringliteral">&quot;DESP: 1ST input must be a column vector&quot;</span>); }
<a name="l00086"></a>00086   
<a name="l00087"></a>00087   iscellCA = mxIsCell(CA_IN); 
<a name="l00088"></a>00088   <span class="keywordflow">if</span> (!iscellCA){
<a name="l00089"></a>00089     mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: 2ND input must be a cell array&quot;</span>); }
<a name="l00090"></a>00090   mC = mxGetM(CA_IN);
<a name="l00091"></a>00091   nC = mxGetN(CA_IN); 
<a name="l00092"></a>00092   <span class="keywordflow">if</span> (nC != 3){
<a name="l00093"></a>00093     mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: dimension of 2ND cell array is p x 3&quot;</span>);}
<a name="l00094"></a>00094 
<a name="l00095"></a>00095   <span class="keywordflow">if</span> (nrhs &gt;2){
<a name="l00096"></a>00096     <span class="keywordflow">if</span>(!mxIsStruct(PARS_IN)){
<a name="l00097"></a>00097       mexErrMsgTxt(<span class="stringliteral">&quot;3RD input `OPTIONS&#39; should be a structure.&quot;</span>);
<a name="l00098"></a>00098     }
<a name="l00099"></a>00099   }
<a name="l00100"></a>00100 
<a name="l00101"></a>00101   <span class="keywordflow">if</span> (nrhs&gt;3){
<a name="l00102"></a>00102     <span class="keywordflow">if</span> (!mxIsDouble(Y_IN) || mxIsSparse(Y_IN)){
<a name="l00103"></a>00103       mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: 4TH input must be a dense vector of doubles&quot;</span>); }
<a name="l00104"></a>00104     m1 = mxGetM(Y_IN);
<a name="l00105"></a>00105     n1 = mxGetN(Y_IN);
<a name="l00106"></a>00106     <span class="keywordflow">if</span> (m1 != nvars || n1 != nb){
<a name="l00107"></a>00107       mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: dimensions of 1ST and 4TH input not compatible&quot;</span>);}
<a name="l00108"></a>00108     y0=mxGetPr(Y_IN);
<a name="l00109"></a>00109     <span class="keywordflow">if</span> (!y0){
<a name="l00110"></a>00110        mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: Cannot read 4TH argument&quot;</span>);}
<a name="l00111"></a>00111   } <span class="keywordflow">else</span> y0=0;
<a name="l00112"></a>00112   
<a name="l00113"></a>00113   
<a name="l00114"></a>00114   <span class="comment">/* Check data */</span>
<a name="l00115"></a>00115   <span class="keywordflow">for</span> (j=0; j&lt;mC; j++){
<a name="l00116"></a>00116     subs[0] = j; subs[1] = 0;
<a name="l00117"></a>00117     index = mxCalcSingleSubscript(CA_IN,nsubs,subs); 
<a name="l00118"></a>00118     CA_cell_pr = mxGetCell(CA_IN,index); 
<a name="l00119"></a>00119     <span class="keywordflow">if</span> (!CA_cell_pr){
<a name="l00120"></a>00120       mexPrintf(<span class="stringliteral">&quot;??? DSDP DATA ERROR: Cell: %d, Column: %d\n&quot;</span>,j+1,1);
<a name="l00121"></a>00121       mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: Empty Cell. Missing String&quot;</span>); }
<a name="l00122"></a>00122     <span class="keywordflow">if</span> (!mxIsChar(CA_cell_pr)){
<a name="l00123"></a>00123       mexPrintf(<span class="stringliteral">&quot;??? DSDP DATA ERROR: Cell: %d \n&quot;</span>,j+1);
<a name="l00124"></a>00124       mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: First column of cells in 2ND argument are a string to determine cone type.&quot;</span>); }
<a name="l00125"></a>00125     mxGetString(CA_cell_pr,conetype,20); 
<a name="l00126"></a>00126     
<a name="l00127"></a>00127     subs[0] = j; subs[1] = 1;
<a name="l00128"></a>00128     index = mxCalcSingleSubscript(CA_IN,nsubs,subs); 
<a name="l00129"></a>00129     CA_cell_pr = mxGetCell(CA_IN,index); 
<a name="l00130"></a>00130     <span class="keywordflow">if</span> (!CA_cell_pr){
<a name="l00131"></a>00131       mexPrintf(<span class="stringliteral">&quot;??? DSDP DATA ERROR: Cell: %d, Column: %d\n&quot;</span>,j+1,2);
<a name="l00132"></a>00132       mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: Empty Cell. Provide dimension of block.&quot;</span>); }
<a name="l00133"></a>00133     <span class="keywordflow">if</span> (mxIsSparse(CA_cell_pr)){
<a name="l00134"></a>00134       mexPrintf(<span class="stringliteral">&quot;??? DSDP DATA ERROR: Cell: %d \n&quot;</span>,j+1);
<a name="l00135"></a>00135       mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: Second column in 2ND argument must be a dense array of scalars that specify dimension.&quot;</span>); }
<a name="l00136"></a>00136     <span class="keywordflow">if</span> (!mxIsDouble(CA_cell_pr)){
<a name="l00137"></a>00137       mexPrintf(<span class="stringliteral">&quot;??? DSDP DATA ERROR: Cell: %d \n&quot;</span>,j+1);
<a name="l00138"></a>00138       mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: Second column in 2ND argument must specify dimension.&quot;</span>); }
<a name="l00139"></a>00139     aval=mxGetPr(CA_cell_pr);
<a name="l00140"></a>00140 
<a name="l00141"></a>00141     subs[0] = j; subs[1] = 2;
<a name="l00142"></a>00142     index = mxCalcSingleSubscript(CA_IN,nsubs,subs); 
<a name="l00143"></a>00143     CA_cell_pr = mxGetCell(CA_IN,index); 
<a name="l00144"></a>00144     <span class="keywordflow">if</span> (!CA_cell_pr){
<a name="l00145"></a>00145       mexPrintf(<span class="stringliteral">&quot;??? DSDP DATA ERROR: Cell: %d, Column: %d\n&quot;</span>,j+1,3);
<a name="l00146"></a>00146       mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: Empty Cell. Provide sparse data matrix.&quot;</span>); }
<a name="l00147"></a>00147     <span class="keywordflow">if</span> (!mxIsSparse(CA_cell_pr) || !mxIsDouble(CA_cell_pr)){ 
<a name="l00148"></a>00148       mexPrintf(<span class="stringliteral">&quot;??? DSDP DATA ERROR: Cell: %d \n&quot;</span>,j+1);
<a name="l00149"></a>00149       mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: Third column in 2ND argument must be a real sparse data matrix.&quot;</span>); }
<a name="l00150"></a>00150     
<a name="l00151"></a>00151     <span class="keywordflow">if</span> (strcmp(conetype,<span class="stringliteral">&quot;SDP&quot;</span>)==0){ 
<a name="l00152"></a>00152       subs[0] = j; subs[1] = 1;
<a name="l00153"></a>00153       index = mxCalcSingleSubscript(CA_IN,nsubs,subs); 
<a name="l00154"></a>00154       CA_cell_pr = mxGetCell(CA_IN,index); 
<a name="l00155"></a>00155       aval=mxGetPr(CA_cell_pr);
<a name="l00156"></a>00156       it1 = mxGetM(CA_cell_pr);
<a name="l00157"></a>00157       it2 = mxGetN(CA_cell_pr); 
<a name="l00158"></a>00158       <span class="keywordflow">if</span> (it1!=1 &amp;&amp; it2!=1){
<a name="l00159"></a>00159         mexPrintf(<span class="stringliteral">&quot;??? DSDP DATA ERROR: Cell: %d \n&quot;</span>,j+1);
<a name="l00160"></a>00160         mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: Use a dense row vector in the second column in 2ND of the argument.&quot;</span>);}
<a name="l00161"></a>00161 
<a name="l00162"></a>00162       subs[0] = j; subs[1] = 2;
<a name="l00163"></a>00163       index = mxCalcSingleSubscript(CA_IN,nsubs,subs); 
<a name="l00164"></a>00164       CA_cell_pr = mxGetCell(CA_IN,index); 
<a name="l00165"></a>00165       m1 = mxGetN(CA_cell_pr)-1;
<a name="l00166"></a>00166       <span class="keywordflow">if</span> (m1 != nvars){
<a name="l00167"></a>00167         mexPrintf(<span class="stringliteral">&quot;??? DSDP DATA ERROR: Cell: %d \n&quot;</span>,j+1);
<a name="l00168"></a>00168         mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: The matrix in the third column in 2ND argument must have number of columns equal to number of variables+1.&quot;</span>);}
<a name="l00169"></a>00169       vecn = mxGetM(CA_cell_pr); 
<a name="l00170"></a>00170       <span class="keywordflow">for</span> (tnnz=0,i=0;i&lt;it1*it2;i++){n=(int)aval[i]; tnnz=tnnz+n*(n+1)/2;}
<a name="l00171"></a>00171       <span class="keywordflow">if</span> ( tnnz != vecn){
<a name="l00172"></a>00172         mexPrintf(<span class="stringliteral">&quot;??? DSDP DATA ERROR: Cell: %d \n&quot;</span>,j+1);
<a name="l00173"></a>00173         mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: Check Dimensions:  The columns of A and C cannot be converted into square matrices&quot;</span>);}
<a name="l00174"></a>00174       nsdpblocks=nsdpblocks+it1*it2;
<a name="l00175"></a>00175     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(conetype,<span class="stringliteral">&quot;LP&quot;</span>)==0){ 
<a name="l00176"></a>00176 
<a name="l00177"></a>00177       subs[0] = j; subs[1] = 1;
<a name="l00178"></a>00178       index = mxCalcSingleSubscript(CA_IN,nsubs,subs); 
<a name="l00179"></a>00179       CA_cell_pr = mxGetCell(CA_IN,index); 
<a name="l00180"></a>00180       it1 = mxGetM(CA_cell_pr);
<a name="l00181"></a>00181       it2 = mxGetN(CA_cell_pr); 
<a name="l00182"></a>00182       <span class="comment">/* THe sum of the dimensions should equal the number of constraints */</span>
<a name="l00183"></a>00183       
<a name="l00184"></a>00184       subs[0] = j; subs[1] = 2;
<a name="l00185"></a>00185       index = mxCalcSingleSubscript(CA_IN,nsubs,subs); 
<a name="l00186"></a>00186       CA_cell_pr = mxGetCell(CA_IN,index); 
<a name="l00187"></a>00187       <span class="keywordflow">if</span> (!mxIsSparse(CA_cell_pr)){ 
<a name="l00188"></a>00188         mexPrintf(<span class="stringliteral">&quot;??? DSDP DATA ERROR: Cell: %d \n&quot;</span>,j+1);
<a name="l00189"></a>00189         mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: Matrices in the third column in 2ND argument must be sparse.&quot;</span>); }     
<a name="l00190"></a>00190       m1 = mxGetN(CA_cell_pr)-1;
<a name="l00191"></a>00191       <span class="keywordflow">if</span> (m1 != nvars){
<a name="l00192"></a>00192         mexPrintf(<span class="stringliteral">&quot;??? DSDP DATA ERROR: Cell: %d \n&quot;</span>,j+1);
<a name="l00193"></a>00193         mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: The matrix in the third column in 2ND argument must have number of columns equal to number of variables+1.&quot;</span>);}
<a name="l00194"></a>00194     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(conetype,<span class="stringliteral">&quot;LB&quot;</span>)==0 || strcmp(conetype,<span class="stringliteral">&quot;UB&quot;</span>)==0 ){ 
<a name="l00195"></a>00195       
<a name="l00196"></a>00196       subs[0] = j; subs[1] = 2;
<a name="l00197"></a>00197       index = mxCalcSingleSubscript(CA_IN,nsubs,subs); 
<a name="l00198"></a>00198       CA_cell_pr = mxGetCell(CA_IN,index); 
<a name="l00199"></a>00199       <span class="keywordflow">if</span> (mxIsSparse(CA_cell_pr)){ 
<a name="l00200"></a>00200         mexPrintf(<span class="stringliteral">&quot;??? DSDP DATA ERROR: Cell: %d \n&quot;</span>,j+1);
<a name="l00201"></a>00201         mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: Row vector in the third column in 2ND argument must be full.&quot;</span>); }     
<a name="l00202"></a>00202       it1 = mxGetM(CA_cell_pr);
<a name="l00203"></a>00203       it2 = mxGetN(CA_cell_pr); 
<a name="l00204"></a>00204       <span class="keywordflow">if</span> (it2 != 1){
<a name="l00205"></a>00205         mexPrintf(<span class="stringliteral">&quot;??? DSDP DATA ERROR: Cell: %d \n&quot;</span>,j+1);
<a name="l00206"></a>00206         mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: The matrix in the third column in 2ND argument must have a single column of bounds.&quot;</span>);}
<a name="l00207"></a>00207       <span class="keywordflow">if</span> (it1 != nvars){
<a name="l00208"></a>00208         mexPrintf(<span class="stringliteral">&quot;??? DSDP DATA ERROR: Cell: %d \n&quot;</span>,j+1);
<a name="l00209"></a>00209         mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: The column matrix in the third column in 2ND argument must contain a bound for each y variable.&quot;</span>);}
<a name="l00210"></a>00210 
<a name="l00211"></a>00211     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(conetype,<span class="stringliteral">&quot;FIXED&quot;</span>)==0){ 
<a name="l00212"></a>00212       <span class="keywordtype">int</span> dim1;
<a name="l00213"></a>00213       subs[0] = j; subs[1] = 1;
<a name="l00214"></a>00214       index = mxCalcSingleSubscript(CA_IN,nsubs,subs); 
<a name="l00215"></a>00215       CA_cell_pr = mxGetCell(CA_IN,index); 
<a name="l00216"></a>00216       <span class="keywordflow">if</span> (mxIsSparse(CA_cell_pr)){ 
<a name="l00217"></a>00217         mexPrintf(<span class="stringliteral">&quot;??? DSDP DATA ERROR: Cell: %d \n&quot;</span>,j+1);
<a name="l00218"></a>00218         mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: Vector in the third column in 2ND argument must be full.&quot;</span>); }     
<a name="l00219"></a>00219       it1 = mxGetM(CA_cell_pr);
<a name="l00220"></a>00220       it2 = mxGetN(CA_cell_pr); 
<a name="l00221"></a>00221       dim1=it1*it2;
<a name="l00222"></a>00222       <span class="keywordflow">if</span> (it1 != 1){
<a name="l00223"></a>00223         mexPrintf(<span class="stringliteral">&quot;??? DSDP DATA ERROR: Cell: %d \n&quot;</span>,j+1);
<a name="l00224"></a>00224         mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: Third column in 2ND argument must have 1 row,&quot;</span>);}
<a name="l00225"></a>00225       subs[0] = j; subs[1] = 2;
<a name="l00226"></a>00226       index = mxCalcSingleSubscript(CA_IN,nsubs,subs);
<a name="l00227"></a>00227       CA_cell_pr = mxGetCell(CA_IN,index); 
<a name="l00228"></a>00228       <span class="keywordflow">if</span> (mxIsSparse(CA_cell_pr)){ 
<a name="l00229"></a>00229         mexPrintf(<span class="stringliteral">&quot;??? DSDP DATA ERROR: Cell: %d \n&quot;</span>,j+1);
<a name="l00230"></a>00230         mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: Vector in the third column in 2ND argument must be full.&quot;</span>); }
<a name="l00231"></a>00231       it1 = mxGetM(CA_cell_pr);
<a name="l00232"></a>00232       it2 = mxGetN(CA_cell_pr); 
<a name="l00233"></a>00233       <span class="keywordflow">if</span> (it1 != 1){
<a name="l00234"></a>00234         mexPrintf(<span class="stringliteral">&quot;??? DSDP DATA ERROR: Cell: %d \n&quot;</span>,j+1);
<a name="l00235"></a>00235         mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: Third column in 2ND argument must have 1 row,&quot;</span>);}
<a name="l00236"></a>00236       <span class="keywordflow">if</span> (it2 != dim1){
<a name="l00237"></a>00237         mexPrintf(<span class="stringliteral">&quot;??? DSDP DATA ERROR: Cell: %d \n&quot;</span>,j+1);
<a name="l00238"></a>00238         mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: Secord and third column must have same dimension,&quot;</span>);}
<a name="l00239"></a>00239     } <span class="keywordflow">else</span> {
<a name="l00240"></a>00240       mexPrintf(<span class="stringliteral">&quot;??? DSDP DATA ERROR: Cell: %d, Conetype: %s \n&quot;</span>,j+1,conetype);
<a name="l00241"></a>00241       mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: Unknown Cone type in 2ND argument. Try &#39;SDP&#39; or &#39;LP&#39; or &#39;Bounds&#39;. &quot;</span>);
<a name="l00242"></a>00242     }
<a name="l00243"></a>00243   }
<a name="l00244"></a>00244   
<a name="l00245"></a>00245   
<a name="l00246"></a>00246   <span class="comment">/* Create output arrays */</span>
<a name="l00247"></a>00247   <span class="keywordflow">if</span> (nlhs&gt;2){
<a name="l00248"></a>00248     <span class="keywordflow">if</span> (X_OUT != NULL) mxDestroyArray(X_OUT) ;
<a name="l00249"></a>00249     X_OUT = mxCreateCellMatrix(mC,1);
<a name="l00250"></a>00250   }
<a name="l00251"></a>00251   <span class="keywordflow">if</span> (Y_OUT != NULL) mxDestroyArray(Y_OUT) ;
<a name="l00252"></a>00252   Y_OUT = mxCreateDoubleMatrix(nvars, 1, mxREAL) ;
<a name="l00253"></a>00253   
<a name="l00254"></a>00254   <span class="comment">/* Create the Solver */</span>
<a name="l00255"></a>00255   info = <a class="code" href="group__DSDPBasic.html#gaa32509ded8359326d02782adb91c745a" title="Create a DSDP solver. FIRST DSDP routine!">DSDPCreate</a>(nvars,&amp;dsdp); CHKERR(info);
<a name="l00256"></a>00256   info = DSDPCreateSDPCone(dsdp,nsdpblocks,&amp;sdpcone); CHKERR(info);
<a name="l00257"></a>00257 
<a name="l00258"></a>00258   <span class="comment">/* Set Dual Objective Vector */</span>
<a name="l00259"></a>00259   bval=mxGetPr(B_IN);
<a name="l00260"></a>00260   <span class="keywordflow">if</span> (!bval){ mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: Problems with 1ST argument&quot;</span>);}
<a name="l00261"></a>00261   <span class="keywordflow">for</span> (i=0;i&lt;nvars;i++){info=<a class="code" href="group__DSDPBasic.html#ga7e1b78dc7d7407fcf84e05b9c42fc72c" title="Set the objective vector b in (D).">DSDPSetDualObjective</a>(dsdp,i+1,bval[i]); CHKERR(info);}
<a name="l00262"></a>00262   
<a name="l00263"></a>00263   <span class="comment">/* Set Matrix Data */</span>
<a name="l00264"></a>00264   <span class="keywordflow">for</span> (j=0; j&lt;mC; j++){  <span class="comment">/* Begin Block */</span>
<a name="l00265"></a>00265     subs[0] = j; subs[1] = 0;
<a name="l00266"></a>00266     index = mxCalcSingleSubscript(CA_IN,nsubs,subs); 
<a name="l00267"></a>00267     CA_cell_pr = mxGetCell(CA_IN,index); 
<a name="l00268"></a>00268     mxGetString(CA_cell_pr,conetype,20); 
<a name="l00269"></a>00269     <span class="keywordflow">if</span> (strcmp(conetype,<span class="stringliteral">&quot;SDP&quot;</span>)==0){ 
<a name="l00270"></a>00270 
<a name="l00271"></a>00271       subs[0] = j; subs[1] = 1;
<a name="l00272"></a>00272       index = mxCalcSingleSubscript(CA_IN,nsubs,subs); 
<a name="l00273"></a>00273       CA_cell_pr = mxGetCell(CA_IN,index); 
<a name="l00274"></a>00274       it1 = mxGetM(CA_cell_pr);
<a name="l00275"></a>00275       it2 = mxGetN(CA_cell_pr); 
<a name="l00276"></a>00276       blockn=mxGetPr(CA_cell_pr);
<a name="l00277"></a>00277       nsubblocks=it1*it2;
<a name="l00278"></a>00278 
<a name="l00279"></a>00279       subs[0] = j; subs[1] = 2;
<a name="l00280"></a>00280       index = mxCalcSingleSubscript(CA_IN,nsubs,subs); 
<a name="l00281"></a>00281       CA_cell_pr = mxGetCell(CA_IN,index); 
<a name="l00282"></a>00282       aval=mxGetPr(CA_cell_pr); air =mxGetIr(CA_cell_pr); ajc =mxGetJc(CA_cell_pr);
<a name="l00283"></a>00283       <span class="keywordflow">if</span> (!aval||!air||!ajc)
<a name="l00284"></a>00284         { mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: Problems with 2ND argument&quot;</span>);}
<a name="l00285"></a>00285       <span class="keywordflow">for</span> (tnnz=0,jj=0;jj&lt;nsubblocks;jj++){n=(int)blockn[jj];tnnz+=n*(n+1)/2;}
<a name="l00286"></a>00286       <span class="keywordflow">if</span> (nlhs&gt;2){
<a name="l00287"></a>00287         subs[0] = j; subs[1] = 0;
<a name="l00288"></a>00288         index = mxCalcSingleSubscript(X_OUT,nsubs,subs);
<a name="l00289"></a>00289         X_cell_pr = mxCreateDoubleMatrix(tnnz,1,mxREAL);
<a name="l00290"></a>00290         mxSetCell(X_OUT,index,X_cell_pr);
<a name="l00291"></a>00291         xout=mxGetPr(X_cell_pr);
<a name="l00292"></a>00292         <span class="keywordflow">if</span> (tnnz&gt;0 &amp;&amp; !xout){ mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: Cannot create array. Out of Memory&quot;</span>);}
<a name="l00293"></a>00293       }
<a name="l00294"></a>00294       
<a name="l00295"></a>00295       <span class="keywordflow">for</span> (ii=0; ii&lt;=nvars; ii++){ <span class="comment">/* Begin Variable matrix constraints */</span>
<a name="l00296"></a>00296         i=ii+1;
<a name="l00297"></a>00297         <span class="keywordflow">if</span> (i==nvars+1) i=0;
<a name="l00298"></a>00298         tnnz=0; spot=ajc[ii]; blockj=sdpblockj;
<a name="l00299"></a>00299         <span class="keywordflow">for</span> (jj=0;jj&lt;nsubblocks;jj++){
<a name="l00300"></a>00300           n=(int)blockn[jj];
<a name="l00301"></a>00301           <span class="keywordflow">if</span> (sdpnmax&lt;n) sdpnmax=n;
<a name="l00302"></a>00302           <span class="keywordflow">if</span> (ii==0){
<a name="l00303"></a>00303             nn+=n;
<a name="l00304"></a>00304             info=<a class="code" href="group__SDPRoutines.html#ga0c3a5c6eee6aca0ab0c222fbfcca1d19" title="Set the dimension of one block in the semidefinite cone.">SDPConeSetBlockSize</a>(sdpcone,blockj,n); CHKERR(info);
<a name="l00305"></a>00305             info=<a class="code" href="group__SDPData.html#gaa3747efc8ae918a9be9138dcab3cf7bd" title="Use packed symmetric format for the dense array.">SDPConeUsePackedFormat</a>(sdpcone,blockj); CHKERR(info);
<a name="l00306"></a>00306 
<a name="l00307"></a>00307             <span class="keywordflow">if</span> (nlhs&gt;2){info=<a class="code" href="group__SDPRoutines.html#gaa3db1133fbf2edbfc1e48521bb367705" title="Provide an array for the SDPCone object can use to store dense matrices.">SDPConeSetXArray</a>(sdpcone,blockj,n,xout+tnnz,(n*n+n)/2); CHKERR(info);} 
<a name="l00308"></a>00308             info=CountNonzeroMatrices(blockn,nsubblocks,jj,nvars, air, ajc, &amp;nzmats); CHKERR(info);
<a name="l00309"></a>00309             info=<a class="code" href="group__SDPRoutines.html#ga40728695e4c841900c02c615a8d96ab0" title="Set the number of nonzero matrices in a block of the semidefinite cone.">SDPConeSetSparsity</a>(sdpcone,blockj,nzmats); CHKERR(info);
<a name="l00310"></a>00310             <span class="keywordflow">if</span> (stat1&lt;nzmats)stat1=nzmats;
<a name="l00311"></a>00311           }
<a name="l00312"></a>00312           <span class="keywordflow">for</span> (tnnz2=tnnz+n*(n+1)/2,ijnnz=0;ijnnz&lt;ajc[ii+1]-spot &amp;&amp; air[spot+ijnnz]&lt;tnnz2;ijnnz++){}
<a name="l00313"></a>00313           <span class="keywordflow">if</span> ( ijnnz==0 ){     <span class="comment">/*  info=DSDPSetZeroMat(dsdp,sdpblockj,i,n); */</span>
<a name="l00314"></a>00314           } <span class="keywordflow">else</span> <span class="keywordflow">if</span>(ijnnz==n*(n+1)/2){ <span class="comment">/* check for dense matrix  */</span>
<a name="l00315"></a>00315             <span class="keywordflow">if</span> (CheckForConstantMat(aval+spot,ijnnz,n)){
<a name="l00316"></a>00316               info=<a class="code" href="group__SDPData.html#ga3af8e9398c77b07799bd3cfe29faa070" title="Set a matrix  whose elements are all the same.">SDPConeSetConstantMat</a>(sdpcone,blockj,i,n,aval[spot]); CHKERR(info);
<a name="l00317"></a>00317             } <span class="keywordflow">else</span> {
<a name="l00318"></a>00318               info=<a class="code" href="group__SDPBasic.html#ga9e2cd5d5922b5e45c48ec58c7345def0" title="Set a matrix  in a dense format.">SDPConeSetADenseVecMat</a>(sdpcone,blockj,i,n,1.0,aval+spot,ijnnz); CHKERR(info);
<a name="l00319"></a>00319             }
<a name="l00320"></a>00320           } <span class="keywordflow">else</span> {
<a name="l00321"></a>00321             info=<a class="code" href="group__SDPBasic.html#gaa6ed45b2539266f04bd4b8401aa89c06" title="Set data matrix  in a sparse format.">SDPConeSetASparseVecMat</a>(sdpcone,blockj,i,n,1.0,tnnz,air+spot,aval+spot,ijnnz); CHKERR(info);
<a name="l00322"></a>00322           }
<a name="l00323"></a>00323           tnnz+=n*(n+1)/2; spot+=ijnnz; blockj++;
<a name="l00324"></a>00324         }
<a name="l00325"></a>00325       }  <span class="comment">/* End Matrices in block */</span>
<a name="l00326"></a>00326       sdpblockj=sdpblockj+nsubblocks;
<a name="l00327"></a>00327 
<a name="l00328"></a>00328     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(conetype,<span class="stringliteral">&quot;LB&quot;</span>)==0 || strcmp(conetype,<span class="stringliteral">&quot;UB&quot;</span>)==0 ){
<a name="l00329"></a>00329       subs[0] = j; subs[1] = 2;
<a name="l00330"></a>00330       index = mxCalcSingleSubscript(CA_IN,nsubs,subs); 
<a name="l00331"></a>00331       CA_cell_pr = mxGetCell(CA_IN,index);
<a name="l00332"></a>00332       aval=mxGetPr(CA_cell_pr);
<a name="l00333"></a>00333       info=<a class="code" href="group__Bounds.html#ga66c37f394d6efb45e686aed600015d09" title="Create a new cone that represents bounds on the y variables.">DSDPCreateBCone</a>(dsdp,&amp;bcone);  CHKERR(info);
<a name="l00334"></a>00334       info=<a class="code" href="group__Bounds.html#gade1222d9b36e71a1b9a97fb7ffc07e76" title="Set a surplus variable in constraint in (P).">BConeAllocateBounds</a>(bcone,nvars); CHKERR(info);
<a name="l00335"></a>00335       <span class="keywordflow">for</span> (i=0;i&lt;nvars;i++){
<a name="l00336"></a>00336         <span class="keywordflow">if</span> (strcmp(conetype,<span class="stringliteral">&quot;LB&quot;</span>)==0){
<a name="l00337"></a>00337           info=<a class="code" href="group__Bounds.html#ga297f00a5e6f5879e63d12eca63dbc715" title="Set a lower bound on a variable y.">BConeSetLowerBound</a>(bcone,i+1,aval[i]); CHKERR(info);
<a name="l00338"></a>00338         } <span class="keywordflow">else</span> {
<a name="l00339"></a>00339           info=<a class="code" href="group__Bounds.html#ga28c140fa13c908eaae22fb4c087ea2ea" title="Set an upper bound on a variable y.">BConeSetUpperBound</a>(bcone,i+1,aval[i]); CHKERR(info);
<a name="l00340"></a>00340         } 
<a name="l00341"></a>00341       }
<a name="l00342"></a>00342       <span class="keywordflow">if</span> (nlhs&gt;2){
<a name="l00343"></a>00343         subs[0] = j; subs[1] = 0;
<a name="l00344"></a>00344         index = mxCalcSingleSubscript(X_OUT,nsubs,subs); 
<a name="l00345"></a>00345         X_cell_pr = mxCreateDoubleMatrix(nvars,1,mxREAL);
<a name="l00346"></a>00346         mxSetCell(X_OUT,index,X_cell_pr);
<a name="l00347"></a>00347         aval2=mxGetPr(X_cell_pr);
<a name="l00348"></a>00348         info=BConeSetXArray(bcone,aval2,nvars); CHKERR(info);
<a name="l00349"></a>00349       }
<a name="l00350"></a>00350     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(conetype,<span class="stringliteral">&quot;LP&quot;</span>)==0){
<a name="l00351"></a>00351       subs[0] = j; subs[1] = 2;
<a name="l00352"></a>00352       index = mxCalcSingleSubscript(CA_IN,nsubs,subs); 
<a name="l00353"></a>00353       CA_cell_pr = mxGetCell(CA_IN,index); 
<a name="l00354"></a>00354       n = mxGetM(CA_cell_pr); 
<a name="l00355"></a>00355       <span class="keywordflow">if</span> (lpnmax&lt;n) lpnmax=n;
<a name="l00356"></a>00356       nn+=n;
<a name="l00357"></a>00357       aval=mxGetPr(CA_cell_pr); air =mxGetIr(CA_cell_pr); ajc =mxGetJc(CA_cell_pr);
<a name="l00358"></a>00358       <span class="keywordflow">if</span> (!aval||!air||!ajc)
<a name="l00359"></a>00359         { mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: Problems with 2ND argument&quot;</span>);}
<a name="l00360"></a>00360       info=<a class="code" href="group__LPRoutines.html#ga0d29bfae7b375bfb3bc8ccab769a4003" title="Create a new object for linear programs and scalar inequalities.">DSDPCreateLPCone</a>(dsdp,&amp;lpcone); CHKERR(info);
<a name="l00361"></a>00361       info=<a class="code" href="group__LPRoutines.html#gafe6d7646a6508238ee9d956c4693efd3" title="Set data A and into the LP cone.">LPConeSetData2</a>(lpcone,n,ajc,air,aval); CHKERR(info);
<a name="l00362"></a>00362       <span class="keywordflow">if</span> (nlhs&gt;2){
<a name="l00363"></a>00363         subs[0] = j; subs[1] = 0;
<a name="l00364"></a>00364         index = mxCalcSingleSubscript(X_OUT,nsubs,subs); 
<a name="l00365"></a>00365         X_cell_pr = mxCreateDoubleMatrix(n,1,mxREAL);
<a name="l00366"></a>00366         mxSetCell(X_OUT,index,X_cell_pr);
<a name="l00367"></a>00367         xout=mxGetPr(X_cell_pr);
<a name="l00368"></a>00368         <span class="keywordflow">if</span> (n&gt;0 &amp;&amp; !xout){ mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: Cannot create array. Out of Memory&quot;</span>);}
<a name="l00369"></a>00369         info=LPConeSetXVec(lpcone,xout,n); CHKERR(info);
<a name="l00370"></a>00370       }
<a name="l00371"></a>00371     
<a name="l00372"></a>00372     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(conetype,<span class="stringliteral">&quot;FIXED&quot;</span>)==0){
<a name="l00373"></a>00373       <span class="keywordtype">int</span> vari;
<a name="l00374"></a>00374       subs[0] = j; subs[1] = 1;
<a name="l00375"></a>00375       index = mxCalcSingleSubscript(CA_IN,nsubs,subs); 
<a name="l00376"></a>00376       CA_cell_pr = mxGetCell(CA_IN,index);
<a name="l00377"></a>00377       aval=mxGetPr(CA_cell_pr);
<a name="l00378"></a>00378       it1 = mxGetM(CA_cell_pr);
<a name="l00379"></a>00379       it2 = mxGetN(CA_cell_pr); 
<a name="l00380"></a>00380       subs[0] = j; subs[1] = 2;
<a name="l00381"></a>00381       index = mxCalcSingleSubscript(CA_IN,nsubs,subs); 
<a name="l00382"></a>00382       CA_cell_pr = mxGetCell(CA_IN,index);
<a name="l00383"></a>00383       aval2=mxGetPr(CA_cell_pr);
<a name="l00384"></a>00384       <span class="keywordflow">if</span> (nlhs&gt;2){
<a name="l00385"></a>00385         subs[0] = j; subs[1] = 0;
<a name="l00386"></a>00386         index = mxCalcSingleSubscript(X_OUT,nsubs,subs); 
<a name="l00387"></a>00387         X_cell_pr = mxCreateDoubleMatrix(it1*it2,1,mxREAL);
<a name="l00388"></a>00388         mxSetCell(X_OUT,index,X_cell_pr);
<a name="l00389"></a>00389         xout=mxGetPr(X_cell_pr);
<a name="l00390"></a>00390         <span class="keywordflow">if</span> (it1*it2&gt;0 &amp;&amp; !xout){ mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: Cannot create array. Out of Memory&quot;</span>);}
<a name="l00391"></a>00391       }  <span class="keywordflow">else</span> {xout=0;}
<a name="l00392"></a>00392       info=<a class="code" href="group__DSDPSolver.html#gabaa520cba1ca164175fb45cff1b2d6e3" title="Fix variable y to exact values.">DSDPSetFixedVariables</a>(dsdp,aval,aval2,xout,it1*it2); CHKERR(info);
<a name="l00393"></a>00393       <span class="keywordflow">for</span> (i=0;i&lt;it1*it2;i++){
<a name="l00394"></a>00394         <span class="comment">/*</span>
<a name="l00395"></a>00395 <span class="comment">        vari=(int)aval[i];</span>
<a name="l00396"></a>00396 <span class="comment">        printf(&quot;FixedVariable %d to %4.4e\n&quot;,vari,aval2[i]);</span>
<a name="l00397"></a>00397 <span class="comment">        info=DSDPSetFixedVariable(dsdp,vari,aval2[i]); CHKERR(info); </span>
<a name="l00398"></a>00398 <span class="comment">        */</span>
<a name="l00399"></a>00399       }
<a name="l00400"></a>00400     }    
<a name="l00401"></a>00401   } <span class="comment">/* End Block */</span>
<a name="l00402"></a>00402 
<a name="l00403"></a>00403   <span class="comment">/* Set initial point */</span>
<a name="l00404"></a>00404   <span class="keywordflow">if</span> (y0){
<a name="l00405"></a>00405     <span class="keywordflow">for</span> (i=0;i&lt;nvars;i++){ info = <a class="code" href="group__DSDPSolution.html#gacf5a2bd7ecb03b319caa22e545ef8e01" title="Set the initial values of variables y in (D).">DSDPSetY0</a>(dsdp,i+1,y0[i]); CHKERR(info);}
<a name="l00406"></a>00406   } 
<a name="l00407"></a>00407 
<a name="l00408"></a>00408   reuse=(nvars-2)/sdpnmax; 
<a name="l00409"></a>00409   <span class="keywordflow">if</span> (nvars&lt;50 &amp;&amp; reuse==0) reuse=1;
<a name="l00410"></a>00410   <span class="keywordflow">if</span> (reuse&gt;=1) reuse++;
<a name="l00411"></a>00411   reuse=reuse*reuse;
<a name="l00412"></a>00412   <span class="keywordflow">if</span> (nvars&lt;2000 &amp;&amp; reuse&gt;10) reuse=10;
<a name="l00413"></a>00413   <span class="keywordflow">if</span> (reuse&gt;12) reuse=12;
<a name="l00414"></a>00414   info=<a class="code" href="group__DSDPSolver.html#ga903ff948f2ba766430ba3918b9447ee7" title="Reuse the Hessian of the barrier function multiple times at each DSDP iteration.">DSDPReuseMatrix</a>(dsdp,reuse); CHKERR(info);
<a name="l00415"></a>00415 
<a name="l00416"></a>00416   info=<a class="code" href="group__DSDPSolution.html#gad603533b7e28587f5b2ee824eee58eb3" title="Copy the objective value (PP).">DSDPGetPPObjective</a>(dsdp,&amp;zbar); CHKERR(info);
<a name="l00417"></a>00417   info=<a class="code" href="group__DSDPSolution.html#gacfa8e29ecd7eaaeb6a4e31eb07961de3" title="Copy the infeasibility in (D), or the variable r in (DD).">DSDPGetR</a>(dsdp,&amp;r0); CHKERR(info);
<a name="l00418"></a>00418   info=<a class="code" href="group__DSDPConverge.html#gac98359685ab5aad73ed95e335fcb21ab" title="Copy the maximum number of iterations from the solver.">DSDPGetMaxIts</a>(dsdp,&amp;maxit);  CHKERR(info);
<a name="l00419"></a>00419   info=<a class="code" href="group__DSDPSolver.html#gae27461735f62031b5fd794672b026b78" title="Copy the penalty parameter Gamma.">DSDPGetPenaltyParameter</a>(dsdp,&amp;penalty);  CHKERR(info);
<a name="l00420"></a>00420   info=<a class="code" href="group__DSDPSolver.html#ga0cc2e91620e27338d0a508d60f8761ce" title="Copy the potential parameter.">DSDPGetPotentialParameter</a>(dsdp,&amp;rho);  CHKERR(info);
<a name="l00421"></a>00421   info=<a class="code" href="group__DSDPConverge.html#gaa84852abdc5e8f4dcef46748f8c7e4d0" title="Get the termination parameter.">DSDPGetDualBound</a>(dsdp,&amp;dbound);  CHKERR(info);
<a name="l00422"></a>00422   info=<a class="code" href="group__DSDPConverge.html#ga876bd5084bfd1b62eb37211d4bcf188e" title="Get the termination tolerance.">DSDPGetGapTolerance</a>(dsdp,&amp;gaptol); CHKERR(info);
<a name="l00423"></a>00423   info=<a class="code" href="group__DSDPConverge.html#ga48cc08979850c048b38d7f1fd423deec" title="Copy the maximum infeasibility allowed (D).">DSDPGetRTolerance</a>(dsdp,&amp;inftol);  CHKERR(info);
<a name="l00424"></a>00424   info=<a class="code" href="group__DSDPSolver.html#ga05f1269e817495e448ffa8ae3a4012cf" title="Copy the current barrier parameter.">DSDPGetBarrierParameter</a>(dsdp,&amp;mu0); CHKERR(info);
<a name="l00425"></a>00425   info=<a class="code" href="group__DSDPSolver.html#ga8fe5ad8ed4d88f70fc9e33a39460d594" title="Copy the current radius of the trust region.">DSDPGetMaxTrustRadius</a>(dsdp,&amp;maxtrust);  CHKERR(info);
<a name="l00426"></a>00426   info=<a class="code" href="group__DSDPConverge.html#gabbef47d1ecf58ee77ac463168aa14afb" title="Get the current tolerance.">DSDPGetStepTolerance</a>(dsdp,&amp;steptol);  CHKERR(info);
<a name="l00427"></a>00427   info=<a class="code" href="group__DSDPConverge.html#ga8c3bf97d823880a151321f7c7c43aaf8" title="Copy the feasibility tolerance.">DSDPGetPTolerance</a>(dsdp,&amp;infptol);  CHKERR(info);
<a name="l00428"></a>00428   info=<a class="code" href="group__DSDPSolution.html#gae103a4b863adc10f37d2eda9f94a982b" title="Copy the norms of the data C, A, and b into an array.">DSDPGetDataNorms</a>(dsdp, datanorm); CHKERR(info);
<a name="l00429"></a>00429   info=<a class="code" href="group__DSDPSolver.html#gaeb2f494ff50c552de67a02bf68f7b47e" title="Copy the bounds on the variables y.">DSDPGetYBounds</a>(dsdp,&amp;ylow,&amp;yhigh); CHKERR(info);
<a name="l00430"></a>00430   <span class="keywordflow">if</span> (datanorm[0]==0){info=<a class="code" href="group__DSDPSolver.html#gad73a74d9d294e87b58ad3a7e939a43ad" title="Bound the variables y.">DSDPSetYBounds</a>(dsdp,-1.0,1.0);CHKERR(info);}
<a name="l00431"></a>00431   <span class="keywordflow">if</span> (nrhs &gt;2){
<a name="l00432"></a>00432     <span class="keywordflow">if</span>(!mxIsStruct(PARS_IN)){
<a name="l00433"></a>00433       mexErrMsgTxt(<span class="stringliteral">&quot;Fifth Parameter `OPTIONS&#39; should be a structure.&quot;</span>);}
<a name="l00434"></a>00434 
<a name="l00435"></a>00435       <span class="keywordflow">if</span> ( OPTIONS_FIELD = mxGetField(PARS_IN,0,<span class="stringliteral">&quot;maxit&quot;</span>) ){
<a name="l00436"></a>00436         maxit=(int) mxGetScalar(OPTIONS_FIELD);
<a name="l00437"></a>00437         info=<a class="code" href="group__DSDPConverge.html#ga91af478f9316391a35b595b669ad22b3" title="Terminate the solver after this number of iterations.">DSDPSetMaxIts</a>(dsdp,maxit); CHKERR(info);}
<a name="l00438"></a>00438       <span class="keywordflow">if</span> ( OPTIONS_FIELD = mxGetField(PARS_IN,0,<span class="stringliteral">&quot;fastblas&quot;</span>) ){
<a name="l00439"></a>00439         fastblas= (int) mxGetScalar(OPTIONS_FIELD);}
<a name="l00440"></a>00440       <span class="keywordflow">if</span> ( OPTIONS_FIELD = mxGetField(PARS_IN,0,<span class="stringliteral">&quot;print&quot;</span>) ){
<a name="l00441"></a>00441         print_info= (int) mxGetScalar(OPTIONS_FIELD);
<a name="l00442"></a>00442         printlevel=print_info;
<a name="l00443"></a>00443       }
<a name="l00444"></a>00444       <span class="keywordflow">if</span> ( OPTIONS_FIELD = mxGetField(PARS_IN,0,<span class="stringliteral">&quot;bigM&quot;</span>) ){
<a name="l00445"></a>00445         rpos=(int)mxGetScalar(OPTIONS_FIELD);
<a name="l00446"></a>00446         info=<a class="code" href="group__DSDPSolver.html#ga0e47c4779c3d4a036e258a5b4aa890b3" title="Use penalty parameter to enforce feasibility.">DSDPUsePenalty</a>(dsdp,rpos); CHKERR(info);}
<a name="l00447"></a>00447       <span class="keywordflow">if</span> ( OPTIONS_FIELD = mxGetField(PARS_IN,0,<span class="stringliteral">&quot;penalty&quot;</span>) ){
<a name="l00448"></a>00448         penalty=mxGetScalar(OPTIONS_FIELD);
<a name="l00449"></a>00449         info=<a class="code" href="group__DSDPSolver.html#gaaccdf7c94e0296bc83042ba3d4b29c5d" title="Set the penalty parameter Gamma.">DSDPSetPenaltyParameter</a>(dsdp,penalty); CHKERR(info);}
<a name="l00450"></a>00450       <span class="keywordflow">if</span> ( OPTIONS_FIELD = mxGetField(PARS_IN,0,<span class="stringliteral">&quot;rho&quot;</span>) ){
<a name="l00451"></a>00451         rho= mxGetScalar(OPTIONS_FIELD);
<a name="l00452"></a>00452         info=<a class="code" href="group__DSDPSolver.html#ga5d737fca8ae872f57fd37cc7784feede" title="Set the potential parameter.">DSDPSetPotentialParameter</a>(dsdp,rho); CHKERR(info);}
<a name="l00453"></a>00453       <span class="keywordflow">if</span> ( OPTIONS_FIELD = mxGetField(PARS_IN,0,<span class="stringliteral">&quot;dynamicrho&quot;</span>) ){
<a name="l00454"></a>00454         drho= (int)mxGetScalar(OPTIONS_FIELD);
<a name="l00455"></a>00455         info=<a class="code" href="group__DSDPSolver.html#gae48a2eaf3ee6a982cb0c45d512216702" title="Use a dynamic strategy to choose parameter rho.">DSDPUseDynamicRho</a>(dsdp,drho); CHKERR(info);}
<a name="l00456"></a>00456       <span class="keywordflow">if</span> ( OPTIONS_FIELD = mxGetField(PARS_IN,0,<span class="stringliteral">&quot;zbar&quot;</span>) ){
<a name="l00457"></a>00457         zbar= mxGetScalar(OPTIONS_FIELD);
<a name="l00458"></a>00458         info=<a class="code" href="group__DSDPSolver.html#ga2795069b8aaa6551a8c1c248bbb2cb1a" title="Set an upper bound on the objective value at the solution.">DSDPSetZBar</a>(dsdp,zbar); CHKERR(info);}
<a name="l00459"></a>00459       <span class="keywordflow">if</span> ( OPTIONS_FIELD = mxGetField(PARS_IN,0,<span class="stringliteral">&quot;dual_bound&quot;</span>) ){
<a name="l00460"></a>00460         dbound= mxGetScalar(OPTIONS_FIELD);
<a name="l00461"></a>00461         info=<a class="code" href="group__DSDPConverge.html#ga94030b5b04c4ad178282245deb609f78" title="Terminate the solver if the objective value in (DD) is greater than this tolerance.">DSDPSetDualBound</a>(dsdp,dbound); CHKERR(info);}
<a name="l00462"></a>00462       <span class="keywordflow">if</span> ( OPTIONS_FIELD = mxGetField(PARS_IN,0,<span class="stringliteral">&quot;reuse&quot;</span>) ){
<a name="l00463"></a>00463         reuse= (int)mxGetScalar(OPTIONS_FIELD);
<a name="l00464"></a>00464         info=<a class="code" href="group__DSDPSolver.html#ga903ff948f2ba766430ba3918b9447ee7" title="Reuse the Hessian of the barrier function multiple times at each DSDP iteration.">DSDPReuseMatrix</a>(dsdp,reuse); CHKERR(info);}
<a name="l00465"></a>00465       <span class="keywordflow">if</span> ( OPTIONS_FIELD = mxGetField(PARS_IN,0,<span class="stringliteral">&quot;gaptol&quot;</span>) ){
<a name="l00466"></a>00466         gaptol= mxGetScalar(OPTIONS_FIELD);
<a name="l00467"></a>00467         info=<a class="code" href="group__DSDPConverge.html#ga4c0fa6941c40cca7643c2f4a9ae813bf" title="Terminate the solver when the relative duality gap is less than this tolerance.">DSDPSetGapTolerance</a>(dsdp,gaptol);CHKERR(info);}
<a name="l00468"></a>00468       <span class="keywordflow">if</span> ( OPTIONS_FIELD = mxGetField(PARS_IN,0,<span class="stringliteral">&quot;lp_barrier&quot;</span>) ){
<a name="l00469"></a>00469         lpb= mxGetScalar(OPTIONS_FIELD);
<a name="l00470"></a>00470         <span class="keywordflow">if</span> (lpb&lt;0.1) lpb=0.1;
<a name="l00471"></a>00471         <span class="keywordflow">if</span> (lpcone){info=LPConeScaleBarrier(lpcone,lpb); CHKERR(info);}}
<a name="l00472"></a>00472       <span class="keywordflow">if</span> ( OPTIONS_FIELD = mxGetField(PARS_IN,0,<span class="stringliteral">&quot;lpb&quot;</span>) ){
<a name="l00473"></a>00473         lpb= mxGetScalar(OPTIONS_FIELD);
<a name="l00474"></a>00474         <span class="keywordflow">if</span> (lpb&lt;0.1) lpb=0.1;
<a name="l00475"></a>00475         <span class="keywordflow">if</span> (lpcone){info=LPConeScaleBarrier(lpcone,lpb); CHKERR(info);}}
<a name="l00476"></a>00476       <span class="keywordflow">if</span> ( OPTIONS_FIELD = mxGetField(PARS_IN,0,<span class="stringliteral">&quot;cc&quot;</span>) ){
<a name="l00477"></a>00477         cc= mxGetScalar(OPTIONS_FIELD);
<a name="l00478"></a>00478         info=<a class="code" href="group__DSDPSolution.html#ga28afa903396794d56ca26eea4b284e85" title="Add a constant to the objective.">DSDPAddObjectiveConstant</a>(dsdp,cc); CHKERR(info);}
<a name="l00479"></a>00479       <span class="keywordflow">if</span> ( OPTIONS_FIELD = mxGetField(PARS_IN,0,<span class="stringliteral">&quot;inftol&quot;</span>) ){
<a name="l00480"></a>00480         inftol= mxGetScalar(OPTIONS_FIELD);
<a name="l00481"></a>00481         info=<a class="code" href="group__DSDPConverge.html#ga8fa9a4a362aaa64e12538a55f215e8ce" title="Classify (D) as feasible only if the variable r is less than this tolerance.">DSDPSetRTolerance</a>(dsdp,inftol); CHKERR(info);}
<a name="l00482"></a>00482       <span class="keywordflow">if</span> ( OPTIONS_FIELD = mxGetField(PARS_IN,0,<span class="stringliteral">&quot;infptol&quot;</span>) ){
<a name="l00483"></a>00483         infptol= mxGetScalar(OPTIONS_FIELD);
<a name="l00484"></a>00484         info=<a class="code" href="group__DSDPConverge.html#gad0a3f0df89bd8b3e4b7fb1f6c738d330" title="Classify (P) as feasible only if the infeasibility is less than this tolerance.">DSDPSetPTolerance</a>(dsdp,infptol);CHKERR(info);}
<a name="l00485"></a>00485       <span class="keywordflow">if</span> ( OPTIONS_FIELD = mxGetField(PARS_IN,0,<span class="stringliteral">&quot;pnormtol&quot;</span>) ){
<a name="l00486"></a>00486         pnormtol= mxGetScalar(OPTIONS_FIELD);
<a name="l00487"></a>00487         info=<a class="code" href="group__DSDPConverge.html#ga56d725fd1a7e14c5294cb292c998193e" title="Terminate the solver when the relative duality gap is suffiently small and the PNorm is less than thi...">DSDPSetPNormTolerance</a>(dsdp,pnormtol);CHKERR(info);}
<a name="l00488"></a>00488       <span class="keywordflow">if</span> ( OPTIONS_FIELD = mxGetField(PARS_IN,0,<span class="stringliteral">&quot;boundy&quot;</span>) ){
<a name="l00489"></a>00489         yhigh= fabs(mxGetScalar(OPTIONS_FIELD)); ylow=-yhigh;
<a name="l00490"></a>00490         info=<a class="code" href="group__DSDPSolver.html#gad73a74d9d294e87b58ad3a7e939a43ad" title="Bound the variables y.">DSDPSetYBounds</a>(dsdp,ylow,yhigh);CHKERR(info);}
<a name="l00491"></a>00491       <span class="keywordflow">if</span> ( OPTIONS_FIELD = mxGetField(PARS_IN,0,<span class="stringliteral">&quot;r0&quot;</span>) ){
<a name="l00492"></a>00492         r0= mxGetScalar(OPTIONS_FIELD); 
<a name="l00493"></a>00493         info=<a class="code" href="group__DSDPSolution.html#ga846e363115b1fba5622306efc2e0ba38" title="Set an initial value for the variable r in (DD)">DSDPSetR0</a>(dsdp,r0); CHKERR(info);}
<a name="l00494"></a>00494       <span class="keywordflow">if</span> ( OPTIONS_FIELD = mxGetField(PARS_IN,0,<span class="stringliteral">&quot;mu0&quot;</span>) ){
<a name="l00495"></a>00495         mu0=mxGetScalar(OPTIONS_FIELD);
<a name="l00496"></a>00496         info=<a class="code" href="group__DSDPSolver.html#ga4bcfff950e84b1e925ae99202f23282a" title="Set the current barrier parameter.">DSDPSetBarrierParameter</a>(dsdp,mu0);CHKERR(info);}
<a name="l00497"></a>00497       <span class="keywordflow">if</span> ( OPTIONS_FIELD = mxGetField(PARS_IN,0,<span class="stringliteral">&quot;maxtrustradius&quot;</span>)){
<a name="l00498"></a>00498         maxtrust= mxGetScalar(OPTIONS_FIELD);
<a name="l00499"></a>00499         info=<a class="code" href="group__DSDPSolver.html#gacc8b2a85ea20d548fcff54f5161bc3d5" title="Set a maximum trust radius on the step direction.">DSDPSetMaxTrustRadius</a>(dsdp,maxtrust); CHKERR(info);}
<a name="l00500"></a>00500       <span class="keywordflow">if</span> ( OPTIONS_FIELD = mxGetField(PARS_IN,0,<span class="stringliteral">&quot;steptol&quot;</span>) ){
<a name="l00501"></a>00501         steptol = mxGetScalar(OPTIONS_FIELD);
<a name="l00502"></a>00502         info=<a class="code" href="group__DSDPConverge.html#ga8ae6cff50eca02c3452fa92ae0fea2ec" title="Terminate the solver if the step length in (DD) is below this tolerance.">DSDPSetStepTolerance</a>(dsdp,steptol); CHKERR(info);}
<a name="l00503"></a>00503       <span class="keywordflow">if</span> ( OPTIONS_FIELD = mxGetField(PARS_IN,0,<span class="stringliteral">&quot;dobjmin&quot;</span>) ){
<a name="l00504"></a>00504         dtmp= mxGetScalar(OPTIONS_FIELD);
<a name="l00505"></a>00505         info = DSDPSetDualLowerBound(dsdp,dtmp);}
<a name="l00506"></a>00506       <span class="keywordflow">if</span> ( OPTIONS_FIELD = mxGetField(PARS_IN,0,<span class="stringliteral">&quot;dloginfo&quot;</span>) ){
<a name="l00507"></a>00507         iloginfo= (int) mxGetScalar(OPTIONS_FIELD);
<a name="l00508"></a>00508         info=DSDPLogInfoAllow(iloginfo,0);}
<a name="l00509"></a>00509       <span class="keywordflow">if</span> ( OPTIONS_FIELD = mxGetField(PARS_IN,0,<span class="stringliteral">&quot;logtime&quot;</span>) ){
<a name="l00510"></a>00510         printsummary= (int) mxGetScalar(OPTIONS_FIELD);}
<a name="l00511"></a>00511       <span class="keywordflow">if</span> ( OPTIONS_FIELD = mxGetField(PARS_IN,0,<span class="stringliteral">&quot;printproblem&quot;</span>) ){
<a name="l00512"></a>00512         info=<a class="code" href="group__Examples.html#ga3407a19db2d6789625316f4194072ff3" title="Print data in SDPA format to a file named &quot;output.sdpa&quot;.">DSDPPrintData</a>(dsdp,sdpcone,lpcone);}
<a name="l00513"></a>00513       <span class="keywordflow">if</span> ( OPTIONS_FIELD = mxGetField(PARS_IN,0,<span class="stringliteral">&quot;xmaker&quot;</span>) ){
<a name="l00514"></a>00514         xmaker = (int) mxGetScalar(OPTIONS_FIELD);}
<a name="l00515"></a>00515       <span class="comment">/*</span>
<a name="l00516"></a>00516 <span class="comment">        if( OPTIONS_FIELD = mxGetField(PARS_IN,0,&quot;maxlanczos&quot;) ){</span>
<a name="l00517"></a>00517 <span class="comment">        itmp= (int) mxGetScalar(OPTIONS_FIELD);</span>
<a name="l00518"></a>00518 <span class="comment">        info=DSDPSetLanczosIterations(dsdp,itmp);}</span>
<a name="l00519"></a>00519 <span class="comment">      */</span>
<a name="l00520"></a>00520       
<a name="l00521"></a>00521   }
<a name="l00522"></a>00522 
<a name="l00523"></a>00523   info = <a class="code" href="group__DSDPSolver.html#ga888dd07a4f1c8def3f1708582baa07a4" title="Monitor each iteration of the solver.">DSDPSetMonitor</a>(dsdp,DSDPPrintStats2,0); CHKERR(info);
<a name="l00524"></a>00524 
<a name="l00525"></a>00525   info = <a class="code" href="group__DSDPBasic.html#ga2bd311ea1ecad8f690255b8a35f694a0" title="Set up data structures in the solver and the cones associated with it.">DSDPSetup</a>(dsdp);
<a name="l00526"></a>00526   <span class="keywordflow">if</span> (info){
<a name="l00527"></a>00527     mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: Setup Error, Probably out of memory&quot;</span>);}
<a name="l00528"></a>00528 
<a name="l00529"></a>00529 
<a name="l00530"></a>00530   info = <a class="code" href="group__DSDPBasic.html#gabf7f1440bad5dd2a609288912743c8e9" title="Apply DSDP to the problem.">DSDPSolve</a>(dsdp); CHKERR(info);
<a name="l00531"></a>00531   info = <a class="code" href="group__DSDPConverge.html#ga637bf541e030c5aef4d436a9792714a2" title="Copy the reason why the solver terminated.">DSDPStopReason</a>(dsdp,&amp;reason); 
<a name="l00532"></a>00532   <span class="keywordflow">if</span> (reason!=<a class="code" href="dsdpbasictypes_8h.html#a2a68c4cccb1289043bf9b59a58f55b3aa7f8800e949dce9fa0f5e41b9bca69e02">DSDP_INFEASIBLE_START</a>){
<a name="l00533"></a>00533     info=<a class="code" href="group__DSDPBasic.html#gacd271769549030ce365597101946220b" title="Compute the X variables.">DSDPComputeX</a>(dsdp);CHKERR(info);
<a name="l00534"></a>00534   }
<a name="l00535"></a>00535   info = <a class="code" href="group__DSDPBasic.html#ga33e05559ab15ea40b1e9b31ecc206b3e" title="Solutions can be bounded, infeasible, or unbounded.">DSDPGetSolutionType</a>(dsdp,&amp;pdfeasible);  CHKERR(info);
<a name="l00536"></a>00536 
<a name="l00537"></a>00537   <span class="keywordflow">if</span> (printsummary){ DSDPEventLogSummary();}
<a name="l00538"></a>00538 
<a name="l00539"></a>00539   <span class="keywordflow">if</span> (info){
<a name="l00540"></a>00540     mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: Numerical error&quot;</span>);}
<a name="l00541"></a>00541 
<a name="l00542"></a>00542   <span class="keywordflow">if</span> ( reason == <a class="code" href="dsdpbasictypes_8h.html#a2a68c4cccb1289043bf9b59a58f55b3aa7f8800e949dce9fa0f5e41b9bca69e02">DSDP_INFEASIBLE_START</a>){
<a name="l00543"></a>00543     mexErrMsgTxt(<span class="stringliteral">&quot;DSDP Terminated Due to Infeasible Starting Point\n&quot;</span>);
<a name="l00544"></a>00544   } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (print_info){
<a name="l00545"></a>00545 
<a name="l00546"></a>00546     <span class="keywordflow">if</span> (reason == <a class="code" href="dsdpbasictypes_8h.html#a2a68c4cccb1289043bf9b59a58f55b3aa9d1d9628ba1a342cc5403338bc84ae6b">DSDP_CONVERGED</a>)
<a name="l00547"></a>00547       mexPrintf(<span class="stringliteral">&quot;DSDP Converged. \n&quot;</span>);
<a name="l00548"></a>00548     <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( reason == <a class="code" href="dsdpbasictypes_8h.html#a2a68c4cccb1289043bf9b59a58f55b3aa3cf44a69251d45275e6c6564f08b3e08">DSDP_UPPERBOUND</a> )
<a name="l00549"></a>00549       mexPrintf(<span class="stringliteral">&quot;DSDP Converged: Dual Objective exceeds its bound\n&quot;</span>);
<a name="l00550"></a>00550     <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( reason == <a class="code" href="dsdpbasictypes_8h.html#a2a68c4cccb1289043bf9b59a58f55b3aaaae024f404b3e21b95c40583917f1c5f">DSDP_SMALL_STEPS</a> )
<a name="l00551"></a>00551       mexPrintf(<span class="stringliteral">&quot;DSDP Terminated Due to Small Steps\n&quot;</span>);
<a name="l00552"></a>00552     <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( reason == <a class="code" href="dsdpbasictypes_8h.html#a2a68c4cccb1289043bf9b59a58f55b3aa2bf71cc572ec2d45e18e8182a6341854">DSDP_MAX_IT</a>)
<a name="l00553"></a>00553       mexPrintf(<span class="stringliteral">&quot;DSDP Terminated Due Maximum Number of Iterations\n&quot;</span>);
<a name="l00554"></a>00554     <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( reason == <a class="code" href="dsdpbasictypes_8h.html#a2a68c4cccb1289043bf9b59a58f55b3aa1b8a1f02bbca1c2d6105f2ba408fa7b4">DSDP_USER_TERMINATION</a>)
<a name="l00555"></a>00555       mexPrintf(<span class="stringliteral">&quot;DSDP Terminated By User\n&quot;</span>);
<a name="l00556"></a>00556     <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( reason == <a class="code" href="dsdpbasictypes_8h.html#a2a68c4cccb1289043bf9b59a58f55b3aa7f8800e949dce9fa0f5e41b9bca69e02">DSDP_INFEASIBLE_START</a>)
<a name="l00557"></a>00557       mexPrintf(<span class="stringliteral">&quot;DSDP Terminated Due to Infeasible Starting Point\n&quot;</span>);
<a name="l00558"></a>00558     <span class="keywordflow">else</span> 
<a name="l00559"></a>00559       mexPrintf(<span class="stringliteral">&quot;DSDP Finished.\n&quot;</span>);
<a name="l00560"></a>00560   }
<a name="l00561"></a>00561 
<a name="l00562"></a>00562   <span class="keywordflow">if</span> (pdfeasible==<a class="code" href="dsdpbasictypes_8h.html#a7c124046b4ddae3d637157242af2df90a0008f194b20fc02f61eca61fab25ed05">DSDP_UNBOUNDED</a>){
<a name="l00563"></a>00563     mexPrintf(<span class="stringliteral">&quot;DSDP: Dual Unbounded, Primal Infeasible\n&quot;</span>);
<a name="l00564"></a>00564   } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (pdfeasible==<a class="code" href="dsdpbasictypes_8h.html#a7c124046b4ddae3d637157242af2df90abb5750f090ec5d7e1d8c1aead6565a52">DSDP_INFEASIBLE</a>){
<a name="l00565"></a>00565     mexPrintf(<span class="stringliteral">&quot;DSDP: Primal Unbounded, Dual Infeasible\n&quot;</span>);
<a name="l00566"></a>00566   }
<a name="l00567"></a>00567 
<a name="l00568"></a>00568   <span class="comment">/* Set the dual solution */</span>  
<a name="l00569"></a>00569   yout=mxGetPr(Y_OUT);
<a name="l00570"></a>00570   info = <a class="code" href="group__DSDPBasic.html#ga816a784dde863f6a35a2f5d8786a3441" title="Copies the variables y into an array.">DSDPGetY</a>(dsdp,yout,nvars); CHKERR(info);
<a name="l00571"></a>00571   <span class="keywordflow">if</span> (info){
<a name="l00572"></a>00572     mexErrMsgTxt(<span class="stringliteral">&quot;DSDP: Numerical error&quot;</span>);}
<a name="l00573"></a>00573   
<a name="l00574"></a>00574   
<a name="l00575"></a>00575   <span class="comment">/* Output statistics */</span>
<a name="l00576"></a>00576   <span class="keywordflow">if</span> (STAT_OUT != NULL) mxDestroyArray(STAT_OUT) ;
<a name="l00577"></a>00577   subs[0] = 1;  subs[1] = 1;
<a name="l00578"></a>00578   STAT_OUT = mxCreateStructArray(2,subs,nfields,fnames);
<a name="l00579"></a>00579   info= <a class="code" href="group__DSDPSolution.html#ga2752cf39e1774945b484bddf7c2a5ef2" title="Copy the objective value (D).">DSDPGetDObjective</a>(dsdp,&amp;dobj);  CHKERR(info);
<a name="l00580"></a>00580   info= <a class="code" href="group__DSDPSolution.html#ga0126bd2c9da5d8a7ca0806bd8dd8e56f" title="Copy the objective value (P).">DSDPGetPObjective</a>(dsdp,&amp;pobj);  CHKERR(info);
<a name="l00581"></a>00581   info= <a class="code" href="group__DSDPSolution.html#gacfa8e29ecd7eaaeb6a4e31eb07961de3" title="Copy the infeasibility in (D), or the variable r in (DD).">DSDPGetR</a>(dsdp,&amp;dinf);  CHKERR(info);
<a name="l00582"></a>00582   info= <a class="code" href="group__DSDPConverge.html#ga637bf541e030c5aef4d436a9792714a2" title="Copy the reason why the solver terminated.">DSDPStopReason</a>(dsdp,&amp;reason);  CHKERR(info);
<a name="l00583"></a>00583   info= <a class="code" href="group__DSDPConverge.html#gaaeaa2ec0c50c43f4499aaffea692ede8" title="Copy the current iteration number.">DSDPGetIts</a>(dsdp,&amp;its);  CHKERR(info);
<a name="l00584"></a>00584   info= <a class="code" href="group__DSDPSolver.html#ga05f1269e817495e448ffa8ae3a4012cf" title="Copy the current barrier parameter.">DSDPGetBarrierParameter</a>(dsdp,&amp;mu); CHKERR(info);
<a name="l00585"></a>00585   info= <a class="code" href="group__DSDPSolution.html#gadf4655c90ede45912f2e4ce7f4475cad" title="Copy the step sizes in the current iteration.">DSDPGetStepLengths</a>(dsdp,&amp;pstep,&amp;dstep); CHKERR(info);
<a name="l00586"></a>00586   info= <a class="code" href="group__DSDPSolution.html#gaaa2bb03bf7a025936b1d2cd619327a49" title="Copy the proximity of the solution to the central path.">DSDPGetPnorm</a>(dsdp,&amp;pnorm); CHKERR(info);
<a name="l00587"></a>00587   info= <a class="code" href="group__DSDPSolver.html#ga05f1269e817495e448ffa8ae3a4012cf" title="Copy the current barrier parameter.">DSDPGetBarrierParameter</a>(dsdp,&amp;mu); CHKERR(info);
<a name="l00588"></a>00588   info= <a class="code" href="group__DSDPSolver.html#gaeb2f494ff50c552de67a02bf68f7b47e" title="Copy the bounds on the variables y.">DSDPGetYBounds</a>(dsdp,&amp;ylow,&amp;yhigh); CHKERR(info);
<a name="l00589"></a>00589 
<a name="l00590"></a>00590   <span class="keywordflow">if</span> (pdfeasible==<a class="code" href="dsdpbasictypes_8h.html#a7c124046b4ddae3d637157242af2df90a0008f194b20fc02f61eca61fab25ed05">DSDP_UNBOUNDED</a>){
<a name="l00591"></a>00591     STAT_FIELD = mxCreateString(<span class="stringliteral">&quot;Unbounded&quot;</span>);
<a name="l00592"></a>00592     mxSetField(STAT_OUT,0,fnames[0],STAT_FIELD);
<a name="l00593"></a>00593   } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (pdfeasible==<a class="code" href="dsdpbasictypes_8h.html#a7c124046b4ddae3d637157242af2df90abb5750f090ec5d7e1d8c1aead6565a52">DSDP_INFEASIBLE</a>){
<a name="l00594"></a>00594     STAT_FIELD = mxCreateString(<span class="stringliteral">&quot;Infeasible&quot;</span>);
<a name="l00595"></a>00595     mxSetField(STAT_OUT,0,fnames[0],STAT_FIELD);
<a name="l00596"></a>00596   } <span class="keywordflow">else</span> {
<a name="l00597"></a>00597     STAT_FIELD = mxCreateString(<span class="stringliteral">&quot;PDFeasible&quot;</span>);
<a name="l00598"></a>00598     mxSetField(STAT_OUT,0,fnames[0],STAT_FIELD);
<a name="l00599"></a>00599   }
<a name="l00600"></a>00600 
<a name="l00601"></a>00601   STAT_FIELD = mxCreateDoubleMatrix(1, 1, mxREAL) ;
<a name="l00602"></a>00602   stat=mxGetPr(STAT_FIELD); stat[0]=dobj;
<a name="l00603"></a>00603   mxSetField(STAT_OUT,0,fnames[1],STAT_FIELD);
<a name="l00604"></a>00604 
<a name="l00605"></a>00605   STAT_FIELD = mxCreateDoubleMatrix(1, 1, mxREAL) ;
<a name="l00606"></a>00606   stat=mxGetPr(STAT_FIELD); stat[0]=pobj;
<a name="l00607"></a>00607   mxSetField(STAT_OUT,0,fnames[2],STAT_FIELD);
<a name="l00608"></a>00608   
<a name="l00609"></a>00609   STAT_FIELD = mxCreateDoubleMatrix(1, 1, mxREAL) ;
<a name="l00610"></a>00610   stat=mxGetPr(STAT_FIELD); stat[0]=dobj;
<a name="l00611"></a>00611   mxSetField(STAT_OUT,0,fnames[3],STAT_FIELD);
<a name="l00612"></a>00612 
<a name="l00613"></a>00613   <span class="keywordflow">if</span> (reason==<a class="code" href="dsdpbasictypes_8h.html#a2a68c4cccb1289043bf9b59a58f55b3aa9d1d9628ba1a342cc5403338bc84ae6b">DSDP_CONVERGED</a>){
<a name="l00614"></a>00614     STAT_FIELD = mxCreateDoubleMatrix(1, 1, mxREAL) ;
<a name="l00615"></a>00615     stat=mxGetPr(STAT_FIELD); stat[0]=0;
<a name="l00616"></a>00616     mxSetField(STAT_OUT,0,fnames[4],STAT_FIELD);
<a name="l00617"></a>00617   } <span class="keywordflow">else</span> {
<a name="l00618"></a>00618     STAT_FIELD = mxCreateDoubleMatrix(1, 1, mxREAL) ;
<a name="l00619"></a>00619     stat=mxGetPr(STAT_FIELD); stat[0]=(double)reason;
<a name="l00620"></a>00620     <span class="keywordflow">if</span> (stat[0]==0) stat[0]=-1;
<a name="l00621"></a>00621     mxSetField(STAT_OUT,0,fnames[4],STAT_FIELD);
<a name="l00622"></a>00622   }
<a name="l00623"></a>00623   
<a name="l00624"></a>00624   <span class="keywordflow">if</span> (reason==<a class="code" href="dsdpbasictypes_8h.html#a2a68c4cccb1289043bf9b59a58f55b3aa9d1d9628ba1a342cc5403338bc84ae6b">DSDP_CONVERGED</a>){ <span class="comment">/* For YALMIP */</span>
<a name="l00625"></a>00625     STAT_FIELD = mxCreateDoubleMatrix(1, 1, mxREAL) ;
<a name="l00626"></a>00626     stat=mxGetPr(STAT_FIELD); stat[0]=0;
<a name="l00627"></a>00627     <span class="keywordflow">if</span> (pdfeasible==<a class="code" href="dsdpbasictypes_8h.html#a7c124046b4ddae3d637157242af2df90a0008f194b20fc02f61eca61fab25ed05">DSDP_UNBOUNDED</a>){ stat[0]=1;} 
<a name="l00628"></a>00628     <span class="keywordflow">if</span> (pdfeasible==<a class="code" href="dsdpbasictypes_8h.html#a7c124046b4ddae3d637157242af2df90abb5750f090ec5d7e1d8c1aead6565a52">DSDP_INFEASIBLE</a>){ stat[0]=2;}
<a name="l00629"></a>00629     mxSetField(STAT_OUT,0,fnames[5],STAT_FIELD);
<a name="l00630"></a>00630   } <span class="keywordflow">else</span> {
<a name="l00631"></a>00631     STAT_FIELD = mxCreateDoubleMatrix(1, 1, mxREAL) ;
<a name="l00632"></a>00632     stat=mxGetPr(STAT_FIELD); stat[0]=-1;
<a name="l00633"></a>00633     <span class="keywordflow">if</span> (reason==<a class="code" href="dsdpbasictypes_8h.html#a2a68c4cccb1289043bf9b59a58f55b3aa7f8800e949dce9fa0f5e41b9bca69e02">DSDP_INFEASIBLE_START</a>)stat[0]=-6;
<a name="l00634"></a>00634     <span class="keywordflow">if</span> (reason==<a class="code" href="dsdpbasictypes_8h.html#a2a68c4cccb1289043bf9b59a58f55b3aa3cf44a69251d45275e6c6564f08b3e08">DSDP_UPPERBOUND</a>)stat[0]=-5;
<a name="l00635"></a>00635     <span class="keywordflow">if</span> (reason==<a class="code" href="dsdpbasictypes_8h.html#a2a68c4cccb1289043bf9b59a58f55b3aa2bf71cc572ec2d45e18e8182a6341854">DSDP_MAX_IT</a>)stat[0]=-3;
<a name="l00636"></a>00636     mxSetField(STAT_OUT,0,fnames[5],STAT_FIELD);
<a name="l00637"></a>00637   }
<a name="l00638"></a>00638 
<a name="l00639"></a>00639   STAT_FIELD = mxCreateDoubleMatrix(1, 1, mxREAL) ;
<a name="l00640"></a>00640   stat=mxGetPr(STAT_FIELD); stat[0]=(double) its;
<a name="l00641"></a>00641   mxSetField(STAT_OUT,0,fnames[6],STAT_FIELD);
<a name="l00642"></a>00642   
<a name="l00643"></a>00643   STAT_FIELD = mxCreateDoubleMatrix(1, 1, mxREAL) ;
<a name="l00644"></a>00644   stat=mxGetPr(STAT_FIELD); stat[0]=dinf;
<a name="l00645"></a>00645   mxSetField(STAT_OUT,0,fnames[7],STAT_FIELD);
<a name="l00646"></a>00646     
<a name="l00647"></a>00647   STAT_FIELD = mxCreateDoubleMatrix(1, 1, mxREAL) ;
<a name="l00648"></a>00648   stat=mxGetPr(STAT_FIELD); stat[0]=mu;
<a name="l00649"></a>00649   mxSetField(STAT_OUT,0,fnames[8],STAT_FIELD);
<a name="l00650"></a>00650   
<a name="l00651"></a>00651   STAT_FIELD = mxCreateDoubleMatrix(1, 1, mxREAL) ;
<a name="l00652"></a>00652   stat=mxGetPr(STAT_FIELD); stat[0]=pstep;
<a name="l00653"></a>00653   mxSetField(STAT_OUT,0,fnames[9],STAT_FIELD);
<a name="l00654"></a>00654   
<a name="l00655"></a>00655   STAT_FIELD = mxCreateDoubleMatrix(1, 1, mxREAL) ;
<a name="l00656"></a>00656   stat=mxGetPr(STAT_FIELD); stat[0]=dstep;
<a name="l00657"></a>00657   mxSetField(STAT_OUT,0,fnames[10],STAT_FIELD);
<a name="l00658"></a>00658   
<a name="l00659"></a>00659   STAT_FIELD = mxCreateDoubleMatrix(1, 1, mxREAL) ;
<a name="l00660"></a>00660   stat=mxGetPr(STAT_FIELD); stat[0]=pnorm;
<a name="l00661"></a>00661   mxSetField(STAT_OUT,0,fnames[11],STAT_FIELD);
<a name="l00662"></a>00662   
<a name="l00663"></a>00663   itmp=100; <span class="keywordflow">if</span> (its &lt; itmp) itmp=its;
<a name="l00664"></a>00664   STAT_FIELD = mxCreateDoubleMatrix(itmp, 1, mxREAL) ;
<a name="l00665"></a>00665   stat=mxGetPr(STAT_FIELD); 
<a name="l00666"></a>00666   info= <a class="code" href="group__DSDPConverge.html#ga7c5018d2263675ce962dedc787155ed1" title="Copy a history of the duality gap into an array.">DSDPGetGapHistory</a>(dsdp,stat,itmp);  CHKERR(info);
<a name="l00667"></a>00667   mxSetField(STAT_OUT,0,fnames[12],STAT_FIELD);
<a name="l00668"></a>00668   
<a name="l00669"></a>00669   STAT_FIELD = mxCreateDoubleMatrix(itmp, 1, mxREAL) ;
<a name="l00670"></a>00670   stat=mxGetPr(STAT_FIELD); 
<a name="l00671"></a>00671   info= <a class="code" href="group__DSDPConverge.html#ga00cf375a40281f6f8a1b9bdfee7a6ff1" title="Copy a history of the infeasibility in (D) into an array.">DSDPGetRHistory</a>(dsdp,stat,itmp);  CHKERR(info);
<a name="l00672"></a>00672   mxSetField(STAT_OUT,0,fnames[13],STAT_FIELD);
<a name="l00673"></a>00673 
<a name="l00674"></a>00674   STAT_FIELD = mxCreateDoubleMatrix(6, 1, mxREAL) ;
<a name="l00675"></a>00675   stat=mxGetPr(STAT_FIELD); 
<a name="l00676"></a>00676   info = <a class="code" href="group__DSDPSolution.html#ga563ea95890673182c1de4252cf3e5309" title="Copy six different error measurements into an array.">DSDPGetFinalErrors</a>(dsdp,stat);  CHKERR(info);
<a name="l00677"></a>00677   mxSetField(STAT_OUT,0,fnames[14],STAT_FIELD);
<a name="l00678"></a>00678 
<a name="l00679"></a>00679   STAT_FIELD = mxCreateDoubleMatrix(3, 1, mxREAL) ;
<a name="l00680"></a>00680   stat=mxGetPr(STAT_FIELD); 
<a name="l00681"></a>00681   info = <a class="code" href="group__DSDPSolution.html#gae103a4b863adc10f37d2eda9f94a982b" title="Copy the norms of the data C, A, and b into an array.">DSDPGetDataNorms</a>(dsdp,stat);  CHKERR(info);
<a name="l00682"></a>00682   dtmp=stat[0];stat[0]=stat[1];stat[1]=dtmp;
<a name="l00683"></a>00683   mxSetField(STAT_OUT,0,fnames[15],STAT_FIELD);
<a name="l00684"></a>00684 
<a name="l00685"></a>00685   STAT_FIELD = mxCreateDoubleMatrix(1, 1, mxREAL) ;
<a name="l00686"></a>00686   stat=mxGetPr(STAT_FIELD); 
<a name="l00687"></a>00687   info = <a class="code" href="group__DSDPSolution.html#ga1a3be937e209108fe9acd088508feb95" title="Copy the the infinity norm of the variables y.">DSDPGetYMaxNorm</a>(dsdp,stat);  CHKERR(info);
<a name="l00688"></a>00688   mxSetField(STAT_OUT,0,fnames[16],STAT_FIELD);
<a name="l00689"></a>00689 
<a name="l00690"></a>00690   STAT_FIELD = mxCreateDoubleMatrix(1, 1, mxREAL) ;
<a name="l00691"></a>00691   stat=mxGetPr(STAT_FIELD); 
<a name="l00692"></a>00692   stat[0]=yhigh;
<a name="l00693"></a>00693   mxSetField(STAT_OUT,0,fnames[17],STAT_FIELD);
<a name="l00694"></a>00694 
<a name="l00695"></a>00695   STAT_FIELD = mxCreateDoubleMatrix(1, 1, mxREAL) ;
<a name="l00696"></a>00696   stat=mxGetPr(STAT_FIELD); 
<a name="l00697"></a>00697   info = <a class="code" href="group__DSDPSolver.html#gae27461735f62031b5fd794672b026b78" title="Copy the penalty parameter Gamma.">DSDPGetPenaltyParameter</a>(dsdp,stat);  CHKERR(info);
<a name="l00698"></a>00698   mxSetField(STAT_OUT,0,fnames[18],STAT_FIELD);
<a name="l00699"></a>00699 
<a name="l00700"></a>00700   STAT_FIELD = mxCreateDoubleMatrix(1, 1, mxREAL) ;
<a name="l00701"></a>00701   stat=mxGetPr(STAT_FIELD); 
<a name="l00702"></a>00702   info = <a class="code" href="group__DSDPSolution.html#ga2580bcdac912b6477f067a8ccbc801bc" title="Copy the trace of the variables X in (P).">DSDPGetTraceX</a>(dsdp,stat);  CHKERR(info);
<a name="l00703"></a>00703   mxSetField(STAT_OUT,0,fnames[19],STAT_FIELD);
<a name="l00704"></a>00704 
<a name="l00705"></a>00705   STAT_FIELD = mxCreateDoubleMatrix(1, 1, mxREAL) ;
<a name="l00706"></a>00706   info = <a class="code" href="group__DSDPSolver.html#gaf45e1f4f8329adb347b476d183d35885" title="Copy this parameter.">DSDPGetReuseMatrix</a>(dsdp,&amp;its);  CHKERR(info);
<a name="l00707"></a>00707   stat=mxGetPr(STAT_FIELD); stat[0]=(double) its;
<a name="l00708"></a>00708   mxSetField(STAT_OUT,0,fnames[20],STAT_FIELD);
<a name="l00709"></a>00709   
<a name="l00710"></a>00710   STAT_FIELD = mxCreateDoubleMatrix(1, 1, mxREAL) ;
<a name="l00711"></a>00711   stat=mxGetPr(STAT_FIELD); 
<a name="l00712"></a>00712   info = <a class="code" href="group__DSDPSolver.html#ga0cc2e91620e27338d0a508d60f8761ce" title="Copy the potential parameter.">DSDPGetPotentialParameter</a>(dsdp,stat);  CHKERR(info);
<a name="l00713"></a>00713   mxSetField(STAT_OUT,0,fnames[21],STAT_FIELD);
<a name="l00714"></a>00714 
<a name="l00715"></a>00715   <span class="keywordflow">if</span> (xmaker){
<a name="l00716"></a>00716     STAT_FIELD = mxCreateDoubleMatrix(nvars+1, 1, mxREAL) ;
<a name="l00717"></a>00717     stat=mxGetPr(STAT_FIELD); 
<a name="l00718"></a>00718     info = <a class="code" href="group__DSDPSolver.html#gaedd5042b277efcd2774898fbf3bdd860" title="Copies the variables y used to construct X into an array.">DSDPGetYMakeX</a>(dsdp,stat,nvars+1);  CHKERR(info);
<a name="l00719"></a>00719     mxSetField(STAT_OUT,0,fnames[22],STAT_FIELD);
<a name="l00720"></a>00720 
<a name="l00721"></a>00721     STAT_FIELD = mxCreateDoubleMatrix(nvars+1, 1, mxREAL) ;
<a name="l00722"></a>00722     stat=mxGetPr(STAT_FIELD); 
<a name="l00723"></a>00723     info = <a class="code" href="group__DSDPSolver.html#ga79f8ff912fa519dea6ad93f06518b544" title="Copies the variables dy used to construct X into an array.">DSDPGetDYMakeX</a>(dsdp,stat,nvars+1);  CHKERR(info);
<a name="l00724"></a>00724     mxSetField(STAT_OUT,0,fnames[23],STAT_FIELD);
<a name="l00725"></a>00725 
<a name="l00726"></a>00726     STAT_FIELD = mxCreateDoubleMatrix(1, 1, mxREAL) ;
<a name="l00727"></a>00727     stat=mxGetPr(STAT_FIELD); 
<a name="l00728"></a>00728     info = <a class="code" href="group__DSDPSolver.html#ga44ba54bc182256482af4ca016c60e435" title="Copies the value of mu used to construct X.">DSDPGetMuMakeX</a>(dsdp,stat);  CHKERR(info);
<a name="l00729"></a>00729     mxSetField(STAT_OUT,0,fnames[24],STAT_FIELD);
<a name="l00730"></a>00730   }
<a name="l00731"></a>00731   <span class="comment">/* Free internal data structure */</span>
<a name="l00732"></a>00732 
<a name="l00733"></a>00733   info = <a class="code" href="group__DSDPBasic.html#ga3242b32d5e9c5e5358da5f79ae5d08dd" title="Free the internal data structures of the solver and the cones associated with it.">DSDPDestroy</a>(dsdp); CHKERR(info);
<a name="l00734"></a>00734 
<a name="l00735"></a>00735   <span class="keywordflow">return</span>;
<a name="l00736"></a>00736 } <span class="comment">/* main */</span>
<a name="l00737"></a>00737   
<a name="l00738"></a>00738 
<a name="l00739"></a>00739 
<a name="l00740"></a>00740 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00741"></a>00741 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;CheckForConstantMat&quot;</span>
<a name="l00742"></a>00742 <span class="preprocessor"></span><span class="keyword">static</span> <span class="keywordtype">int</span> CheckForConstantMat(<span class="keywordtype">double</span>*v,<span class="keywordtype">int</span> nnz, <span class="keywordtype">int</span> n){
<a name="l00743"></a>00743   <span class="keywordtype">int</span> i;<span class="keywordtype">double</span> vv;
<a name="l00744"></a>00744   <span class="keywordflow">if</span> (n&lt;=1){ <span class="keywordflow">return</span> 0; }
<a name="l00745"></a>00745   <span class="keywordflow">if</span> (nnz!=(n*n+n)/2){ <span class="keywordflow">return</span> 0; }
<a name="l00746"></a>00746   <span class="keywordflow">for</span> (vv=v[0],i=1;i&lt;nnz;i++){
<a name="l00747"></a>00747     <span class="keywordflow">if</span> (v[i]!=vv){ <span class="keywordflow">return</span> 0;}
<a name="l00748"></a>00748   }
<a name="l00749"></a>00749   <span class="keywordflow">return</span> 1;
<a name="l00750"></a>00750 }
<a name="l00751"></a>00751 
<a name="l00752"></a>00752 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00753"></a>00753 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;CountNonzeroMatrices&quot;</span>
<a name="l00754"></a>00754 <span class="preprocessor"></span> <span class="keyword">static</span> <span class="keywordtype">int</span> CountNonzeroMatrices(<span class="keywordtype">double</span> *blocksize, <span class="keywordtype">int</span> nblocks, <span class="keywordtype">int</span> block, <span class="keywordtype">int</span> nvars, <span class="keywordtype">int</span> *indd, <span class="keywordtype">int</span>*nnnz, <span class="keywordtype">int</span> *nnzmats){
<a name="l00755"></a>00755    <span class="keywordtype">int</span> i,j,n,nzmats=0;
<a name="l00756"></a>00756    <span class="keywordtype">int</span> marker1=0,marker2=0;
<a name="l00757"></a>00757   <span class="keywordflow">for</span> (i=0;i&lt;block;i++){n=(int)blocksize[i]; marker1=marker1+n*(n+1)/2;}
<a name="l00758"></a>00758   n=(int)blocksize[block];  
<a name="l00759"></a>00759   marker2=marker1+n*(n+1)/2;
<a name="l00760"></a>00760   <span class="keywordflow">for</span> (i=0;i&lt;nvars;i++){
<a name="l00761"></a>00761     j=nnnz[i];
<a name="l00762"></a>00762     <span class="keywordflow">while</span> (indd[j]&lt;marker1 &amp;&amp; j&lt; nnnz[i+1]){j++;}
<a name="l00763"></a>00763     <span class="keywordflow">if</span> (j&lt;nnnz[i+1] &amp;&amp; indd[j]&lt;marker2){ nzmats++;}
<a name="l00764"></a>00764   }
<a name="l00765"></a>00765   *nnzmats=nzmats;
<a name="l00766"></a>00766   <span class="keywordflow">return</span> 0;
<a name="l00767"></a>00767 }
<a name="l00768"></a>00768 
<a name="l00769"></a>00769 <span class="comment">/* ---------------------------------------------------------- */</span>
<a name="l00770"></a>00770  <span class="keyword">static</span> <span class="keywordtype">int</span> DSDPPrintStats2(<a class="code" href="structDSDP__C.html" title="Internal structures for the DSDP solver.">DSDP</a> dsdp, <span class="keywordtype">void</span>* dummy){
<a name="l00771"></a>00771    
<a name="l00772"></a>00772   <span class="keywordtype">int</span>    iter,info;
<a name="l00773"></a>00773   <span class="keywordtype">double</span> pobj,dobj,pstp=0,dstp,mu,res,pnorm,pinfeas;
<a name="l00774"></a>00774   <a class="code" href="dsdpbasictypes_8h.html#a2a68c4cccb1289043bf9b59a58f55b3a" title="There are many reasons to terminate the solver.">DSDPTerminationReason</a> reason;
<a name="l00775"></a>00775 
<a name="l00776"></a>00776   <span class="keywordflow">if</span>(printlevel&lt;=0) <span class="keywordflow">return</span>(0);
<a name="l00777"></a>00777 
<a name="l00778"></a>00778   info = <a class="code" href="group__DSDPConverge.html#ga637bf541e030c5aef4d436a9792714a2" title="Copy the reason why the solver terminated.">DSDPStopReason</a>(dsdp,&amp;reason);
<a name="l00779"></a>00779   info = <a class="code" href="group__DSDPConverge.html#gaaeaa2ec0c50c43f4499aaffea692ede8" title="Copy the current iteration number.">DSDPGetIts</a>(dsdp,&amp;iter);
<a name="l00780"></a>00780 
<a name="l00781"></a>00781   <span class="keywordflow">if</span>( (reason!=<a class="code" href="dsdpbasictypes_8h.html#a2a68c4cccb1289043bf9b59a58f55b3aa1eff5fd2a15ae3ba9ba57eb0db8db618">CONTINUE_ITERATING</a>) || ((iter % printlevel)==0)){
<a name="l00782"></a>00782 
<a name="l00783"></a>00783     info = <a class="code" href="group__DSDPSolution.html#gadb9e055ef8b2194ae67ed14ca06f1d01" title="Copy the objective value (DD).">DSDPGetDDObjective</a>(dsdp,&amp;dobj);
<a name="l00784"></a>00784     info = <a class="code" href="group__DSDPSolution.html#gad603533b7e28587f5b2ee824eee58eb3" title="Copy the objective value (PP).">DSDPGetPPObjective</a>(dsdp,&amp;pobj);
<a name="l00785"></a>00785     info = <a class="code" href="group__DSDPSolution.html#gacfa8e29ecd7eaaeb6a4e31eb07961de3" title="Copy the infeasibility in (D), or the variable r in (DD).">DSDPGetR</a>(dsdp,&amp;res);
<a name="l00786"></a>00786     info = <a class="code" href="group__DSDPConverge.html#ga88aa3c65b2eb3699f6c2d203c3f11963" title="Copy the infeasibility in (P).">DSDPGetPInfeasibility</a>(dsdp,&amp;pinfeas);
<a name="l00787"></a>00787     info = <a class="code" href="group__DSDPSolution.html#gadf4655c90ede45912f2e4ce7f4475cad" title="Copy the step sizes in the current iteration.">DSDPGetStepLengths</a>(dsdp,&amp;pstp,&amp;dstp);
<a name="l00788"></a>00788     info = <a class="code" href="group__DSDPSolver.html#ga05f1269e817495e448ffa8ae3a4012cf" title="Copy the current barrier parameter.">DSDPGetBarrierParameter</a>(dsdp,&amp;mu);
<a name="l00789"></a>00789     info = <a class="code" href="group__DSDPSolution.html#gaaa2bb03bf7a025936b1d2cd619327a49" title="Copy the proximity of the solution to the central path.">DSDPGetPnorm</a>(dsdp,&amp;pnorm);
<a name="l00790"></a>00790     
<a name="l00791"></a>00791     
<a name="l00792"></a>00792     <span class="keywordflow">if</span> (iter==0){
<a name="l00793"></a>00793       mexPrintf(<span class="stringliteral">&quot;Iter   PP Objective      DD Objective     PInfeas   DInfeas     Nu     StepLength   Pnrm\n&quot;</span>)
<a name="l00794"></a>00794         ;
<a name="l00795"></a>00795       mexPrintf(<span class="stringliteral">&quot;----------------------------------------------------------------------------------------\n&quot;</span>)
<a name="l00796"></a>00796         ;
<a name="l00797"></a>00797     }
<a name="l00798"></a>00798     mexPrintf(<span class="stringliteral">&quot;%-3d %16.8e  %16.8e  %9.1e %9.1e %9.1e&quot;</span>,iter,pobj,dobj,pinfeas,res,mu);
<a name="l00799"></a>00799     mexPrintf(<span class="stringliteral">&quot;  %4.2f  %4.2f&quot;</span>,pstp,dstp);
<a name="l00800"></a>00800     <span class="keywordflow">if</span> (pnorm&gt;1.0e3){
<a name="l00801"></a>00801       mexPrintf(<span class="stringliteral">&quot;  %1.0e \n&quot;</span>,pnorm);
<a name="l00802"></a>00802     } <span class="keywordflow">else</span> {
<a name="l00803"></a>00803       mexPrintf(<span class="stringliteral">&quot;  %5.2f \n&quot;</span>,pnorm);
<a name="l00804"></a>00804     }
<a name="l00805"></a>00805     fflush(NULL);
<a name="l00806"></a>00806   }
<a name="l00807"></a>00807   <span class="keywordflow">return</span>(0);
<a name="l00808"></a>00808 }
</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>