<!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/dsdpdualmat.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">dsdpdualmat.c</div> </div> </div> <div class="contents"> <a href="dsdpdualmat_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="dsdpdualmat__impl_8h.html" title="Structure of function pointers that each symmetric positive definite matrix type (dense, sparse) must implement.">dsdpdualmat_impl.h</a>"</span> <a name="l00002"></a>00002 <span class="preprocessor">#include "<a class="code" href="dsdpdualmat_8h.html" title="The interface between the SDPCone and the matrix S.">dsdpdualmat.h</a>"</span> <a name="l00003"></a>00003 <span class="preprocessor">#include "<a class="code" href="dsdpsys_8h.html" title="Error handling, printing, and profiling.">dsdpsys.h</a>"</span> <a name="l00004"></a>00004 <a name="l00010"></a>00010 <span class="preprocessor">#define DSDPNoOperationError(a); { DSDPSETERR1(1,"Dual natrix type: %s, Operation not defined\n",(a).dsdpops->matname);}</span> <a name="l00011"></a>00011 <span class="preprocessor"></span><span class="preprocessor">#define DSDPChkDMatError(a,b); { if (b){ DSDPSETERR1(b,"Dual natrix type: %s,\n",(a).dsdpops->matname);} }</span> <a name="l00012"></a>00012 <span class="preprocessor"></span> <a name="l00013"></a>00013 <span class="keyword">static</span> <span class="keywordtype">int</span> sdpdualsolve=0,sdpdualinvert=0; <a name="l00014"></a>00014 <a name="l00015"></a>00015 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00016"></a>00016 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDualMatEventZero"</span> <a name="l00017"></a>00017 <span class="preprocessor"></span><span class="keywordtype">int</span> DSDPDualMatEventZero(<span class="keywordtype">void</span>){ <a name="l00018"></a>00018 DSDPFunctionBegin; <a name="l00019"></a>00019 sdpdualinvert=0;sdpdualsolve=0; <a name="l00020"></a>00020 DSDPFunctionReturn(0); <a name="l00021"></a>00021 } <a name="l00022"></a>00022 <a name="l00023"></a>00023 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00024"></a>00024 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDualMatEventInitialize"</span> <a name="l00025"></a>00025 <span class="preprocessor"></span><span class="keywordtype">int</span> DSDPDualMatEventInitialize(<span class="keywordtype">void</span>){ <a name="l00026"></a>00026 DSDPFunctionBegin; <a name="l00027"></a>00027 <span class="keywordflow">if</span> (sdpdualsolve==0){DSDPEventLogRegister(<span class="stringliteral">"SDP SSolve"</span>,&sdpdualsolve);} <a name="l00028"></a>00028 DSDPFunctionReturn(0); <a name="l00029"></a>00029 } <a name="l00030"></a>00030 <a name="l00031"></a>00031 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00032"></a>00032 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDualMatGetType"</span> <a name="l00033"></a>00033 <span class="preprocessor"></span><span class="keywordtype">int</span> DSDPDualMatGetType(<a class="code" href="structDSDPDualMat__C.html" title="Represents an S matrix for one block in the semidefinite cone.">DSDPDualMat</a> S, <span class="keywordtype">int</span> *<span class="keywordtype">id</span>){ <a name="l00034"></a>00034 DSDPFunctionBegin; <a name="l00035"></a>00035 *<span class="keywordtype">id</span>=S.dsdpops->id; <a name="l00036"></a>00036 DSDPFunctionReturn(0); <a name="l00037"></a>00037 } <a name="l00038"></a>00038 <a name="l00039"></a>00039 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00040"></a>00040 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDualMatSetData"</span> <a name="l00041"></a>00041 <span class="preprocessor"></span> <a name="l00049"></a><a class="code" href="dsdpdualmat_8h.html#a569ea5d9f48a16a6daafcbb739e18efc">00049</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdualmat_8c.html#abed50bfcc211bee6e8b9a070f909f0cf" title="Set the opaque pointer and function pointers to the matrix.">DSDPDualMatSetData</a>(<a class="code" href="structDSDPDualMat__C.html" title="Represents an S matrix for one block in the semidefinite cone.">DSDPDualMat</a> *S, <span class="keyword">struct</span> <a class="code" href="structDSDPDualMat__Ops.html" title="Table of function pointers that operate on the S matrix.">DSDPDualMat_Ops</a>* ops, <span class="keywordtype">void</span>*data){ <a name="l00050"></a>00050 <span class="keywordtype">int</span> info; <a name="l00051"></a>00051 DSDPFunctionBegin; <a name="l00052"></a>00052 (*S).dsdpops=ops; <a name="l00053"></a>00053 (*S).matdata=data; <a name="l00054"></a>00054 info=DSDPDualMatTest(*S);DSDPCHKERR(info); <a name="l00055"></a>00055 DSDPFunctionReturn(0); <a name="l00056"></a>00056 } <a name="l00057"></a>00057 <a name="l00058"></a>00058 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00059"></a>00059 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDualMatDestroy"</span> <a name="l00060"></a>00060 <span class="preprocessor"></span> <a name="l00065"></a><a class="code" href="dsdpdualmat_8h.html#a48199418f9c983365b8a9020ce0ed61f">00065</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdualmat_8c.html#aa27a146654de21980c02f192660550ab" title="Free the matrix structure.">DSDPDualMatDestroy</a>(<a class="code" href="structDSDPDualMat__C.html" title="Represents an S matrix for one block in the semidefinite cone.">DSDPDualMat</a> *S){ <a name="l00066"></a>00066 <span class="keywordtype">int</span> info; <a name="l00067"></a>00067 DSDPFunctionBegin; <a name="l00068"></a>00068 <span class="keywordflow">if</span> ( S && (*S).dsdpops && (*S).dsdpops->matdestroy){ <a name="l00069"></a>00069 info=((*S).dsdpops->matdestroy)((*S).matdata); DSDPChkDMatError(*S,info); <a name="l00070"></a>00070 } <span class="keywordflow">else</span> { <a name="l00071"></a>00071 <span class="comment">/*</span> <a name="l00072"></a>00072 <span class="comment"> DSDPNoOperationError(*S);</span> <a name="l00073"></a>00073 <span class="comment"> */</span> <a name="l00074"></a>00074 } <a name="l00075"></a>00075 info=<a class="code" href="dsdpdualmat_8c.html#abed50bfcc211bee6e8b9a070f909f0cf" title="Set the opaque pointer and function pointers to the matrix.">DSDPDualMatSetData</a>(S,0,0); DSDPCHKERR(info); <a name="l00076"></a>00076 DSDPFunctionReturn(0); <a name="l00077"></a>00077 } <a name="l00078"></a>00078 <a name="l00079"></a>00079 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00080"></a>00080 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDualMatGetSize"</span> <a name="l00081"></a>00081 <span class="preprocessor"></span> <a name="l00087"></a><a class="code" href="dsdpdualmat_8h.html#ac42f59ba57fe5fed253c1ff7114deec1">00087</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdualmat_8c.html#ad8b6b5f859b5795f489c1e740b98080f" title="Free the matrix structure.">DSDPDualMatGetSize</a>(<a class="code" href="structDSDPDualMat__C.html" title="Represents an S matrix for one block in the semidefinite cone.">DSDPDualMat</a> S,<span class="keywordtype">int</span>*n){ <a name="l00088"></a>00088 <span class="keywordtype">int</span> info; <a name="l00089"></a>00089 DSDPFunctionBegin; <a name="l00090"></a>00090 <span class="keywordflow">if</span> (S.dsdpops->matgetsize){ <a name="l00091"></a>00091 info=(S.dsdpops->matgetsize)(S.matdata,n); DSDPChkDMatError(S,info); <a name="l00092"></a>00092 } <span class="keywordflow">else</span> { <a name="l00093"></a>00093 DSDPNoOperationError(S); <a name="l00094"></a>00094 } <a name="l00095"></a>00095 DSDPFunctionReturn(0); <a name="l00096"></a>00096 } <a name="l00097"></a>00097 <a name="l00098"></a>00098 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00099"></a>00099 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDualMatGetArray"</span> <a name="l00100"></a>00100 <span class="preprocessor"></span><span class="keywordtype">int</span> DSDPDualMatGetArray(<a class="code" href="structDSDPDualMat__C.html" title="Represents an S matrix for one block in the semidefinite cone.">DSDPDualMat</a> S, <span class="keywordtype">double</span> **v, <span class="keywordtype">int</span> *n){ <a name="l00101"></a>00101 <span class="keywordtype">int</span> info; <a name="l00102"></a>00102 DSDPFunctionBegin; <a name="l00103"></a>00103 <span class="keywordflow">if</span> (S.dsdpops->matgetarray){ <a name="l00104"></a>00104 info=(S.dsdpops->matgetarray)(S.matdata,v,n); DSDPChkDMatError(S,info); <a name="l00105"></a>00105 } <span class="keywordflow">else</span> { <a name="l00106"></a>00106 *v=0; <a name="l00107"></a>00107 *n=0; <a name="l00108"></a>00108 } <a name="l00109"></a>00109 DSDPFunctionReturn(0); <a name="l00110"></a>00110 } <a name="l00111"></a>00111 <a name="l00112"></a>00112 <a name="l00113"></a>00113 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00114"></a>00114 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDualMatLogDeterminant"</span> <a name="l00115"></a>00115 <span class="preprocessor"></span> <a name="l00122"></a><a class="code" href="dsdpdualmat_8h.html#af7bcdb0e3d33c6e22ff64348393011aa">00122</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdualmat_8c.html#a6238e9e98563c36da6392d3581184cd1" title="Free the matrix structure.">DSDPDualMatLogDeterminant</a>(<a class="code" href="structDSDPDualMat__C.html" title="Represents an S matrix for one block in the semidefinite cone.">DSDPDualMat</a> S,<span class="keywordtype">double</span> *logdet){ <a name="l00123"></a>00123 <span class="keywordtype">int</span> info; <a name="l00124"></a>00124 DSDPFunctionBegin; <a name="l00125"></a>00125 <span class="keywordflow">if</span> (S.dsdpops->matlogdet){ <a name="l00126"></a>00126 info=(S.dsdpops->matlogdet)(S.matdata,logdet); DSDPChkDMatError(S,info); <a name="l00127"></a>00127 } <span class="keywordflow">else</span> { <a name="l00128"></a>00128 DSDPNoOperationError(S); <a name="l00129"></a>00129 } <a name="l00130"></a>00130 DSDPFunctionReturn(0); <a name="l00131"></a>00131 } <a name="l00132"></a>00132 <a name="l00133"></a>00133 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00134"></a>00134 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDualMatView"</span> <a name="l00135"></a>00135 <span class="preprocessor"></span> <a name="l00140"></a><a class="code" href="dsdpdualmat_8h.html#afaf5477f1458bcf4e99002ba9f7fecde">00140</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdualmat_8c.html#a3e7aa8602d81a1767b70c70270941177" title="Print the matrix.">DSDPDualMatView</a>(<a class="code" href="structDSDPDualMat__C.html" title="Represents an S matrix for one block in the semidefinite cone.">DSDPDualMat</a> S){ <a name="l00141"></a>00141 <span class="keywordtype">int</span> info; <a name="l00142"></a>00142 DSDPFunctionBegin; <a name="l00143"></a>00143 <span class="keywordflow">if</span> (S.dsdpops->matview){ <a name="l00144"></a>00144 info=(S.dsdpops->matview)(S.matdata); DSDPChkDMatError(S,info); <a name="l00145"></a>00145 } <span class="keywordflow">else</span> { <a name="l00146"></a>00146 DSDPNoOperationError(S); <a name="l00147"></a>00147 } <a name="l00148"></a>00148 DSDPFunctionReturn(0); <a name="l00149"></a>00149 } <a name="l00150"></a>00150 <a name="l00151"></a>00151 <a name="l00152"></a>00152 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00153"></a>00153 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDualMatSetArray"</span> <a name="l00154"></a>00154 <span class="preprocessor"></span> <a name="l00160"></a><a class="code" href="dsdpdualmat_8h.html#a428752e66255f0112be45d61633bd504">00160</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdualmat_8c.html#af90a72f8db701ea0462ce8068d826fab" title="Print the matrix.">DSDPDualMatSetArray</a>(<a class="code" href="structDSDPDualMat__C.html" title="Represents an S matrix for one block in the semidefinite cone.">DSDPDualMat</a> S, <a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> T){ <a name="l00161"></a>00161 <span class="keywordtype">double</span> *ss; <a name="l00162"></a>00162 <span class="keywordtype">int</span> info,n,nn; <a name="l00163"></a>00163 DSDPFunctionBegin; <a name="l00164"></a>00164 <span class="keywordflow">if</span> (S.dsdpops->matseturmat){ <a name="l00165"></a>00165 info=<a class="code" href="dsdpxmat_8c.html#a41e9d8b32dd9a96f4b9480f831edfb3d" title="Get number of rows and columns.">DSDPVMatGetSize</a>(T,&n); DSDPCHKERR(info); <a name="l00166"></a>00166 info=<a class="code" href="dsdpxmat_8c.html#a3601c3a4974f85d70476152aeebb8a6d" title="Get the array that stores the matrix.">DSDPVMatGetArray</a>(T,&ss,&nn); DSDPCHKERR(info); <a name="l00167"></a>00167 info=(S.dsdpops->matseturmat)(S.matdata,ss,nn,n); DSDPChkDMatError(S,info); <a name="l00168"></a>00168 info=<a class="code" href="dsdpxmat_8c.html#a45cd417f498392df8fe1f8afca6cff8b" title="Restore the array that stores the matrix.">DSDPVMatRestoreArray</a>(T,&ss,&nn); DSDPCHKERR(info); <a name="l00169"></a>00169 } <span class="keywordflow">else</span> { <a name="l00170"></a>00170 DSDPNoOperationError(S); <a name="l00171"></a>00171 } <a name="l00172"></a>00172 DSDPFunctionReturn(0); <a name="l00173"></a>00173 } <a name="l00174"></a>00174 <a name="l00175"></a>00175 <a name="l00176"></a>00176 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00177"></a>00177 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDualMatInvert"</span> <a name="l00178"></a>00178 <span class="preprocessor"></span> <a name="l00186"></a><a class="code" href="dsdpdualmat_8h.html#ad03eafe8cd47c9c434aa457d07bdfa62">00186</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdualmat_8c.html#afc103268b635e313f90431f9eca7c85f" title="Invert the matrix.">DSDPDualMatInvert</a>(<a class="code" href="structDSDPDualMat__C.html" title="Represents an S matrix for one block in the semidefinite cone.">DSDPDualMat</a> S){ <a name="l00187"></a>00187 <span class="keywordtype">int</span> info; <a name="l00188"></a>00188 DSDPFunctionBegin; <a name="l00189"></a>00189 <span class="comment">/* DSDPEventLogBegin(sdpdualinvert); */</span> <a name="l00190"></a>00190 <span class="keywordflow">if</span> (S.dsdpops->matinvert){ <a name="l00191"></a>00191 info=(S.dsdpops->matinvert)(S.matdata); DSDPChkDMatError(S,info); <a name="l00192"></a>00192 } <span class="keywordflow">else</span> { <a name="l00193"></a>00193 DSDPNoOperationError(S); <a name="l00194"></a>00194 } <a name="l00195"></a>00195 <span class="comment">/* DSDPEventLogEnd(sdpdualinvert); */</span> <a name="l00196"></a>00196 DSDPFunctionReturn(0); <a name="l00197"></a>00197 } <a name="l00198"></a>00198 <a name="l00199"></a>00199 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00200"></a>00200 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDualMatInverseAdd"</span> <a name="l00201"></a>00201 <span class="preprocessor"></span> <a name="l00209"></a><a class="code" href="dsdpdualmat_8h.html#ae6fbd8170d318528e66da5b6539c741f">00209</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdualmat_8c.html#a3dc27b759db28929d92bd3a63b632681" title="Add a multiple of the inverse to T.">DSDPDualMatInverseAdd</a>(<a class="code" href="structDSDPDualMat__C.html" title="Represents an S matrix for one block in the semidefinite cone.">DSDPDualMat</a> S, <span class="keywordtype">double</span> alpha, <a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> T){ <a name="l00210"></a>00210 <span class="keywordtype">int</span> info,n,nn; <a name="l00211"></a>00211 <span class="keywordtype">double</span> *ss; <a name="l00212"></a>00212 DSDPFunctionBegin; <a name="l00213"></a>00213 <span class="keywordflow">if</span> (S.dsdpops->matinverseadd){ <a name="l00214"></a>00214 info=<a class="code" href="dsdpxmat_8c.html#a41e9d8b32dd9a96f4b9480f831edfb3d" title="Get number of rows and columns.">DSDPVMatGetSize</a>(T,&n); DSDPCHKERR(info); <a name="l00215"></a>00215 info=<a class="code" href="dsdpxmat_8c.html#a3601c3a4974f85d70476152aeebb8a6d" title="Get the array that stores the matrix.">DSDPVMatGetArray</a>(T,&ss,&nn); DSDPCHKERR(info); <a name="l00216"></a>00216 info=(S.dsdpops->matinverseadd)(S.matdata,alpha,ss,nn,n); DSDPChkDMatError(S,info); <a name="l00217"></a>00217 info=<a class="code" href="dsdpxmat_8c.html#a45cd417f498392df8fe1f8afca6cff8b" title="Restore the array that stores the matrix.">DSDPVMatRestoreArray</a>(T,&ss,&nn); DSDPCHKERR(info); <a name="l00218"></a>00218 } <span class="keywordflow">else</span> { <a name="l00219"></a>00219 DSDPNoOperationError(S); <a name="l00220"></a>00220 } <a name="l00221"></a>00221 DSDPFunctionReturn(0); <a name="l00222"></a>00222 } <a name="l00223"></a>00223 <a name="l00224"></a>00224 <a name="l00225"></a>00225 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00226"></a>00226 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDualMatInverseMultiply"</span> <a name="l00227"></a>00227 <span class="preprocessor"></span> <a name="l00236"></a><a class="code" href="dsdpdualmat_8h.html#a78d0f738ea97f707d4a6d331088350a7">00236</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdualmat_8c.html#ae31b03506a9c2aa5ebd33f1e0a00308c" title="Multiply the inverse by a vector or solve the system of equations.">DSDPDualMatInverseMultiply</a>(<a class="code" href="structDSDPDualMat__C.html" title="Represents an S matrix for one block in the semidefinite cone.">DSDPDualMat</a> S, DSDPIndex IS, <a class="code" href="structSDPConeVec__C.html" title="Vector whose length corresponds to dimension of a block in a cone.">SDPConeVec</a> B, <a class="code" href="structSDPConeVec__C.html" title="Vector whose length corresponds to dimension of a block in a cone.">SDPConeVec</a> X){ <a name="l00237"></a>00237 <span class="keywordtype">int</span> info,n; <a name="l00238"></a>00238 <span class="keywordtype">double</span> *bb,*xx; <a name="l00239"></a>00239 DSDPFunctionBegin; <a name="l00240"></a>00240 DSDPEventLogBegin(sdpdualsolve); <a name="l00241"></a>00241 <span class="keywordflow">if</span> (S.dsdpops->matinversemultiply){ <a name="l00242"></a>00242 info=SDPConeVecGetSize(X,&n); DSDPCHKERR(info); <a name="l00243"></a>00243 info=SDPConeVecGetArray(B,&bb); DSDPCHKERR(info); <a name="l00244"></a>00244 info=SDPConeVecGetArray(X,&xx); DSDPCHKERR(info); <a name="l00245"></a>00245 info=(S.dsdpops->matinversemultiply)(S.matdata,IS.indx+1,IS.indx[0],bb,xx,n); DSDPChkDMatError(S,info); <a name="l00246"></a>00246 info=SDPConeVecRestoreArray(X,&xx); DSDPCHKERR(info); <a name="l00247"></a>00247 info=SDPConeVecRestoreArray(B,&bb); DSDPCHKERR(info); <a name="l00248"></a>00248 } <span class="keywordflow">else</span> { <a name="l00249"></a>00249 DSDPNoOperationError(S); <a name="l00250"></a>00250 } <a name="l00251"></a>00251 DSDPEventLogEnd(sdpdualsolve); <a name="l00252"></a>00252 DSDPFunctionReturn(0); <a name="l00253"></a>00253 } <a name="l00254"></a>00254 <a name="l00255"></a>00255 <a name="l00256"></a>00256 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00257"></a>00257 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDualMatCholeskySolveForward"</span> <a name="l00258"></a>00258 <span class="preprocessor"></span> <a name="l00267"></a><a class="code" href="dsdpdualmat_8h.html#ae20ab247149d001be237556ad766f378">00267</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdualmat_8c.html#aa64bc6161dd47646962c7226982f6d62" title="Forward triangular solve.">DSDPDualMatCholeskySolveForward</a>(<a class="code" href="structDSDPDualMat__C.html" title="Represents an S matrix for one block in the semidefinite cone.">DSDPDualMat</a> S, <a class="code" href="structSDPConeVec__C.html" title="Vector whose length corresponds to dimension of a block in a cone.">SDPConeVec</a> B, <a class="code" href="structSDPConeVec__C.html" title="Vector whose length corresponds to dimension of a block in a cone.">SDPConeVec</a> X){ <a name="l00268"></a>00268 <span class="keywordtype">int</span> info,n; <a name="l00269"></a>00269 <span class="keywordtype">double</span> *bb,*xx; <a name="l00270"></a>00270 DSDPFunctionBegin; <a name="l00271"></a>00271 <span class="keywordflow">if</span> (S.dsdpops->matsolveforward){ <a name="l00272"></a>00272 info=SDPConeVecGetSize(X,&n); DSDPCHKERR(info); <a name="l00273"></a>00273 info=SDPConeVecGetArray(B,&bb); DSDPCHKERR(info); <a name="l00274"></a>00274 info=SDPConeVecGetArray(X,&xx); DSDPCHKERR(info); <a name="l00275"></a>00275 info=(S.dsdpops->matsolveforward)(S.matdata,bb,xx,n); DSDPChkDMatError(S,info); <a name="l00276"></a>00276 info=SDPConeVecRestoreArray(X,&xx); DSDPCHKERR(info); <a name="l00277"></a>00277 info=SDPConeVecRestoreArray(B,&bb); DSDPCHKERR(info); <a name="l00278"></a>00278 } <span class="keywordflow">else</span> { <a name="l00279"></a>00279 DSDPNoOperationError(S); <a name="l00280"></a>00280 } <a name="l00281"></a>00281 DSDPFunctionReturn(0); <a name="l00282"></a>00282 } <a name="l00283"></a>00283 <a name="l00284"></a>00284 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00285"></a>00285 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDualMatDualMatCholeskySolveBackward"</span> <a name="l00286"></a>00286 <span class="preprocessor"></span> <a name="l00295"></a><a class="code" href="dsdpdualmat_8h.html#aa3c38f98b494c0e8a004ff8ccb4e34fa">00295</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdualmat_8c.html#a853fa8c51c83aa5f2e0c6923f76e0ee4" title="Backward triangular solve.">DSDPDualMatCholeskySolveBackward</a>(<a class="code" href="structDSDPDualMat__C.html" title="Represents an S matrix for one block in the semidefinite cone.">DSDPDualMat</a> S, <a class="code" href="structSDPConeVec__C.html" title="Vector whose length corresponds to dimension of a block in a cone.">SDPConeVec</a> B, <a class="code" href="structSDPConeVec__C.html" title="Vector whose length corresponds to dimension of a block in a cone.">SDPConeVec</a> X){ <a name="l00296"></a>00296 <span class="keywordtype">int</span> info,n; <a name="l00297"></a>00297 <span class="keywordtype">double</span> *bb,*xx; <a name="l00298"></a>00298 DSDPFunctionBegin; <a name="l00299"></a>00299 <span class="keywordflow">if</span> (S.dsdpops->matsolvebackward){ <a name="l00300"></a>00300 info=SDPConeVecGetSize(X,&n); DSDPCHKERR(info); <a name="l00301"></a>00301 info=SDPConeVecGetArray(B,&bb); DSDPCHKERR(info); <a name="l00302"></a>00302 info=SDPConeVecGetArray(X,&xx); DSDPCHKERR(info); <a name="l00303"></a>00303 info=(S.dsdpops->matsolvebackward)(S.matdata,bb,xx,n); DSDPChkDMatError(S,info); <a name="l00304"></a>00304 info=SDPConeVecRestoreArray(X,&xx); DSDPCHKERR(info); <a name="l00305"></a>00305 info=SDPConeVecRestoreArray(B,&bb); DSDPCHKERR(info); <a name="l00306"></a>00306 } <span class="keywordflow">else</span> { <a name="l00307"></a>00307 DSDPNoOperationError(S); <a name="l00308"></a>00308 } <a name="l00309"></a>00309 DSDPFunctionReturn(0); <a name="l00310"></a>00310 } <a name="l00311"></a>00311 <a name="l00312"></a>00312 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00313"></a>00313 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDualMatCholeskyFactor"</span> <a name="l00314"></a>00314 <span class="preprocessor"></span> <a name="l00320"></a><a class="code" href="dsdpdualmat_8h.html#a9c3ab55e6791129ced2ffb70a9483874">00320</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdualmat_8c.html#a45b26d8bf109509648dd87b42305ee0c" title="Factor the matrix.">DSDPDualMatCholeskyFactor</a>(<a class="code" href="structDSDPDualMat__C.html" title="Represents an S matrix for one block in the semidefinite cone.">DSDPDualMat</a> S,<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65" title="Boolean variables.">DSDPTruth</a> *psdefinite){ <a name="l00321"></a>00321 <span class="keywordtype">int</span> info; <a name="l00322"></a>00322 <span class="keywordtype">int</span> flag; <a name="l00323"></a>00323 DSDPFunctionBegin; <a name="l00324"></a>00324 <span class="keywordflow">if</span> (S.dsdpops->matcholesky){ <a name="l00325"></a>00325 info=(S.dsdpops->matcholesky)(S.matdata,&flag); DSDPChkDMatError(S,info); <a name="l00326"></a>00326 } <span class="keywordflow">else</span> { <a name="l00327"></a>00327 DSDPNoOperationError(S); <a name="l00328"></a>00328 } <a name="l00329"></a>00329 <span class="keywordflow">if</span> (flag) *psdefinite=<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65a74385569aa7a59059a8847e2d39b754c">DSDP_FALSE</a>; <a name="l00330"></a>00330 <span class="keywordflow">else</span> *psdefinite=<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65ae6b2e53e51e94a5fa7204ceac78f824f">DSDP_TRUE</a>; <a name="l00331"></a>00331 DSDPFunctionReturn(0); <a name="l00332"></a>00332 } <a name="l00333"></a>00333 <a name="l00334"></a>00334 <a name="l00335"></a>00335 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00336"></a>00336 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDualMatCholeskyForwardMultiply"</span> <a name="l00337"></a>00337 <span class="preprocessor"></span> <a name="l00346"></a><a class="code" href="dsdpdualmat_8h.html#a89de5c333248b6324602ddad20539696">00346</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdualmat_8c.html#a54f20cca5ca8bf569944da1ae3ab4c80" title="Multiply by triangular matrix.">DSDPDualMatCholeskyForwardMultiply</a>(<a class="code" href="structDSDPDualMat__C.html" title="Represents an S matrix for one block in the semidefinite cone.">DSDPDualMat</a> S, <a class="code" href="structSDPConeVec__C.html" title="Vector whose length corresponds to dimension of a block in a cone.">SDPConeVec</a> B, <a class="code" href="structSDPConeVec__C.html" title="Vector whose length corresponds to dimension of a block in a cone.">SDPConeVec</a> X){ <a name="l00347"></a>00347 <span class="keywordtype">int</span> info,n; <a name="l00348"></a>00348 <span class="keywordtype">double</span> *bb,*xx; <a name="l00349"></a>00349 DSDPFunctionBegin; <a name="l00350"></a>00350 <span class="keywordflow">if</span> (S.dsdpops->matforwardmultiply){ <a name="l00351"></a>00351 info=SDPConeVecGetSize(B,&n); DSDPCHKERR(info); <a name="l00352"></a>00352 info=SDPConeVecGetArray(B,&bb); DSDPCHKERR(info); <a name="l00353"></a>00353 info=SDPConeVecGetArray(X,&xx); DSDPCHKERR(info); <a name="l00354"></a>00354 info=(S.dsdpops->matforwardmultiply)(S.matdata,bb,xx,n); DSDPChkDMatError(S,info); <a name="l00355"></a>00355 info=SDPConeVecRestoreArray(X,&xx); DSDPCHKERR(info); <a name="l00356"></a>00356 info=SDPConeVecRestoreArray(B,&bb); DSDPCHKERR(info); <a name="l00357"></a>00357 } <span class="keywordflow">else</span> { <a name="l00358"></a>00358 DSDPNoOperationError(S); <a name="l00359"></a>00359 } <a name="l00360"></a>00360 DSDPFunctionReturn(0); <a name="l00361"></a>00361 } <a name="l00362"></a>00362 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00363"></a>00363 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDualMatCholeskyBackwardMultiply"</span> <a name="l00364"></a>00364 <span class="preprocessor"></span> <a name="l00373"></a><a class="code" href="dsdpdualmat_8h.html#a6c0bda5dd0bb79c3dd4ae1846bb091ed">00373</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdualmat_8c.html#a530c6baf5c27b0d240c92e5541e17866" title="Multiply by triangular matrix.">DSDPDualMatCholeskyBackwardMultiply</a>(<a class="code" href="structDSDPDualMat__C.html" title="Represents an S matrix for one block in the semidefinite cone.">DSDPDualMat</a> S, <a class="code" href="structSDPConeVec__C.html" title="Vector whose length corresponds to dimension of a block in a cone.">SDPConeVec</a> B, <a class="code" href="structSDPConeVec__C.html" title="Vector whose length corresponds to dimension of a block in a cone.">SDPConeVec</a> X){ <a name="l00374"></a>00374 <span class="keywordtype">int</span> info,n; <a name="l00375"></a>00375 <span class="keywordtype">double</span> *bb,*xx; <a name="l00376"></a>00376 DSDPFunctionBegin; <a name="l00377"></a>00377 <span class="keywordflow">if</span> (S.dsdpops->matbackwardmultiply){ <a name="l00378"></a>00378 info=SDPConeVecGetSize(B,&n); DSDPCHKERR(info); <a name="l00379"></a>00379 info=SDPConeVecGetArray(B,&bb); DSDPCHKERR(info); <a name="l00380"></a>00380 info=SDPConeVecGetArray(X,&xx); DSDPCHKERR(info); <a name="l00381"></a>00381 info=(S.dsdpops->matbackwardmultiply)(S.matdata,bb,xx,n); DSDPChkDMatError(S,info); <a name="l00382"></a>00382 info=SDPConeVecRestoreArray(X,&xx); DSDPCHKERR(info); <a name="l00383"></a>00383 info=SDPConeVecRestoreArray(B,&bb); DSDPCHKERR(info); <a name="l00384"></a>00384 } <span class="keywordflow">else</span> { <a name="l00385"></a>00385 DSDPNoOperationError(S); <a name="l00386"></a>00386 } <a name="l00387"></a>00387 DSDPFunctionReturn(0); <a name="l00388"></a>00388 } <a name="l00389"></a>00389 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00390"></a>00390 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDualMatIsFull"</span> <a name="l00391"></a>00391 <span class="preprocessor"></span> <a name="l00397"></a><a class="code" href="dsdpdualmat_8h.html#ae3e46593440342ef785b727cc657315a">00397</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdualmat_8c.html#aca0745e1337928a255ee3906acd69fa3" title="Factor the matrix.">DSDPDualMatIsFull</a>(<a class="code" href="structDSDPDualMat__C.html" title="Represents an S matrix for one block in the semidefinite cone.">DSDPDualMat</a> S, <a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65" title="Boolean variables.">DSDPTruth</a> *full){ <a name="l00398"></a>00398 <span class="keywordtype">int</span> info,flag=0; <a name="l00399"></a>00399 DSDPFunctionBegin; <a name="l00400"></a>00400 *full=<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65a74385569aa7a59059a8847e2d39b754c">DSDP_FALSE</a>; <a name="l00401"></a>00401 <span class="keywordflow">if</span> (S.dsdpops->matfull){ <a name="l00402"></a>00402 info=(S.dsdpops->matfull)(S.matdata,&flag); DSDPChkDMatError(S,info); <a name="l00403"></a>00403 } <span class="keywordflow">else</span> { <a name="l00404"></a>00404 DSDPNoOperationError(S); <a name="l00405"></a>00405 } <a name="l00406"></a>00406 <span class="keywordflow">if</span> (flag) *full=<a class="code" href="dsdpbasictypes_8h.html#ae667f2bff3ab5ab0bc109fa76dc4ed65ae6b2e53e51e94a5fa7204ceac78f824f">DSDP_TRUE</a>; <a name="l00407"></a>00407 DSDPFunctionReturn(0); <a name="l00408"></a>00408 } <a name="l00409"></a>00409 <a name="l00410"></a>00410 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00411"></a>00411 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDataMatCheck"</span> <a name="l00412"></a>00412 <span class="preprocessor"></span><span class="keywordtype">int</span> DSDPDualMatCheck(<a class="code" href="structDSDPDualMat__C.html" title="Represents an S matrix for one block in the semidefinite cone.">DSDPDualMat</a> SS, <a class="code" href="structSDPConeVec__C.html" title="Vector whose length corresponds to dimension of a block in a cone.">SDPConeVec</a> W1, <a class="code" href="structSDPConeVec__C.html" title="Vector whose length corresponds to dimension of a block in a cone.">SDPConeVec</a> W2, DSDPIndex IS, <a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> XX){ <a name="l00413"></a>00413 DSDPFunctionBegin; <a name="l00414"></a>00414 DSDPFunctionReturn(0); <a name="l00415"></a>00415 } <a name="l00416"></a>00416 <a name="l00417"></a>00417 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* dualmatname=<span class="stringliteral">"NOT SET YET"</span>; <a name="l00423"></a><a class="code" href="dsdpdualmat__impl_8h.html#a6c7e3de21d702d3f55fb3fb9a80d7d85">00423</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdualmat_8c.html#a80e8f72d7a1720fbe7563b2f57acd5c6" title="Set pointers to null.">DSDPDualMatOpsInitialize</a>(<span class="keyword">struct</span> <a class="code" href="structDSDPDualMat__Ops.html" title="Table of function pointers that operate on the S matrix.">DSDPDualMat_Ops</a>* sops){ <a name="l00424"></a>00424 <span class="keywordflow">if</span> (sops==NULL) <span class="keywordflow">return</span> 0; <a name="l00425"></a>00425 sops->matseturmat=0; <a name="l00426"></a>00426 sops->matgetarray=0; <a name="l00427"></a>00427 sops->matcholesky=0; <a name="l00428"></a>00428 sops->matsolveforward=0; <a name="l00429"></a>00429 sops->matsolvebackward=0; <a name="l00430"></a>00430 sops->matinvert=0; <a name="l00431"></a>00431 sops->matinverseadd=0; <a name="l00432"></a>00432 sops->matinversemultiply=0; <a name="l00433"></a>00433 sops->matforwardmultiply=0; <a name="l00434"></a>00434 sops->matbackwardmultiply=0; <a name="l00435"></a>00435 sops->matfull=0; <a name="l00436"></a>00436 sops->matdestroy=0; <a name="l00437"></a>00437 sops->matgetsize=0; <a name="l00438"></a>00438 sops->matview=0; <a name="l00439"></a>00439 sops->matlogdet=0; <a name="l00440"></a>00440 sops->matname=dualmatname; <a name="l00441"></a>00441 <span class="keywordflow">return</span> 0; <a name="l00442"></a>00442 } <a name="l00443"></a>00443 <a name="l00444"></a>00444 <a name="l00445"></a>00445 <span class="keyword">static</span> <span class="keyword">struct </span><a class="code" href="structDSDPDualMat__Ops.html" title="Table of function pointers that operate on the S matrix.">DSDPDualMat_Ops</a> dsdpdualmatopsdefault; <a name="l00446"></a>00446 <a name="l00447"></a>00447 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00448"></a>00448 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDualMatTest"</span> <a name="l00449"></a>00449 <span class="preprocessor"></span><span class="keywordtype">int</span> DSDPDualMatTest(<a class="code" href="structDSDPDualMat__C.html" title="Represents an S matrix for one block in the semidefinite cone.">DSDPDualMat</a> S){ <a name="l00450"></a>00450 <span class="keywordtype">int</span> info; <a name="l00451"></a>00451 DSDPFunctionBegin; <a name="l00452"></a>00452 <span class="keywordflow">if</span> (S.dsdpops==0 || S.dsdpops==&dsdpdualmatopsdefault){ <a name="l00453"></a>00453 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (S.dsdpops->mattest){ <a name="l00454"></a>00454 info=(S.dsdpops->mattest)(S.matdata); DSDPChkDMatError(S,info); <a name="l00455"></a>00455 } <span class="keywordflow">else</span> { <a name="l00456"></a>00456 <span class="comment">/*</span> <a name="l00457"></a>00457 <span class="comment"> DSDPNoOperationError(S);</span> <a name="l00458"></a>00458 <span class="comment"> */</span> <a name="l00459"></a>00459 } <a name="l00460"></a>00460 DSDPFunctionReturn(0); <a name="l00461"></a>00461 } <a name="l00462"></a>00462 <a name="l00463"></a>00463 <a name="l00464"></a>00464 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00465"></a>00465 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDualMatInitialize"</span> <a name="l00466"></a>00466 <span class="preprocessor"></span> <a name="l00471"></a><a class="code" href="dsdpdualmat_8h.html#a4328f3aefa00cba6eeeeff4a8cc3060b">00471</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdualmat_8c.html#a23fcb33f75e4ba4aa70cf519123745c4" title="Set pointers to null.">DSDPDualMatInitialize</a>(<a class="code" href="structDSDPDualMat__C.html" title="Represents an S matrix for one block in the semidefinite cone.">DSDPDualMat</a> *S){ <a name="l00472"></a>00472 <span class="keywordtype">int</span> info; <a name="l00473"></a>00473 DSDPFunctionBegin; <a name="l00474"></a>00474 info=<a class="code" href="dsdpdualmat_8c.html#a80e8f72d7a1720fbe7563b2f57acd5c6" title="Set pointers to null.">DSDPDualMatOpsInitialize</a>(&dsdpdualmatopsdefault);DSDPCHKERR(info); <a name="l00475"></a>00475 info=<a class="code" href="dsdpdualmat_8c.html#abed50bfcc211bee6e8b9a070f909f0cf" title="Set the opaque pointer and function pointers to the matrix.">DSDPDualMatSetData</a>(S,&dsdpdualmatopsdefault,0); DSDPCHKERR(info); <a name="l00476"></a>00476 DSDPFunctionReturn(0); <a name="l00477"></a>00477 } <a name="l00478"></a>00478 </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>