<!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/sdpcone.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">sdpcone.c</div> </div> </div> <div class="contents"> <a href="sdpcone_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#include "<a class="code" href="dsdpsdp_8h.html" title="Internal SDPCone data structures and routines.">dsdpsdp.h</a>"</span> <a name="l00002"></a>00002 <span class="preprocessor">#include "<a class="code" href="dsdpsys_8h.html" title="Error handling, printing, and profiling.">dsdpsys.h</a>"</span> <a name="l00008"></a>00008 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00009"></a>00009 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "SDPConeComputeSS"</span> <a name="l00010"></a>00010 <span class="preprocessor"></span> <a name="l00018"></a><a class="code" href="sdpcone_8c.html#aa9b373b917acd1a434642bd76acbb114">00018</a> <span class="keywordtype">int</span> <a class="code" href="dsdpsdp_8h.html#ab665b6c59bb4b2bdc1e15f527fdc0728" title="Sum the data matrices.">SDPConeComputeSS</a>(<a class="code" href="structSDPCone__C.html" title="Internal structure for semidefinite cone.">SDPCone</a> sdpcone, <span class="keywordtype">int</span> blockj, <a class="code" href="dsdpvec_8h.html#a421243d35437ad44ded3c1e34198e8e9" title="This object hold m+2 variables: a scaling of C, the y variables, and r.">DSDPVec</a> Y, <a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> SS){ <a name="l00019"></a>00019 <span class="keywordtype">int</span> info; <a name="l00020"></a>00020 DSDPFunctionBegin; <a name="l00021"></a>00021 info=<a class="code" href="dsdpxmat_8c.html#a9bf5b99c68ebd39086408bcdc430caa6" title="Zero matrix.">DSDPVMatZeroEntries</a>(SS); DSDPCHKBLOCKERR(blockj,info); <a name="l00022"></a>00022 info=<a class="code" href="dsdpblock_8c.html#a8142db7eef0f4770bf79e05a81b01401" title="Sum the data matrices.">DSDPBlockASum</a>(&sdpcone->blk[blockj].ADATA,1,Y,SS); DSDPCHKBLOCKERR(blockj,info); <a name="l00023"></a>00023 DSDPFunctionReturn(0); <a name="l00024"></a>00024 } <a name="l00025"></a>00025 <a name="l00026"></a>00026 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00027"></a>00027 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "SDPConeComputeS"</span> <a name="l00028"></a>00028 <span class="preprocessor"></span> <a name="l00042"></a><a class="code" href="group__SDPRoutines.html#ga1ef87e3c016d9668efaa8240bec4383b">00042</a> <span class="keywordtype">int</span> <a class="code" href="group__SDPRoutines.html#ga1ef87e3c016d9668efaa8240bec4383b" title="Compute the dual matrix S.">SDPConeComputeS</a>(<a class="code" href="structSDPCone__C.html" title="Internal structure for semidefinite cone.">SDPCone</a> sdpcone, <span class="keywordtype">int</span> blockj, <span class="keywordtype">double</span> cc,<span class="keywordtype">double</span> y[], <span class="keywordtype">int</span> nvars, <span class="keywordtype">double</span> r, <span class="keywordtype">int</span> n, <span class="keywordtype">double</span> s[], <span class="keywordtype">int</span> nn){ <a name="l00043"></a>00043 <span class="keywordtype">int</span> i,info; <a name="l00044"></a>00044 <span class="keywordtype">char</span> UPLQ; <a name="l00045"></a>00045 <a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> T; <a name="l00046"></a>00046 <a class="code" href="dsdpvec_8h.html#a421243d35437ad44ded3c1e34198e8e9" title="This object hold m+2 variables: a scaling of C, the y variables, and r.">DSDPVec</a> Y=sdpcone->Work; <a name="l00047"></a>00047 DSDPFunctionBegin; <a name="l00048"></a>00048 info=<a class="code" href="dsdpadddata_8c.html#af1714aaed2783404801235ae8065558d" title="Check validity of parameter.">SDPConeCheckN</a>(sdpcone,blockj,n);DSDPCHKBLOCKERR(blockj,info); <a name="l00049"></a>00049 info=<a class="code" href="dsdpadddata_8c.html#af369d5fedbca0d3aca1bfb2acc18adf8" title="Check validity of parameter.">SDPConeCheckM</a>(sdpcone,nvars);DSDPCHKERR(info); <a name="l00050"></a>00050 <span class="keywordflow">if</span> (n<1){DSDPFunctionReturn(0);} <a name="l00051"></a>00051 info=DSDPVecSetC(Y,-1.0*cc); <a name="l00052"></a>00052 info=DSDPVecSetR(Y,-r); <a name="l00053"></a>00053 <span class="keywordflow">for</span> (i=0;i<nvars;i++){info=DSDPVecSetElement(Y,i+1,y[i]);} <a name="l00054"></a>00054 info=<a class="code" href="group__SDPData.html#gabb32703bcca3a703fbbb591ee6737118" title="Get the storage format for the block.">SDPConeGetStorageFormat</a>(sdpcone,blockj,&UPLQ);DSDPCHKBLOCKERR(blockj,info); <a name="l00055"></a>00055 info=<a class="code" href="dsdpsdp_8h.html#a17dc8bc3404b674460890974551cab29" title="Allocate V matrix using the given array.">DSDPMakeVMatWithArray</a>(UPLQ,s,nn,n,&T);DSDPCHKBLOCKERR(blockj,info); <a name="l00056"></a>00056 info=<a class="code" href="dsdpsdp_8h.html#ab665b6c59bb4b2bdc1e15f527fdc0728" title="Sum the data matrices.">SDPConeComputeSS</a>(sdpcone,blockj,Y,T);DSDPCHKBLOCKERR(blockj,info); <a name="l00057"></a>00057 info=<a class="code" href="dsdpxmat_8c.html#acb23f3beb4969a6d69d1e3af7ccba034" title="Deallocate matrix.">DSDPVMatDestroy</a>(&T);DSDPCHKBLOCKERR(blockj,info); <a name="l00058"></a>00058 DSDPFunctionReturn(0); <a name="l00059"></a>00059 } <a name="l00060"></a>00060 <a name="l00061"></a>00061 <span class="preprocessor">#undef __FUNCT__ </span> <a name="l00062"></a>00062 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "SDPConeAddADotX"</span> <a name="l00063"></a>00063 <span class="preprocessor"></span> <a name="l00075"></a><a class="code" href="group__SDPRoutines.html#ga7a1b477dea7f499f3b3499c479087632">00075</a> <span class="keywordtype">int</span> <a class="code" href="group__SDPRoutines.html#ga7a1b477dea7f499f3b3499c479087632" title="Compute the inner products of a dense matrix X with the data matrices.">SDPConeAddADotX</a>(<a class="code" href="structSDPCone__C.html" title="Internal structure for semidefinite cone.">SDPCone</a> sdpcone, <span class="keywordtype">int</span> blockj, <span class="keywordtype">double</span> alpha,<span class="keywordtype">double</span> x[], <span class="keywordtype">int</span> nn, <span class="keywordtype">double</span> adotx[], <span class="keywordtype">int</span> m){ <a name="l00076"></a>00076 <span class="keywordtype">int</span> info,n; <a name="l00077"></a>00077 <span class="keywordtype">char</span> UPLQ; <a name="l00078"></a>00078 <a class="code" href="structSDPblk.html" title="Internal structure for block of semidefinite cone.">SDPblk</a> *blk=sdpcone->blk; <a name="l00079"></a>00079 <span class="keywordtype">double</span> scl=blk[blockj].ADATA.scl; <a name="l00080"></a>00080 <a class="code" href="dsdpvec_8h.html#a421243d35437ad44ded3c1e34198e8e9" title="This object hold m+2 variables: a scaling of C, the y variables, and r.">DSDPVec</a> ADOTX,YW2; <a name="l00081"></a>00081 <a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> T; <a name="l00082"></a>00082 DSDPFunctionBegin; <a name="l00083"></a>00083 info=<a class="code" href="dsdpadddata_8c.html#a8043a5d379af0a18dcd0e5d4fd82387e" title="Check validity of parameter.">SDPConeCheckJ</a>(sdpcone,blockj);DSDPCHKERR(info); <a name="l00084"></a>00084 info=<a class="code" href="dsdpadddata_8c.html#af369d5fedbca0d3aca1bfb2acc18adf8" title="Check validity of parameter.">SDPConeCheckM</a>(sdpcone,m-2);DSDPCHKERR(info); <a name="l00085"></a>00085 YW2=sdpcone->Work2; <a name="l00086"></a>00086 info=DSDPVecSet(alpha,YW2);DSDPCHKBLOCKERR(blockj,info); <a name="l00087"></a>00087 info=<a class="code" href="group__SDPRoutines.html#gada3cc6468c592a2e40b4f78b0def507c" title="Get the dimension of one block in the semidefinite cone.">SDPConeGetBlockSize</a>(sdpcone,blockj,&n);DSDPCHKBLOCKERR(blockj,info); <a name="l00088"></a>00088 <span class="keywordflow">if</span> (n<1){DSDPFunctionReturn(0);} <a name="l00089"></a>00089 info=DSDPVecCreateWArray(&ADOTX,adotx,m); <a name="l00090"></a>00090 info=<a class="code" href="group__SDPData.html#gabb32703bcca3a703fbbb591ee6737118" title="Get the storage format for the block.">SDPConeGetStorageFormat</a>(sdpcone,blockj,&UPLQ);DSDPCHKBLOCKERR(blockj,info); <a name="l00091"></a>00091 info=<a class="code" href="dsdpsdp_8h.html#a17dc8bc3404b674460890974551cab29" title="Allocate V matrix using the given array.">DSDPMakeVMatWithArray</a>(UPLQ,x,nn,n,&T);DSDPCHKBLOCKERR(blockj,info); <a name="l00092"></a>00092 info=<a class="code" href="dsdpblock_8c.html#ad44dbf8c3e12441b64fb7725fc6be04e" title="Compute inner product of XX with data matrices.">DSDPBlockADot</a>(&blk[blockj].ADATA,1.0/scl,YW2,T,ADOTX);DSDPCHKBLOCKERR(blockj,info); <a name="l00093"></a>00093 info=<a class="code" href="dsdpxmat_8c.html#acb23f3beb4969a6d69d1e3af7ccba034" title="Deallocate matrix.">DSDPVMatDestroy</a>(&T);DSDPCHKBLOCKERR(blockj,info); <a name="l00094"></a>00094 DSDPFunctionReturn(0); <a name="l00095"></a>00095 } <a name="l00096"></a>00096 <a name="l00097"></a>00097 <span class="preprocessor">#undef __FUNCT__ </span> <a name="l00098"></a>00098 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "SDPConeComputeXDot"</span> <a name="l00099"></a>00099 <span class="preprocessor"></span> <a name="l00111"></a><a class="code" href="sdpcone_8c.html#aff9e7774f8771123e6610db16b5a0988">00111</a> <span class="keywordtype">int</span> <a class="code" href="dsdpsdp_8h.html#ae03323fd0c3d79ead3747f856b127a2b" title="Compute inner product of X with the Data, S, and norm of X.">SDPConeComputeXDot</a>(<a class="code" href="structSDPCone__C.html" title="Internal structure for semidefinite cone.">SDPCone</a> sdpcone, <span class="keywordtype">int</span> blockj, <a class="code" href="dsdpvec_8h.html#a421243d35437ad44ded3c1e34198e8e9" title="This object hold m+2 variables: a scaling of C, the y variables, and r.">DSDPVec</a> Y,<a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> X, <a class="code" href="dsdpvec_8h.html#a421243d35437ad44ded3c1e34198e8e9" title="This object hold m+2 variables: a scaling of C, the y variables, and r.">DSDPVec</a> AX, <span class="keywordtype">double</span>* xtrace,<span class="keywordtype">double</span> *xnorm, <span class="keywordtype">double</span> *tracexs){ <a name="l00112"></a>00112 <span class="keywordtype">int</span> info; <a name="l00113"></a>00113 <a class="code" href="structSDPblk.html" title="Internal structure for block of semidefinite cone.">SDPblk</a> *blk=sdpcone->blk; <a name="l00114"></a>00114 <a class="code" href="dsdpvec_8h.html#a421243d35437ad44ded3c1e34198e8e9" title="This object hold m+2 variables: a scaling of C, the y variables, and r.">DSDPVec</a> YW2=sdpcone->Work2; <a name="l00115"></a>00115 <span class="keywordtype">double</span> one=1.0,scl=blk[blockj].ADATA.scl; <a name="l00116"></a>00116 DSDPFunctionBegin; <a name="l00117"></a>00117 info=DSDPVecZero(YW2);DSDPCHKBLOCKERR(blockj,info); <a name="l00118"></a>00118 info=<a class="code" href="dsdpblock_8c.html#ad44dbf8c3e12441b64fb7725fc6be04e" title="Compute inner product of XX with data matrices.">DSDPBlockADot</a>(&blk[blockj].ADATA,-1.0/scl,Y,X,YW2);DSDPCHKBLOCKERR(blockj,info); <a name="l00119"></a>00119 info=DSDPVecGetR(YW2,xtrace);DSDPCHKBLOCKERR(blockj,info); <a name="l00120"></a>00120 info=DSDPVecSum(YW2,tracexs);DSDPCHKBLOCKERR(blockj,info); <a name="l00121"></a>00121 info=<a class="code" href="dsdpxmat_8c.html#a26bd5f85f0e340f7c89215efc22f0e57" title="Compute square of Frobenius norm of matrix.">DSDPVMatNormF2</a>(X,xnorm);DSDPCHKBLOCKERR(blockj,info); <a name="l00122"></a>00122 info=DSDPVecSet(one,YW2);DSDPCHKBLOCKERR(blockj,info); <a name="l00123"></a>00123 info=<a class="code" href="dsdpblock_8c.html#ad44dbf8c3e12441b64fb7725fc6be04e" title="Compute inner product of XX with data matrices.">DSDPBlockADot</a>(&blk[blockj].ADATA,1.0/scl,YW2,X,AX);DSDPCHKBLOCKERR(blockj,info); <a name="l00124"></a>00124 DSDPFunctionReturn(0); <a name="l00125"></a>00125 } <a name="l00126"></a>00126 <a name="l00127"></a>00127 <span class="preprocessor">#undef __FUNCT__ </span> <a name="l00128"></a>00128 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "SDPConeComputeX3"</span> <a name="l00129"></a>00129 <span class="preprocessor"></span> <a name="l00140"></a><a class="code" href="sdpcone_8c.html#a31f555d6237412809da4e489834735d2">00140</a> <span class="keywordtype">int</span> <a class="code" href="dsdpsdp_8h.html#a30d762d0f2c69b414455a577d12305d0" title="Compute the matrix X with the given information.">SDPConeComputeX3</a>(<a class="code" href="structSDPCone__C.html" title="Internal structure for semidefinite cone.">SDPCone</a> sdpcone, <span class="keywordtype">int</span> blockj, <span class="keywordtype">double</span> mu, <a class="code" href="dsdpvec_8h.html#a421243d35437ad44ded3c1e34198e8e9" title="This object hold m+2 variables: a scaling of C, the y variables, and r.">DSDPVec</a> Y,<a class="code" href="dsdpvec_8h.html#a421243d35437ad44ded3c1e34198e8e9" title="This object hold m+2 variables: a scaling of C, the y variables, and r.">DSDPVec</a> DY,<a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> X){ <a name="l00141"></a>00141 <span class="keywordtype">int</span> info; <a name="l00142"></a>00142 <span class="keywordtype">double</span> xshift=1e-12,xscale=1e-12; <a name="l00143"></a>00143 <a class="code" href="structSDPblk.html" title="Internal structure for block of semidefinite cone.">SDPblk</a> *blk=sdpcone->blk; <a name="l00144"></a>00144 <a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65" title="Boolean variables.">DSDPTruth</a> psdefinite1=<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65a74385569aa7a59059a8847e2d39b754c">DSDP_FALSE</a>,psdefinite2=<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65a74385569aa7a59059a8847e2d39b754c">DSDP_FALSE</a>,full; <a name="l00145"></a>00145 <a class="code" href="structDSDPDualMat__C.html" title="Represents an S matrix for one block in the semidefinite cone.">DSDPDualMat</a> SS; <a name="l00146"></a>00146 <a name="l00147"></a>00147 DSDPFunctionBegin; <a name="l00148"></a>00148 SS=blk[blockj].SS; <a name="l00149"></a>00149 info=<a class="code" href="dsdpsdp_8h.html#ab665b6c59bb4b2bdc1e15f527fdc0728" title="Sum the data matrices.">SDPConeComputeSS</a>(sdpcone,blockj,Y,X);DSDPCHKBLOCKERR(blockj,info); <a name="l00150"></a>00150 info=<a class="code" href="dsdpdualmat_8c.html#af90a72f8db701ea0462ce8068d826fab" title="Print the matrix.">DSDPDualMatSetArray</a>(SS,X); DSDPCHKBLOCKERR(blockj,info); <a name="l00151"></a>00151 info=<a class="code" href="dsdpdualmat_8c.html#a45b26d8bf109509648dd87b42305ee0c" title="Factor the matrix.">DSDPDualMatCholeskyFactor</a>(SS,&psdefinite1); DSDPCHKBLOCKERR(blockj,info); <a name="l00152"></a>00152 <span class="keywordflow">if</span> (psdefinite1 == <a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65a74385569aa7a59059a8847e2d39b754c">DSDP_FALSE</a>){ <a name="l00153"></a>00153 DSDPLogInfo(0,2,<span class="stringliteral">"Primal SDP Block %2.0f not PSD\n"</span>,blockj); <a name="l00154"></a>00154 } <a name="l00155"></a>00155 info=<a class="code" href="dsdpdualmat_8c.html#afc103268b635e313f90431f9eca7c85f" title="Invert the matrix.">DSDPDualMatInvert</a>(SS);DSDPCHKBLOCKERR(blockj,info); <a name="l00156"></a>00156 info=<a class="code" href="dsdpsdp_8h.html#a4b077e6275df502022d09162511c4712" title="Compute X.">SDPConeComputeXX</a>(sdpcone,blockj,DY,mu,SS,X);DSDPCHKBLOCKERR(blockj,info); <a name="l00157"></a>00157 info=<a class="code" href="dsdpdualmat_8c.html#aca0745e1337928a255ee3906acd69fa3" title="Factor the matrix.">DSDPDualMatIsFull</a>(SS,&full);DSDPCHKBLOCKERR(blockj,info); <a name="l00158"></a>00158 psdefinite2=<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65a74385569aa7a59059a8847e2d39b754c">DSDP_FALSE</a>; <a name="l00159"></a>00159 <span class="keywordflow">while</span> (full==<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65ae6b2e53e51e94a5fa7204ceac78f824f">DSDP_TRUE</a> && psdefinite2==<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65a74385569aa7a59059a8847e2d39b754c">DSDP_FALSE</a> && xscale<2e-1){ <a name="l00160"></a>00160 info=<a class="code" href="dsdpxmat_8c.html#a5d9a41fd2b127f8662e73d068d1ce99d" title="Add something to diagonal elements.">DSDPVMatShiftDiagonal</a>(X,xshift); DSDPCHKBLOCKERR(blockj,info); <a name="l00161"></a>00161 info=<a class="code" href="dsdpxmat_8c.html#ad8fc8d36269ab08a81f4c55d21fd1663" title="Scaling diagonal is useful for inner products and norms.">DSDPVMatScaleDiagonal</a>(X,1.0+xscale); DSDPCHKBLOCKERR(blockj,info); <a name="l00162"></a>00162 DSDPLogInfo(0,10,<span class="stringliteral">"VMat: shift diagonal: %4.2e, scale diagonal: %4.2e.\n"</span>,xshift,1+xscale); <a name="l00163"></a>00163 info=<a class="code" href="dsdpdualmat_8c.html#af90a72f8db701ea0462ce8068d826fab" title="Print the matrix.">DSDPDualMatSetArray</a>(SS,X); DSDPCHKBLOCKERR(blockj,info); <a name="l00164"></a>00164 info=<a class="code" href="dsdpdualmat_8c.html#a45b26d8bf109509648dd87b42305ee0c" title="Factor the matrix.">DSDPDualMatCholeskyFactor</a>(SS,&psdefinite2); DSDPCHKBLOCKERR(blockj,info); <a name="l00165"></a>00165 xshift*=10;xscale*=10; <a name="l00166"></a>00166 } <a name="l00167"></a>00167 <span class="keywordflow">if</span> (full==<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65a74385569aa7a59059a8847e2d39b754c">DSDP_FALSE</a>){ <a name="l00168"></a>00168 xshift=1e-12,xscale=1e-10; <a name="l00169"></a>00169 info=<a class="code" href="dsdpxmat_8c.html#a5d9a41fd2b127f8662e73d068d1ce99d" title="Add something to diagonal elements.">DSDPVMatShiftDiagonal</a>(X,xshift); DSDPCHKBLOCKERR(blockj,info); <a name="l00170"></a>00170 info=<a class="code" href="dsdpxmat_8c.html#ad8fc8d36269ab08a81f4c55d21fd1663" title="Scaling diagonal is useful for inner products and norms.">DSDPVMatScaleDiagonal</a>(X,1.0+xscale); DSDPCHKBLOCKERR(blockj,info); <a name="l00171"></a>00171 DSDPLogInfo(0,10,<span class="stringliteral">"XMat: shift diagonal: %4.2e, scale diagonal: %4.2e.\n"</span>,xshift,1+xscale); <a name="l00172"></a>00172 } <a name="l00173"></a>00173 DSDPFunctionReturn(0); <a name="l00174"></a>00174 } <a name="l00175"></a>00175 <a name="l00176"></a>00176 <a name="l00177"></a>00177 <span class="preprocessor">#undef __FUNCT__ </span> <a name="l00178"></a>00178 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "SDPConeComputeX"</span> <a name="l00179"></a>00179 <span class="preprocessor"></span> <a name="l00191"></a><a class="code" href="group__SDPRoutines.html#ga42571e7fb01fa614f3ab4bfdf069d5f7">00191</a> <span class="keywordtype">int</span> <a class="code" href="group__SDPRoutines.html#ga42571e7fb01fa614f3ab4bfdf069d5f7" title="Compute the matrix X.">SDPConeComputeX</a>(<a class="code" href="structSDPCone__C.html" title="Internal structure for semidefinite cone.">SDPCone</a> sdpcone, <span class="keywordtype">int</span> blockj, <span class="keywordtype">int</span> n, <span class="keywordtype">double</span> x[], <span class="keywordtype">int</span> nn){ <a name="l00192"></a>00192 <span class="keywordtype">int</span> info; <a name="l00193"></a>00193 <span class="keywordtype">double</span> mu=sdpcone->xmakermu; <a name="l00194"></a>00194 <span class="keywordtype">double</span> xnorm,xtrace,trxs; <a name="l00195"></a>00195 <span class="keywordtype">char</span> UPLQ; <a name="l00196"></a>00196 <a class="code" href="dsdpvec_8h.html#a421243d35437ad44ded3c1e34198e8e9" title="This object hold m+2 variables: a scaling of C, the y variables, and r.">DSDPVec</a> DY=sdpcone->DYX,Y=sdpcone->YX,AX=sdpcone->Work; <a name="l00197"></a>00197 <a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> T; <a name="l00198"></a>00198 <a name="l00199"></a>00199 DSDPFunctionBegin; <a name="l00200"></a>00200 info=<a class="code" href="dsdpadddata_8c.html#af1714aaed2783404801235ae8065558d" title="Check validity of parameter.">SDPConeCheckN</a>(sdpcone,blockj,n);DSDPCHKBLOCKERR(blockj,info); <a name="l00201"></a>00201 <span class="keywordflow">if</span> (n<1){DSDPFunctionReturn(0);} <a name="l00202"></a>00202 info=<a class="code" href="group__SDPData.html#gabb32703bcca3a703fbbb591ee6737118" title="Get the storage format for the block.">SDPConeGetStorageFormat</a>(sdpcone,blockj,&UPLQ);DSDPCHKBLOCKERR(blockj,info); <a name="l00203"></a>00203 info=<a class="code" href="dsdpsdp_8h.html#a17dc8bc3404b674460890974551cab29" title="Allocate V matrix using the given array.">DSDPMakeVMatWithArray</a>(UPLQ,x,nn,n,&T);DSDPCHKBLOCKERR(blockj,info); <a name="l00204"></a>00204 info=<a class="code" href="dsdpsdp_8h.html#a30d762d0f2c69b414455a577d12305d0" title="Compute the matrix X with the given information.">SDPConeComputeX3</a>(sdpcone,blockj,mu,Y,DY,T);DSDPCHKBLOCKERR(blockj,info); <a name="l00205"></a>00205 info=<a class="code" href="dsdpsdp_8h.html#ae03323fd0c3d79ead3747f856b127a2b" title="Compute inner product of X with the Data, S, and norm of X.">SDPConeComputeXDot</a>(sdpcone,blockj,Y,T,AX,&xtrace,&xnorm,&trxs);DSDPCHKBLOCKERR(blockj,info); <a name="l00206"></a>00206 info=<a class="code" href="dsdpxmat_8c.html#acb23f3beb4969a6d69d1e3af7ccba034" title="Deallocate matrix.">DSDPVMatDestroy</a>(&T);DSDPCHKBLOCKERR(blockj,info); <a name="l00207"></a>00207 DSDPFunctionReturn(0); <a name="l00208"></a>00208 } <a name="l00209"></a>00209 <a name="l00210"></a>00210 <span class="preprocessor">#undef __FUNCT__ </span> <a name="l00211"></a>00211 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "SDPConeViewX"</span> <a name="l00212"></a>00212 <span class="preprocessor"></span> <a name="l00223"></a><a class="code" href="group__SDPBasic.html#ga86f9566781cbb0468984b6486ff36ea1">00223</a> <span class="keywordtype">int</span> <a class="code" href="group__SDPBasic.html#ga86f9566781cbb0468984b6486ff36ea1" title="Print a dense array X to the screen.">SDPConeViewX</a>(<a class="code" href="structSDPCone__C.html" title="Internal structure for semidefinite cone.">SDPCone</a> sdpcone, <span class="keywordtype">int</span> blockj, <span class="keywordtype">int</span> n, <span class="keywordtype">double</span> x[], <span class="keywordtype">int</span> nn){ <a name="l00224"></a>00224 <span class="keywordtype">int</span> info; <a name="l00225"></a>00225 <span class="keywordtype">char</span> UPLQ; <a name="l00226"></a>00226 <a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> T; <a name="l00227"></a>00227 <a name="l00228"></a>00228 DSDPFunctionBegin; <a name="l00229"></a>00229 info=<a class="code" href="dsdpadddata_8c.html#af1714aaed2783404801235ae8065558d" title="Check validity of parameter.">SDPConeCheckN</a>(sdpcone,blockj,n);DSDPCHKBLOCKERR(blockj,info); <a name="l00230"></a>00230 info=<a class="code" href="group__SDPData.html#gabb32703bcca3a703fbbb591ee6737118" title="Get the storage format for the block.">SDPConeGetStorageFormat</a>(sdpcone,blockj,&UPLQ);DSDPCHKBLOCKERR(blockj,info); <a name="l00231"></a>00231 info=<a class="code" href="dsdpsdp_8h.html#a17dc8bc3404b674460890974551cab29" title="Allocate V matrix using the given array.">DSDPMakeVMatWithArray</a>(UPLQ,x,nn,n,&T);DSDPCHKBLOCKERR(blockj,info); <a name="l00232"></a>00232 info=<a class="code" href="dsdpxmat_8c.html#afa0b2c0d0c9ec7c7f9842d1db778a5b3" title="Print matrix.">DSDPVMatView</a>(T);DSDPCHKBLOCKERR(blockj,info); <a name="l00233"></a>00233 info=<a class="code" href="dsdpxmat_8c.html#acb23f3beb4969a6d69d1e3af7ccba034" title="Deallocate matrix.">DSDPVMatDestroy</a>(&T);DSDPCHKBLOCKERR(blockj,info); <a name="l00234"></a>00234 DSDPFunctionReturn(0); <a name="l00235"></a>00235 } <a name="l00236"></a>00236 <a name="l00237"></a>00237 <span class="preprocessor">#undef __FUNCT__ </span> <a name="l00238"></a>00238 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "SDPConeXVMultiply"</span> <a name="l00239"></a>00239 <span class="preprocessor"></span> <a name="l00251"></a><a class="code" href="group__SDPRoutines.html#ga288158182d952a72534b9c8894407c5b">00251</a> <span class="keywordtype">int</span> <a class="code" href="group__SDPRoutines.html#ga288158182d952a72534b9c8894407c5b" title="Multiply an array by a factor V such that .">SDPConeXVMultiply</a>(<a class="code" href="structSDPCone__C.html" title="Internal structure for semidefinite cone.">SDPCone</a> sdpcone, <span class="keywordtype">int</span> blockj, <span class="keywordtype">double</span> vin[], <span class="keywordtype">double</span> vout[], <span class="keywordtype">int</span> n){ <a name="l00252"></a>00252 <span class="keywordtype">int</span> info; <a name="l00253"></a>00253 <a class="code" href="structSDPblk.html" title="Internal structure for block of semidefinite cone.">SDPblk</a> *blk=sdpcone->blk; <a name="l00254"></a>00254 <a class="code" href="structSDPConeVec__C.html" title="Vector whose length corresponds to dimension of a block in a cone.">SDPConeVec</a> V1,V2,V3,V4; <a name="l00255"></a>00255 <a class="code" href="structDSDPDualMat__C.html" title="Represents an S matrix for one block in the semidefinite cone.">DSDPDualMat</a> S,SS; <a name="l00256"></a>00256 <a name="l00257"></a>00257 DSDPFunctionBegin; <a name="l00258"></a>00258 info=<a class="code" href="dsdpadddata_8c.html#af1714aaed2783404801235ae8065558d" title="Check validity of parameter.">SDPConeCheckN</a>(sdpcone,blockj,n);DSDPCHKBLOCKERR(blockj,info); <a name="l00259"></a>00259 <span class="keywordflow">if</span> (sdpcone->blk[blockj].n>1){ <a name="l00260"></a>00260 S=blk[blockj].S; SS=blk[blockj].SS; <a name="l00261"></a>00261 V2=blk[blockj].W; V3=blk[blockj].W2; <a name="l00262"></a>00262 info=SDPConeVecCreateWArray(&V1,vin,n); <a name="l00263"></a>00263 info=SDPConeVecCreateWArray(&V4,vout,n); <a name="l00264"></a>00264 <span class="keywordflow">if</span> (0){ <a name="l00265"></a>00265 info=<a class="code" href="dsdpdualmat_8c.html#aa64bc6161dd47646962c7226982f6d62" title="Forward triangular solve.">DSDPDualMatCholeskySolveForward</a>(S,V1,V3);DSDPCHKERR(info); <a name="l00266"></a>00266 info=<a class="code" href="sdpconevec_8c.html#aa96c836f6ec003af73fd3fc9d24db24e" title="Compute the Euclidean norm.">SDPConeVecScale</a>(sqrt(sdpcone->xmakermu),V3);DSDPCHKERR(info); <a name="l00267"></a>00267 info=<a class="code" href="dsdpdualmat_8c.html#a853fa8c51c83aa5f2e0c6923f76e0ee4" title="Backward triangular solve.">DSDPDualMatCholeskySolveBackward</a>(S,V3,V2);DSDPCHKERR(info); <a name="l00268"></a>00268 info=<a class="code" href="dsdpdualmat_8c.html#a530c6baf5c27b0d240c92e5541e17866" title="Multiply by triangular matrix.">DSDPDualMatCholeskyBackwardMultiply</a>(SS,V2,V1);DSDPCHKERR(info); <a name="l00269"></a>00269 } <a name="l00270"></a>00270 info=<a class="code" href="dsdpdualmat_8c.html#a54f20cca5ca8bf569944da1ae3ab4c80" title="Multiply by triangular matrix.">DSDPDualMatCholeskyForwardMultiply</a>(SS,V1,V2);DSDPCHKERR(info); <a name="l00271"></a>00271 info=<a class="code" href="dsdpdualmat_8c.html#aa64bc6161dd47646962c7226982f6d62" title="Forward triangular solve.">DSDPDualMatCholeskySolveForward</a>(S,V2,V3);DSDPCHKERR(info); <a name="l00272"></a>00272 info=<a class="code" href="sdpconevec_8c.html#aa96c836f6ec003af73fd3fc9d24db24e" title="Compute the Euclidean norm.">SDPConeVecScale</a>(sqrt(sdpcone->xmakermu),V3);DSDPCHKERR(info); <a name="l00273"></a>00273 info=<a class="code" href="dsdpdualmat_8c.html#a853fa8c51c83aa5f2e0c6923f76e0ee4" title="Backward triangular solve.">DSDPDualMatCholeskySolveBackward</a>(S,V3,V4);DSDPCHKERR(info); <a name="l00274"></a>00274 } <a name="l00275"></a>00275 DSDPFunctionReturn(0); <a name="l00276"></a>00276 } <a name="l00277"></a>00277 <a name="l00278"></a>00278 <span class="preprocessor">#undef __FUNCT__ </span> <a name="l00279"></a>00279 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "SDPConeAddXVAV"</span> <a name="l00280"></a>00280 <span class="preprocessor"></span> <a name="l00292"></a><a class="code" href="group__SDPRoutines.html#ga521bba9ef443933ea8748aa1e7f8d142">00292</a> <span class="keywordtype">int</span> <a class="code" href="group__SDPRoutines.html#ga521bba9ef443933ea8748aa1e7f8d142" title="Compute for i = 0 through m.">SDPConeAddXVAV</a>(<a class="code" href="structSDPCone__C.html" title="Internal structure for semidefinite cone.">SDPCone</a> sdpcone, <span class="keywordtype">int</span> blockj, <span class="keywordtype">double</span> vin[], <span class="keywordtype">int</span> n, <span class="keywordtype">double</span> sum[], <span class="keywordtype">int</span> mm){ <a name="l00293"></a>00293 <span class="keywordtype">int</span> info; <a name="l00294"></a>00294 <a class="code" href="structSDPblk.html" title="Internal structure for block of semidefinite cone.">SDPblk</a> *blk=sdpcone->blk; <a name="l00295"></a>00295 <a class="code" href="structSDPConeVec__C.html" title="Vector whose length corresponds to dimension of a block in a cone.">SDPConeVec</a> V2; <a name="l00296"></a>00296 <a class="code" href="dsdpvec_8h.html#a421243d35437ad44ded3c1e34198e8e9" title="This object hold m+2 variables: a scaling of C, the y variables, and r.">DSDPVec</a> W,Wout; <a name="l00297"></a>00297 DSDPFunctionBegin; <a name="l00298"></a>00298 info=<a class="code" href="dsdpadddata_8c.html#af1714aaed2783404801235ae8065558d" title="Check validity of parameter.">SDPConeCheckN</a>(sdpcone,blockj,n);DSDPCHKBLOCKERR(blockj,info); <a name="l00299"></a>00299 W=sdpcone->Work; <a name="l00300"></a>00300 info=DSDPVecSet(1.0,sdpcone->Work);DSDPCHKBLOCKERR(blockj,info); <a name="l00301"></a>00301 <span class="keywordflow">if</span> (sdpcone->blk[blockj].n>1){ <a name="l00302"></a>00302 info=SDPConeVecCreateWArray(&V2,vin,n);DSDPCHKERR(info); <a name="l00303"></a>00303 info=DSDPVecCreateWArray(&Wout,sum,mm);DSDPCHKERR(info); <a name="l00304"></a>00304 info=<a class="code" href="dsdpblock_8c.html#ac40c42f8b658e8913c9e983443a7f86b" title="Set VAV[i] to aa * Alpha[i] * V' A[i] V.">DSDPBlockvAv</a>(&blk[blockj].ADATA,1.0,sdpcone->Work,V2,Wout);DSDPCHKBLOCKERR(blockj,info); <a name="l00305"></a>00305 } <a name="l00306"></a>00306 DSDPFunctionReturn(0); <a name="l00307"></a>00307 } <a name="l00308"></a>00308 <a name="l00309"></a>00309 <a name="l00310"></a>00310 <a name="l00311"></a>00311 <span class="preprocessor">#undef __FUNCT__ </span> <a name="l00312"></a>00312 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "SDPConeComputeXV"</span> <a name="l00313"></a>00313 <span class="preprocessor"></span> <a name="l00325"></a><a class="code" href="group__SDPRoutines.html#ga274b127d17d7dec0dc4b0ca499f13e89">00325</a> <span class="keywordtype">int</span> <a class="code" href="group__SDPRoutines.html#ga274b127d17d7dec0dc4b0ca499f13e89" title="Compute a factor V such that .">SDPConeComputeXV</a>(<a class="code" href="structSDPCone__C.html" title="Internal structure for semidefinite cone.">SDPCone</a> sdpcone, <span class="keywordtype">int</span> blockj, <span class="keywordtype">int</span> *derror){ <a name="l00326"></a>00326 <a name="l00327"></a>00327 <span class="keywordtype">int</span> info; <span class="keywordtype">double</span> rr; <a name="l00328"></a>00328 <a class="code" href="dsdpvec_8h.html#a421243d35437ad44ded3c1e34198e8e9" title="This object hold m+2 variables: a scaling of C, the y variables, and r.">DSDPVec</a> Y,DY,W; <a name="l00329"></a>00329 <a class="code" href="structSDPblk.html" title="Internal structure for block of semidefinite cone.">SDPblk</a> *blk=sdpcone->blk; <a name="l00330"></a>00330 <a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65" title="Boolean variables.">DSDPTruth</a> psdefinite1=<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65a74385569aa7a59059a8847e2d39b754c">DSDP_FALSE</a>,psdefinite2=<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65a74385569aa7a59059a8847e2d39b754c">DSDP_FALSE</a>; <a name="l00331"></a>00331 <a class="code" href="structDSDPDualMat__C.html" title="Represents an S matrix for one block in the semidefinite cone.">DSDPDualMat</a> S,SS; <a name="l00332"></a>00332 <a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> T; <a name="l00333"></a>00333 <a name="l00334"></a>00334 DSDPFunctionBegin; <a name="l00335"></a>00335 *derror=0; <a name="l00336"></a>00336 info=<a class="code" href="dsdpadddata_8c.html#a8043a5d379af0a18dcd0e5d4fd82387e" title="Check validity of parameter.">SDPConeCheckJ</a>(sdpcone,blockj);DSDPCHKBLOCKERR(blockj,info); <a name="l00337"></a>00337 <span class="keywordflow">if</span> (sdpcone->blk[blockj].n>1){ <a name="l00338"></a>00338 Y=sdpcone->YX; DY=sdpcone->DYX; W=sdpcone->Work; <a name="l00339"></a>00339 T=blk[blockj].T; S=blk[blockj].S; SS=blk[blockj].SS; <a name="l00340"></a>00340 info=DSDPVecWAXPY(W,-1.0,DY,Y);DSDPCHKBLOCKERR(blockj,info); <a name="l00341"></a>00341 <a name="l00342"></a>00342 <span class="keywordflow">while</span> (psdefinite1==<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65a74385569aa7a59059a8847e2d39b754c">DSDP_FALSE</a>){ <a name="l00343"></a>00343 info=DSDPVecGetR(W,&rr); <a name="l00344"></a>00344 info=DSDPVecSetR(W,10*rr-1e-12); <a name="l00345"></a>00345 info=<a class="code" href="dsdpsdp_8h.html#ab665b6c59bb4b2bdc1e15f527fdc0728" title="Sum the data matrices.">SDPConeComputeSS</a>(sdpcone,blockj,W,T);DSDPCHKBLOCKERR(blockj,info); <a name="l00346"></a>00346 info=<a class="code" href="dsdpdualmat_8c.html#af90a72f8db701ea0462ce8068d826fab" title="Print the matrix.">DSDPDualMatSetArray</a>(SS,T); DSDPCHKBLOCKERR(blockj,info); <a name="l00347"></a>00347 info=<a class="code" href="dsdpdualmat_8c.html#a45b26d8bf109509648dd87b42305ee0c" title="Factor the matrix.">DSDPDualMatCholeskyFactor</a>(SS,&psdefinite1); DSDPCHKBLOCKERR(blockj,info); <a name="l00348"></a>00348 } <a name="l00349"></a>00349 <a name="l00350"></a>00350 <span class="keywordflow">while</span> (psdefinite2==<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65a74385569aa7a59059a8847e2d39b754c">DSDP_FALSE</a>){ <a name="l00351"></a>00351 info=<a class="code" href="dsdpsdp_8h.html#ab665b6c59bb4b2bdc1e15f527fdc0728" title="Sum the data matrices.">SDPConeComputeSS</a>(sdpcone,blockj,Y,T);DSDPCHKBLOCKERR(blockj,info); <a name="l00352"></a>00352 info=<a class="code" href="dsdpdualmat_8c.html#af90a72f8db701ea0462ce8068d826fab" title="Print the matrix.">DSDPDualMatSetArray</a>(S,T); DSDPCHKBLOCKERR(blockj,info); <a name="l00353"></a>00353 info=<a class="code" href="dsdpdualmat_8c.html#a45b26d8bf109509648dd87b42305ee0c" title="Factor the matrix.">DSDPDualMatCholeskyFactor</a>(S,&psdefinite2); DSDPCHKBLOCKERR(blockj,info); <a name="l00354"></a>00354 <span class="keywordflow">if</span> (psdefinite2==<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65a74385569aa7a59059a8847e2d39b754c">DSDP_FALSE</a>){ <a name="l00355"></a>00355 info=DSDPVecGetR(Y,&rr); <a name="l00356"></a>00356 info=DSDPVecSetR(Y,10*rr-1e-15); <a name="l00357"></a>00357 } <a name="l00358"></a>00358 } <a name="l00359"></a>00359 <span class="keywordflow">if</span> (psdefinite1==<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65a74385569aa7a59059a8847e2d39b754c">DSDP_FALSE</a> || psdefinite2==<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65a74385569aa7a59059a8847e2d39b754c">DSDP_FALSE</a>) *derror=1; <a name="l00360"></a>00360 } <a name="l00361"></a>00361 DSDPFunctionReturn(0); <a name="l00362"></a>00362 } </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>