Sophie

Sophie

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

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>DSDP: src/sdp/dsdpxmat.c Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.4 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">DSDP</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="dir_23046874d7fed141927c769a66d8e3a5.html">src</a>      </li>
      <li class="navelem"><a class="el" href="dir_2c21778722bc8593635d5ebd154ac3f7.html">sdp</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">dsdpxmat.c</div>  </div>
</div>
<div class="contents">
<a href="dsdpxmat_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#include &quot;<a class="code" href="dsdpxmat__impl_8h.html" title="Structure of function pointers that each dense matrix array type (upper full, packed symmetric...">dsdpxmat_impl.h</a>&quot;</span>
<a name="l00002"></a>00002 <span class="preprocessor">#include &quot;<a class="code" href="dsdpxmat_8h.html" title="The interface between the SDPCone and the dense matrix array.">dsdpxmat.h</a>&quot;</span>
<a name="l00003"></a>00003 <span class="preprocessor">#include &quot;<a class="code" href="dsdpsys_8h.html" title="Error handling, printing, and profiling.">dsdpsys.h</a>&quot;</span>
<a name="l00009"></a>00009 <span class="preprocessor">#define DSDPNoOperationError(a);  { DSDPSETERR1(1,&quot;X Matrix type: %s, Operation not defined. Perhaps no X matrix has been set.\n&quot;,(a).dsdpops-&gt;matname); }</span>
<a name="l00010"></a>00010 <span class="preprocessor"></span><span class="preprocessor">#define DSDPChkMatError(a,b);  { if (b){ DSDPSETERR1(b,&quot;X Matrix type: %s,\n&quot;,(a).dsdpops-&gt;matname);} }</span>
<a name="l00011"></a>00011 <span class="preprocessor"></span>
<a name="l00012"></a>00012 <span class="keyword">static</span> <span class="keywordtype">int</span> sdpxmatevent=0;
<a name="l00013"></a>00013 
<a name="l00014"></a>00014 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00015"></a>00015 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPVMatEventZero&quot;</span>
<a name="l00016"></a>00016 <span class="preprocessor"></span><span class="keywordtype">int</span> DSDPVMatEventZero(<span class="keywordtype">void</span>){
<a name="l00017"></a>00017   DSDPFunctionBegin;
<a name="l00018"></a>00018   sdpxmatevent=0;
<a name="l00019"></a>00019   DSDPFunctionReturn(0);
<a name="l00020"></a>00020 }
<a name="l00021"></a>00021 
<a name="l00022"></a>00022 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPVMatEventInitialize&quot;</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span><span class="keywordtype">int</span> DSDPVMatEventInitialize(<span class="keywordtype">void</span>){
<a name="l00025"></a>00025   DSDPFunctionBegin;
<a name="l00026"></a>00026   <span class="keywordflow">if</span> (sdpxmatevent==0){DSDPEventLogRegister(<span class="stringliteral">&quot;SDP X+vv&#39;&quot;</span>,&amp;sdpxmatevent);}
<a name="l00027"></a>00027   DSDPFunctionReturn(0);
<a name="l00028"></a>00028 }
<a name="l00029"></a>00029 
<a name="l00030"></a>00030 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00031"></a>00031 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPVMatSetData&quot;</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span>
<a name="l00039"></a><a class="code" href="dsdpxmat_8h.html#a0c8dfba186ed05b2442f087c433c0b67">00039</a> <span class="keywordtype">int</span> <a class="code" href="dsdpxmat_8c.html#a2db9226fa07b55d2ec6d04ce1cd6b43a" title="Set opaque pointer an function pointers.">DSDPVMatSetData</a>(<a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> *X, <span class="keyword">struct</span> <a class="code" href="structDSDPVMat__Ops.html" title="Table of function pointers that operate on the dense matrix.">DSDPVMat_Ops</a>* ops,  <span class="keywordtype">void</span>*data){
<a name="l00040"></a>00040   <span class="keywordtype">int</span> info;
<a name="l00041"></a>00041   DSDPFunctionBegin;
<a name="l00042"></a>00042   (*X).dsdpops=ops;
<a name="l00043"></a>00043   (*X).matdata=data;
<a name="l00044"></a>00044   info=<a class="code" href="dsdpxmat_8c.html#a3a78806350cbbb37f85e899d88a3c28a" title="Test validity of matrix.">DSDPVMatTest</a>(*X);DSDPCHKERR(info);
<a name="l00045"></a>00045   DSDPFunctionReturn(0); 
<a name="l00046"></a>00046 }
<a name="l00047"></a>00047 
<a name="l00048"></a>00048 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00049"></a>00049 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPVMatGetType&quot;</span>
<a name="l00050"></a>00050 <span class="preprocessor"></span><span class="keywordtype">int</span> DSDPVMatGetType(<a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> X, <span class="keywordtype">int</span> *<span class="keywordtype">id</span>){
<a name="l00051"></a>00051   DSDPFunctionBegin;
<a name="l00052"></a>00052   *<span class="keywordtype">id</span>=X.dsdpops-&gt;id;
<a name="l00053"></a>00053   DSDPFunctionReturn(0); 
<a name="l00054"></a>00054 }
<a name="l00055"></a>00055 
<a name="l00056"></a>00056 
<a name="l00057"></a>00057 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00058"></a>00058 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPVMatGetSize&quot;</span>
<a name="l00059"></a>00059 <span class="preprocessor"></span>
<a name="l00065"></a><a class="code" href="dsdpxmat_8h.html#a80caf45c3a6ae35eb516bd51691af288">00065</a> <span class="keywordtype">int</span> <a class="code" href="dsdpxmat_8c.html#a41e9d8b32dd9a96f4b9480f831edfb3d" title="Get number of rows and columns.">DSDPVMatGetSize</a>(<a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> X,<span class="keywordtype">int</span>*n){
<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> (X.dsdpops-&gt;matgetsize){
<a name="l00069"></a>00069     info=(X.dsdpops-&gt;matgetsize)(X.matdata,n); DSDPChkMatError(X,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(X);</span>
<a name="l00073"></a>00073 <span class="comment">    */</span>
<a name="l00074"></a>00074   }
<a name="l00075"></a>00075   DSDPFunctionReturn(0);
<a name="l00076"></a>00076 }
<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__ &quot;DSDPVMatDestroy&quot;</span>
<a name="l00081"></a>00081 <span class="preprocessor"></span>
<a name="l00086"></a><a class="code" href="dsdpxmat_8h.html#ad3d76fc844cc260be8ef0b08a43a1ce6">00086</a> <span class="keywordtype">int</span> <a class="code" href="dsdpxmat_8c.html#acb23f3beb4969a6d69d1e3af7ccba034" title="Deallocate matrix.">DSDPVMatDestroy</a>(<a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> *X){
<a name="l00087"></a>00087   <span class="keywordtype">int</span> info;
<a name="l00088"></a>00088   DSDPFunctionBegin;
<a name="l00089"></a>00089   <span class="keywordflow">if</span> (!(*X).dsdpops){ <span class="keywordflow">return</span> 0;}
<a name="l00090"></a>00090   <span class="keywordflow">if</span> ((*X).dsdpops-&gt;matdestroy){
<a name="l00091"></a>00091     info=((*X).dsdpops-&gt;matdestroy)((*X).matdata); DSDPChkMatError(*X,info);
<a name="l00092"></a>00092   } <span class="keywordflow">else</span> {
<a name="l00093"></a>00093     <span class="comment">/*  DSDPNoOperationError(*X); */</span>
<a name="l00094"></a>00094   }
<a name="l00095"></a>00095   info=<a class="code" href="dsdpxmat_8c.html#a0088d6c397591c98f9e52a019c385304" title="Set pointers to null.">DSDPVMatInitialize</a>(X); DSDPCHKERR(info);
<a name="l00096"></a>00096   DSDPFunctionReturn(0);
<a name="l00097"></a>00097 }
<a name="l00098"></a>00098 
<a name="l00099"></a>00099 
<a name="l00100"></a>00100 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00101"></a>00101 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPVMatView&quot;</span>
<a name="l00102"></a>00102 <span class="preprocessor"></span>
<a name="l00107"></a><a class="code" href="dsdpxmat_8h.html#a633819a447ad869ad64987030da9f48c">00107</a> <span class="keywordtype">int</span> <a class="code" href="dsdpxmat_8c.html#afa0b2c0d0c9ec7c7f9842d1db778a5b3" title="Print matrix.">DSDPVMatView</a>(<a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> X){
<a name="l00108"></a>00108   <span class="keywordtype">int</span> info;
<a name="l00109"></a>00109   <span class="keywordflow">if</span> (X.dsdpops-&gt;matview){
<a name="l00110"></a>00110     info=(X.dsdpops-&gt;matview)(X.matdata); DSDPChkMatError(X,info);
<a name="l00111"></a>00111   } <span class="keywordflow">else</span> {
<a name="l00112"></a>00112     printf(<span class="stringliteral">&quot;No viewer available for matrix type: %d&quot;</span>,X.dsdpops-&gt;id);
<a name="l00113"></a>00113   }
<a name="l00114"></a>00114   DSDPFunctionReturn(0);
<a name="l00115"></a>00115 }
<a name="l00116"></a>00116 
<a name="l00117"></a>00117 
<a name="l00118"></a>00118 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00119"></a>00119 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPVMatZeroEntries&quot;</span>
<a name="l00120"></a>00120 <span class="preprocessor"></span>
<a name="l00125"></a><a class="code" href="dsdpxmat_8h.html#ab834fedbcdef02171e00baafe9009379">00125</a> <span class="keywordtype">int</span> <a class="code" href="dsdpxmat_8c.html#a9bf5b99c68ebd39086408bcdc430caa6" title="Zero matrix.">DSDPVMatZeroEntries</a>(<a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> X){
<a name="l00126"></a>00126   <span class="keywordtype">int</span> info;
<a name="l00127"></a>00127   DSDPFunctionBegin;
<a name="l00128"></a>00128   <span class="keywordflow">if</span> (X.dsdpops-&gt;matzeroentries){
<a name="l00129"></a>00129     info=(X.dsdpops-&gt;matzeroentries)(X.matdata); DSDPChkMatError(X,info);
<a name="l00130"></a>00130   } <span class="keywordflow">else</span> {
<a name="l00131"></a>00131     DSDPNoOperationError(X);
<a name="l00132"></a>00132   }
<a name="l00133"></a>00133   DSDPFunctionReturn(0);
<a name="l00134"></a>00134 }
<a name="l00135"></a>00135 
<a name="l00136"></a>00136 
<a name="l00137"></a>00137 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00138"></a>00138 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPVMatScaleDiagonal&quot;</span>
<a name="l00139"></a>00139 <span class="preprocessor"></span>
<a name="l00147"></a><a class="code" href="dsdpxmat_8h.html#ae49f7c6ac1d914f57490387c7e36d992">00147</a> <span class="keywordtype">int</span> <a class="code" href="dsdpxmat_8c.html#ad8fc8d36269ab08a81f4c55d21fd1663" title="Scaling diagonal is useful for inner products and norms.">DSDPVMatScaleDiagonal</a>(<a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> X, <span class="keywordtype">double</span> dscale){
<a name="l00148"></a>00148   <span class="keywordtype">int</span> info;
<a name="l00149"></a>00149   DSDPFunctionBegin;
<a name="l00150"></a>00150   <span class="keywordflow">if</span> (X.dsdpops-&gt;matscalediagonal){
<a name="l00151"></a>00151     info=(X.dsdpops-&gt;matscalediagonal)(X.matdata,dscale); DSDPChkMatError(X,info);
<a name="l00152"></a>00152   } <span class="keywordflow">else</span> {
<a name="l00153"></a>00153     DSDPNoOperationError(X);
<a name="l00154"></a>00154   }
<a name="l00155"></a>00155   DSDPFunctionReturn(0);
<a name="l00156"></a>00156 }
<a name="l00157"></a>00157 
<a name="l00158"></a>00158 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00159"></a>00159 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPVMatShiftDiagonal&quot;</span>
<a name="l00160"></a>00160 <span class="preprocessor"></span>
<a name="l00166"></a><a class="code" href="dsdpxmat_8h.html#adce0e3d8d66dc8a29aae11e33e7bf3c8">00166</a> <span class="keywordtype">int</span> <a class="code" href="dsdpxmat_8c.html#a5d9a41fd2b127f8662e73d068d1ce99d" title="Add something to diagonal elements.">DSDPVMatShiftDiagonal</a>(<a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> X, <span class="keywordtype">double</span> dadd){
<a name="l00167"></a>00167   <span class="keywordtype">int</span> info;
<a name="l00168"></a>00168   DSDPFunctionBegin;
<a name="l00169"></a>00169   <span class="keywordflow">if</span> (X.dsdpops-&gt;matshiftdiagonal){
<a name="l00170"></a>00170     info=(X.dsdpops-&gt;matshiftdiagonal)(X.matdata,dadd); DSDPChkMatError(X,info);
<a name="l00171"></a>00171   } <span class="keywordflow">else</span> {
<a name="l00172"></a>00172     DSDPNoOperationError(X);
<a name="l00173"></a>00173   }
<a name="l00174"></a>00174   DSDPFunctionReturn(0);
<a name="l00175"></a>00175 }
<a name="l00176"></a>00176 
<a name="l00177"></a>00177 
<a name="l00178"></a>00178 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00179"></a>00179 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPVMatNormF2&quot;</span>
<a name="l00180"></a>00180 <span class="preprocessor"></span>
<a name="l00186"></a><a class="code" href="dsdpxmat_8h.html#a1aa3de899d15b9fe9664b7054ba9f4f3">00186</a> <span class="keywordtype">int</span> <a class="code" href="dsdpxmat_8c.html#a26bd5f85f0e340f7c89215efc22f0e57" title="Compute square of Frobenius norm of matrix.">DSDPVMatNormF2</a>(<a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> X, <span class="keywordtype">double</span>*normf2){
<a name="l00187"></a>00187   <span class="keywordtype">int</span> info,n;
<a name="l00188"></a>00188   <span class="keywordtype">double</span> *dd;
<a name="l00189"></a>00189   DSDPFunctionBegin;
<a name="l00190"></a>00190   <span class="keywordflow">if</span> (X.dsdpops-&gt;matfnorm2){
<a name="l00191"></a>00191     info=<a class="code" href="dsdpxmat_8c.html#a3601c3a4974f85d70476152aeebb8a6d" title="Get the array that stores the matrix.">DSDPVMatGetArray</a>(X,&amp;dd,&amp;n); DSDPCHKERR(info);
<a name="l00192"></a>00192     info=(X.dsdpops-&gt;matfnorm2)(X.matdata,n,normf2); DSDPChkMatError(X,info);
<a name="l00193"></a>00193     info=<a class="code" href="dsdpxmat_8c.html#a45cd417f498392df8fe1f8afca6cff8b" title="Restore the array that stores the matrix.">DSDPVMatRestoreArray</a>(X,&amp;dd,&amp;n); DSDPCHKERR(info);
<a name="l00194"></a>00194   } <span class="keywordflow">else</span> {
<a name="l00195"></a>00195     DSDPNoOperationError(X);
<a name="l00196"></a>00196   }
<a name="l00197"></a>00197   DSDPFunctionReturn(0);
<a name="l00198"></a>00198 }
<a name="l00199"></a>00199 
<a name="l00200"></a>00200 
<a name="l00201"></a>00201 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00202"></a>00202 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPVMatGetArray&quot;</span>
<a name="l00203"></a>00203 <span class="preprocessor"></span>
<a name="l00211"></a><a class="code" href="dsdpxmat_8h.html#a2dbbee8cbbc43063f8b81296916f70ff">00211</a> <span class="keywordtype">int</span> <a class="code" href="dsdpxmat_8c.html#a3601c3a4974f85d70476152aeebb8a6d" title="Get the array that stores the matrix.">DSDPVMatGetArray</a>(<a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> X, <span class="keywordtype">double</span> **v, <span class="keywordtype">int</span> *nn){
<a name="l00212"></a>00212   <span class="keywordtype">int</span> info;
<a name="l00213"></a>00213   DSDPFunctionBegin;
<a name="l00214"></a>00214   <span class="keywordflow">if</span> (X.dsdpops-&gt;matgeturarray){
<a name="l00215"></a>00215     info=(X.dsdpops-&gt;matgeturarray)(X.matdata,v,nn); DSDPChkMatError(X,info);
<a name="l00216"></a>00216   } <span class="keywordflow">else</span> {
<a name="l00217"></a>00217     *v=0;
<a name="l00218"></a>00218     *nn=0;
<a name="l00219"></a>00219   }
<a name="l00220"></a>00220   DSDPFunctionReturn(0);
<a name="l00221"></a>00221 }
<a name="l00222"></a>00222 
<a name="l00223"></a>00223 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00224"></a>00224 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPVMatRestoreArray&quot;</span>
<a name="l00225"></a>00225 <span class="preprocessor"></span>
<a name="l00233"></a><a class="code" href="dsdpxmat_8h.html#a1ae7cb06407b93154dfdce1c51bebd0d">00233</a> <span class="keywordtype">int</span> <a class="code" href="dsdpxmat_8c.html#a45cd417f498392df8fe1f8afca6cff8b" title="Restore the array that stores the matrix.">DSDPVMatRestoreArray</a>(<a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> X, <span class="keywordtype">double</span> **v, <span class="keywordtype">int</span> *nn){
<a name="l00234"></a>00234   <span class="keywordtype">int</span> info;
<a name="l00235"></a>00235   DSDPFunctionBegin;
<a name="l00236"></a>00236   <span class="keywordflow">if</span> (X.dsdpops-&gt;matrestoreurarray){
<a name="l00237"></a>00237     info=(X.dsdpops-&gt;matrestoreurarray)(X.matdata,v,nn); DSDPChkMatError(X,info);
<a name="l00238"></a>00238   } <span class="keywordflow">else</span> {
<a name="l00239"></a>00239     *v=0;
<a name="l00240"></a>00240     *nn=0;
<a name="l00241"></a>00241   }
<a name="l00242"></a>00242   DSDPFunctionReturn(0);
<a name="l00243"></a>00243 }
<a name="l00244"></a>00244 
<a name="l00245"></a>00245 
<a name="l00246"></a>00246 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00247"></a>00247 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPVMatMinEigenvalue&quot;</span>
<a name="l00248"></a>00248 <span class="preprocessor"></span><span class="keywordtype">int</span> DSDPVMatMinEigenvalue(<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="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, <span class="keywordtype">double</span> *mineig){
<a name="l00249"></a>00249   <span class="keywordtype">int</span> n,info;
<a name="l00250"></a>00250   <span class="keywordtype">double</span> *w,*iwork;
<a name="l00251"></a>00251   DSDPFunctionBegin;
<a name="l00252"></a>00252   <span class="keywordflow">if</span> (X.dsdpops-&gt;matmineig){
<a name="l00253"></a>00253     info=SDPConeVecGetSize(W1,&amp;n); DSDPCHKERR(info);
<a name="l00254"></a>00254     info=SDPConeVecGetArray(W1,&amp;w); DSDPCHKERR(info);
<a name="l00255"></a>00255     info=SDPConeVecGetArray(W2,&amp;iwork); DSDPCHKERR(info);
<a name="l00256"></a>00256     info=(X.dsdpops-&gt;matmineig)(X.matdata,w,iwork,n,mineig); DSDPChkMatError(X,info);
<a name="l00257"></a>00257     info=SDPConeVecRestoreArray(W1,&amp;w); DSDPCHKERR(info);
<a name="l00258"></a>00258     info=SDPConeVecRestoreArray(W2,&amp;iwork); DSDPCHKERR(info);
<a name="l00259"></a>00259   } <span class="keywordflow">else</span> {
<a name="l00260"></a>00260     DSDPNoOperationError(X);
<a name="l00261"></a>00261   }
<a name="l00262"></a>00262   DSDPFunctionReturn(0);
<a name="l00263"></a>00263 }
<a name="l00264"></a>00264 
<a name="l00265"></a>00265 
<a name="l00266"></a>00266 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00267"></a>00267 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPVMatAddOuterProduct&quot;</span>
<a name="l00268"></a>00268 <span class="preprocessor"></span>
<a name="l00275"></a><a class="code" href="dsdpxmat_8h.html#a284be1d3d9b41d7506231d98e326f038">00275</a> <span class="keywordtype">int</span> <a class="code" href="dsdpxmat_8c.html#aaa8cdde5690e6a567cf6a9ea82bc90f2" title="Add outer product of a vector to the matrix.">DSDPVMatAddOuterProduct</a>(<a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> X, <span class="keywordtype">double</span> alpha, <a class="code" href="structSDPConeVec__C.html" title="Vector whose length corresponds to dimension of a block in a cone.">SDPConeVec</a> V){
<a name="l00276"></a>00276   <span class="keywordtype">int</span> info,n;
<a name="l00277"></a>00277   <span class="keywordtype">double</span> *v;
<a name="l00278"></a>00278   DSDPFunctionBegin;
<a name="l00279"></a>00279   DSDPEventLogBegin(sdpxmatevent);
<a name="l00280"></a>00280   info=SDPConeVecGetSize(V,&amp;n); DSDPCHKERR(info);
<a name="l00281"></a>00281   <span class="keywordflow">if</span> (X.dsdpops-&gt;mataddouterproduct){
<a name="l00282"></a>00282     info=SDPConeVecGetArray(V,&amp;v); DSDPCHKERR(info);
<a name="l00283"></a>00283     info=(X.dsdpops-&gt;mataddouterproduct)(X.matdata,alpha,v,n); DSDPChkMatError(X,info);
<a name="l00284"></a>00284     info=SDPConeVecRestoreArray(V,&amp;v); DSDPCHKERR(info);
<a name="l00285"></a>00285   } <span class="keywordflow">else</span> {
<a name="l00286"></a>00286     DSDPNoOperationError(X);
<a name="l00287"></a>00287   }
<a name="l00288"></a>00288   DSDPEventLogEnd(sdpxmatevent);
<a name="l00289"></a>00289   DSDPFunctionReturn(0);
<a name="l00290"></a>00290 }
<a name="l00291"></a>00291 
<a name="l00292"></a>00292 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00293"></a>00293 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPVMatMult&quot;</span>
<a name="l00294"></a>00294 <span class="preprocessor"></span>
<a name="l00301"></a><a class="code" href="dsdpxmat_8h.html#a7d34a7ca0469338d3230e8650ca32bbf">00301</a> <span class="keywordtype">int</span> <a class="code" href="dsdpxmat_8c.html#aaeb6e1bdb3b88f647f81e2319d614543" title="Multiply X by a vector.">DSDPVMatMult</a>(<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="structSDPConeVec__C.html" title="Vector whose length corresponds to dimension of a block in a cone.">SDPConeVec</a> Z, <a class="code" href="structSDPConeVec__C.html" title="Vector whose length corresponds to dimension of a block in a cone.">SDPConeVec</a> Y){
<a name="l00302"></a>00302   <span class="keywordtype">int</span> info,n;
<a name="l00303"></a>00303   <span class="keywordtype">double</span> *z,*y;
<a name="l00304"></a>00304   DSDPFunctionBegin;
<a name="l00305"></a>00305   info=SDPConeVecGetSize(Y,&amp;n); DSDPCHKERR(info);
<a name="l00306"></a>00306   <span class="keywordflow">if</span> (X.dsdpops-&gt;matmult){
<a name="l00307"></a>00307     info=SDPConeVecGetArray(Z,&amp;z); DSDPCHKERR(info);
<a name="l00308"></a>00308     info=SDPConeVecGetArray(Y,&amp;y); DSDPCHKERR(info);
<a name="l00309"></a>00309     info=(X.dsdpops-&gt;matmult)(X.matdata,z,y,n); DSDPChkMatError(X,info);
<a name="l00310"></a>00310     info=SDPConeVecRestoreArray(Z,&amp;z); DSDPCHKERR(info);
<a name="l00311"></a>00311     info=SDPConeVecRestoreArray(Y,&amp;y); DSDPCHKERR(info);
<a name="l00312"></a>00312   } <span class="keywordflow">else</span> {
<a name="l00313"></a>00313     DSDPNoOperationError(X);
<a name="l00314"></a>00314   }
<a name="l00315"></a>00315   DSDPFunctionReturn(0);
<a name="l00316"></a>00316 }
<a name="l00317"></a>00317  
<a name="l00318"></a>00318 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00319"></a>00319 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPVMatCheck&quot;</span>
<a name="l00320"></a>00320 <span class="preprocessor"></span>
<a name="l00327"></a><a class="code" href="dsdpxmat_8h.html#a26b73676bec11d2bf9010d96d1da6691">00327</a> <span class="keywordtype">int</span> <a class="code" href="dsdpxmat_8c.html#ac754c2e4d97bfe8c7245ccb8be67d5d3" title="Test correctness of operations.">DSDPVMatCheck</a>(<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="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){
<a name="l00328"></a>00328   <span class="keywordtype">int</span> info,i,n,nn;
<a name="l00329"></a>00329   <span class="keywordtype">double</span> *xx,eig,eps=1e-13,one=1.0;
<a name="l00330"></a>00330   <span class="keywordtype">double</span> fnorm0,fnorm1,fnorm2,fnorm3,fnorm4;
<a name="l00331"></a>00331   DSDPFunctionBegin;
<a name="l00332"></a>00332   info=<a class="code" href="dsdpxmat_8c.html#a41e9d8b32dd9a96f4b9480f831edfb3d" title="Get number of rows and columns.">DSDPVMatGetSize</a>(X,&amp;n);DSDPCHKERR(info);
<a name="l00333"></a>00333   info=<a class="code" href="sdpconevec_8c.html#aecbde49bc8a9f21a21f8910ee3605753" title="Set each element of vector to this number.">SDPConeVecSet</a>(one,W1);DSDPCHKERR(info);
<a name="l00334"></a>00334   info=<a class="code" href="dsdpxmat_8c.html#aaa8cdde5690e6a567cf6a9ea82bc90f2" title="Add outer product of a vector to the matrix.">DSDPVMatAddOuterProduct</a>(X,1.23456,W1);DSDPCHKERR(info);
<a name="l00335"></a>00335   info=<a class="code" href="dsdpxmat_8c.html#a9bf5b99c68ebd39086408bcdc430caa6" title="Zero matrix.">DSDPVMatZeroEntries</a>(X);DSDPCHKERR(info);
<a name="l00336"></a>00336   info=<a class="code" href="dsdpxmat_8c.html#a26bd5f85f0e340f7c89215efc22f0e57" title="Compute square of Frobenius norm of matrix.">DSDPVMatNormF2</a>(X,&amp;fnorm0);DSDPCHKERR(info);
<a name="l00337"></a>00337   <span class="keywordflow">if</span> (fabs(fnorm0)&gt;eps){ printf(<span class="stringliteral">&quot;Check DSDPVMatZero of DSDPVMatNorm\n&quot;</span>);}
<a name="l00338"></a>00338   
<a name="l00339"></a>00339   info=<a class="code" href="sdpconevec_8c.html#aecbde49bc8a9f21a21f8910ee3605753" title="Set each element of vector to this number.">SDPConeVecSet</a>(one,W1);DSDPCHKERR(info);
<a name="l00340"></a>00340   info=<a class="code" href="dsdpxmat_8c.html#aaa8cdde5690e6a567cf6a9ea82bc90f2" title="Add outer product of a vector to the matrix.">DSDPVMatAddOuterProduct</a>(X,1.0,W1);DSDPCHKERR(info);
<a name="l00341"></a>00341   info=<a class="code" href="dsdpxmat_8c.html#a26bd5f85f0e340f7c89215efc22f0e57" title="Compute square of Frobenius norm of matrix.">DSDPVMatNormF2</a>(X,&amp;fnorm1);DSDPCHKERR(info);
<a name="l00342"></a>00342   <span class="keywordflow">if</span> (fabs(fnorm1-n*n)&gt;eps) printf(<span class="stringliteral">&quot;Check DSDPVMatZero()\n&quot;</span>);
<a name="l00343"></a>00343 
<a name="l00344"></a>00344   info=<a class="code" href="dsdpxmat_8c.html#a3601c3a4974f85d70476152aeebb8a6d" title="Get the array that stores the matrix.">DSDPVMatGetArray</a>(X,&amp;xx,&amp;nn);DSDPCHKERR(info);
<a name="l00345"></a>00345   <span class="keywordflow">for</span> (i=0;i&lt;nn;i++){xx[i]=1.0;}
<a name="l00346"></a>00346   info=<a class="code" href="dsdpxmat_8c.html#a45cd417f498392df8fe1f8afca6cff8b" title="Restore the array that stores the matrix.">DSDPVMatRestoreArray</a>(X,&amp;xx,&amp;nn);DSDPCHKERR(info);
<a name="l00347"></a>00347   info=<a class="code" href="dsdpxmat_8c.html#a26bd5f85f0e340f7c89215efc22f0e57" title="Compute square of Frobenius norm of matrix.">DSDPVMatNormF2</a>(X,&amp;fnorm2);DSDPCHKERR(info);
<a name="l00348"></a>00348   <span class="keywordflow">if</span> (fabs(fnorm2-n*n)&gt;eps) printf(<span class="stringliteral">&quot;Check DSDPXGetArray()\n&quot;</span>);
<a name="l00349"></a>00349 
<a name="l00350"></a>00350   info=<a class="code" href="dsdpxmat_8c.html#aaa8cdde5690e6a567cf6a9ea82bc90f2" title="Add outer product of a vector to the matrix.">DSDPVMatAddOuterProduct</a>(X,-1.0,W1);DSDPCHKERR(info);
<a name="l00351"></a>00351   info=<a class="code" href="dsdpxmat_8c.html#a26bd5f85f0e340f7c89215efc22f0e57" title="Compute square of Frobenius norm of matrix.">DSDPVMatNormF2</a>(X,&amp;fnorm3);DSDPCHKERR(info);
<a name="l00352"></a>00352 
<a name="l00353"></a>00353   info=<a class="code" href="dsdpxmat_8c.html#a9bf5b99c68ebd39086408bcdc430caa6" title="Zero matrix.">DSDPVMatZeroEntries</a>(X);DSDPCHKERR(info);
<a name="l00354"></a>00354   info=<a class="code" href="dsdpxmat_8c.html#aaa8cdde5690e6a567cf6a9ea82bc90f2" title="Add outer product of a vector to the matrix.">DSDPVMatAddOuterProduct</a>(X,1.0,W1);DSDPCHKERR(info);
<a name="l00355"></a>00355   info=<a class="code" href="dsdpxmat_8c.html#ad8fc8d36269ab08a81f4c55d21fd1663" title="Scaling diagonal is useful for inner products and norms.">DSDPVMatScaleDiagonal</a>(X,2.0);DSDPCHKERR(info);
<a name="l00356"></a>00356 
<a name="l00357"></a>00357   info=<a class="code" href="dsdpxmat_8c.html#a9bf5b99c68ebd39086408bcdc430caa6" title="Zero matrix.">DSDPVMatZeroEntries</a>(X);DSDPCHKERR(info);
<a name="l00358"></a>00358   info=<a class="code" href="dsdpxmat_8c.html#aaa8cdde5690e6a567cf6a9ea82bc90f2" title="Add outer product of a vector to the matrix.">DSDPVMatAddOuterProduct</a>(X,1.0,W1);DSDPCHKERR(info);
<a name="l00359"></a>00359   info=<a class="code" href="dsdpxmat_8c.html#a5d9a41fd2b127f8662e73d068d1ce99d" title="Add something to diagonal elements.">DSDPVMatShiftDiagonal</a>(X,1.0);DSDPCHKERR(info);
<a name="l00360"></a>00360   info=<a class="code" href="dsdpxmat_8c.html#a26bd5f85f0e340f7c89215efc22f0e57" title="Compute square of Frobenius norm of matrix.">DSDPVMatNormF2</a>(X,&amp;fnorm4);DSDPCHKERR(info);
<a name="l00361"></a>00361 
<a name="l00362"></a>00362   info=<a class="code" href="dsdpxmat_8c.html#aaeb6e1bdb3b88f647f81e2319d614543" title="Multiply X by a vector.">DSDPVMatMult</a>(X,W1,W2);DSDPCHKERR(info);
<a name="l00363"></a>00363   info=DSDPVMatMinEigenvalue(X,W1,W2,&amp;eig);DSDPCHKERR(info);
<a name="l00364"></a>00364   <span class="keywordflow">if</span> (fabs(fnorm0)&gt;eps) printf(<span class="stringliteral">&quot;Check DSDPVMatZero()\n&quot;</span>);
<a name="l00365"></a>00365   DSDPFunctionReturn(0);
<a name="l00366"></a>00366 }
<a name="l00367"></a>00367 
<a name="l00368"></a>00368 <span class="keyword">static</span> <span class="keyword">struct  </span><a class="code" href="structDSDPVMat__Ops.html" title="Table of function pointers that operate on the dense matrix.">DSDPVMat_Ops</a> dsdpmatops2;
<a name="l00369"></a>00369 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *urmatname=<span class="stringliteral">&quot;NOT SET YET&quot;</span>;
<a name="l00370"></a>00370 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00371"></a>00371 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPVMatOpsInitialize&quot;</span>
<a name="l00372"></a>00372 <span class="preprocessor"></span>
<a name="l00377"></a><a class="code" href="dsdpxmat__impl_8h.html#ad0a62c7c6a62805d1fa284314e9bc47f">00377</a> <span class="keywordtype">int</span> <a class="code" href="dsdpxmat_8c.html#ae77a160b7956ada5f40e0ac5085e1e10" title="Set function pointers to null.">DSDPVMatOpsInitialize</a>(<span class="keyword">struct</span>  <a class="code" href="structDSDPVMat__Ops.html" title="Table of function pointers that operate on the dense matrix.">DSDPVMat_Ops</a>*aops){
<a name="l00378"></a>00378   aops-&gt;matgetsize=0;
<a name="l00379"></a>00379   aops-&gt;matzeroentries=0;
<a name="l00380"></a>00380   aops-&gt;matfnorm2=0;
<a name="l00381"></a>00381   aops-&gt;mataddouterproduct=0;
<a name="l00382"></a>00382   aops-&gt;matmult=0;
<a name="l00383"></a>00383   aops-&gt;matgeturarray=0;
<a name="l00384"></a>00384   aops-&gt;matrestoreurarray=0;
<a name="l00385"></a>00385   aops-&gt;matview=0;
<a name="l00386"></a>00386   aops-&gt;matdestroy=0;
<a name="l00387"></a>00387   aops-&gt;matmineig=0;
<a name="l00388"></a>00388   aops-&gt;matshiftdiagonal=0;
<a name="l00389"></a>00389   aops-&gt;matscalediagonal=0;
<a name="l00390"></a>00390   aops-&gt;id=0;
<a name="l00391"></a>00391   aops-&gt;matname=urmatname;
<a name="l00392"></a>00392   <span class="keywordflow">return</span> 0;
<a name="l00393"></a>00393 }
<a name="l00394"></a>00394 
<a name="l00395"></a>00395 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00396"></a>00396 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPVMatTest&quot;</span>
<a name="l00397"></a>00397 <span class="preprocessor"></span>
<a name="l00402"></a><a class="code" href="dsdpxmat_8h.html#a04e686a069bab9332cafbddd31773348">00402</a> <span class="keywordtype">int</span> <a class="code" href="dsdpxmat_8c.html#a3a78806350cbbb37f85e899d88a3c28a" title="Test validity of matrix.">DSDPVMatTest</a>(<a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> X){
<a name="l00403"></a>00403   <span class="keywordtype">int</span> info;
<a name="l00404"></a>00404   DSDPFunctionBegin;
<a name="l00405"></a>00405   <span class="keywordflow">if</span> (X.dsdpops==0 || X.dsdpops==&amp;dsdpmatops2){
<a name="l00406"></a>00406   } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (X.dsdpops-&gt;mattest){
<a name="l00407"></a>00407     info=(X.dsdpops-&gt;mattest)(X.matdata); DSDPChkMatError(X,info);
<a name="l00408"></a>00408   } <span class="keywordflow">else</span> {
<a name="l00409"></a>00409     <span class="comment">/*</span>
<a name="l00410"></a>00410 <span class="comment">    DSDPNoOperationError(X);</span>
<a name="l00411"></a>00411 <span class="comment">    */</span>
<a name="l00412"></a>00412   }
<a name="l00413"></a>00413   DSDPFunctionReturn(0);
<a name="l00414"></a>00414 }
<a name="l00415"></a>00415  
<a name="l00416"></a>00416 
<a name="l00417"></a>00417 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00418"></a>00418 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPVMatInitialize&quot;</span>
<a name="l00419"></a>00419 <span class="preprocessor"></span>
<a name="l00424"></a><a class="code" href="dsdpxmat_8h.html#ab580f1eea417f2c182377b01d1fe4abd">00424</a> <span class="keywordtype">int</span> <a class="code" href="dsdpxmat_8c.html#a0088d6c397591c98f9e52a019c385304" title="Set pointers to null.">DSDPVMatInitialize</a>(<a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> *B){
<a name="l00425"></a>00425   <span class="keywordtype">int</span> info;
<a name="l00426"></a>00426   DSDPFunctionBegin;
<a name="l00427"></a>00427   info=<a class="code" href="dsdpxmat_8c.html#ae77a160b7956ada5f40e0ac5085e1e10" title="Set function pointers to null.">DSDPVMatOpsInitialize</a>(&amp;dsdpmatops2); DSDPCHKERR(info);
<a name="l00428"></a>00428   info=<a class="code" href="dsdpxmat_8c.html#a2db9226fa07b55d2ec6d04ce1cd6b43a" title="Set opaque pointer an function pointers.">DSDPVMatSetData</a>(B, &amp;dsdpmatops2, 0); DSDPCHKERR(info);
<a name="l00429"></a>00429   DSDPFunctionReturn(0);
<a name="l00430"></a>00430 }
<a name="l00431"></a>00431 
<a name="l00432"></a>00432 <span class="preprocessor">#undef __FUNCT__</span>
<a name="l00433"></a>00433 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPVMatExist&quot;</span>
<a name="l00434"></a>00434 <span class="preprocessor"></span>
<a name="l00440"></a><a class="code" href="dsdpxmat_8h.html#a3ef2ae254d88c9ebb7176486094ca926">00440</a> <span class="keywordtype">int</span> <a class="code" href="dsdpxmat_8c.html#aae8cc5530449adc05a8f13d7ee56d00a" title="Answer whether the array has been allocated or not.">DSDPVMatExist</a>(<a class="code" href="structDSDPVMat__C.html" title="Dense symmetric matrix for one block in the semidefinite cone.">DSDPVMat</a> X,<span class="keywordtype">int</span> *flag){
<a name="l00441"></a>00441   DSDPFunctionBegin;
<a name="l00442"></a>00442   <span class="keywordflow">if</span> (X.dsdpops &amp;&amp; X.dsdpops!=&amp;dsdpmatops2) *flag=1;
<a name="l00443"></a>00443   <span class="keywordflow">else</span> *flag=0;
<a name="l00444"></a>00444   DSDPFunctionReturn(0);
<a name="l00445"></a>00445 }
<a name="l00446"></a>00446 
</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>