<!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/dsdpdatamat.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">dsdpdatamat.c</div> </div> </div> <div class="contents"> <a href="dsdpdatamat_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="dsdpdatamat__impl_8h.html" title="Structure of function pointers that each SDP data matrix type (sparse, dense, constant, identity, ...) must implement.">dsdpdatamat_impl.h</a>"</span> <a name="l00002"></a>00002 <span class="preprocessor">#include "<a class="code" href="dsdpdatamat_8h.html" title="The interface between the SDPCone and the data matrices.">dsdpdatamat.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="l00008"></a>00008 <span class="preprocessor">#define DSDPNoOperationError(a); { DSDPSETERR1(1,"Data natrix type: %s, Operation not defined\n",(a).dsdpops->matname); }</span> <a name="l00009"></a>00009 <span class="preprocessor"></span><span class="preprocessor">#define DSDPChkDataError(a,b); { if (b){ DSDPSETERR1(b,"Data natrix type: %s,\n",(a).dsdpops->matname);} }</span> <a name="l00010"></a>00010 <span class="preprocessor"></span> <a name="l00011"></a>00011 <a name="l00012"></a>00012 <span class="keyword">static</span> <span class="keyword">struct </span><a class="code" href="structDSDPDataMat__Ops.html" title="Table of function pointers that operate on the data matrix.">DSDPDataMat_Ops</a> dsdpdatamatdefault; <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__ "DSDPDataMatSetData"</span> <a name="l00016"></a>00016 <span class="preprocessor"></span> <a name="l00025"></a><a class="code" href="dsdpdatamat_8h.html#af0318f79397685f447800dc1e07d2d20">00025</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdatamat_8c.html#a830de0c064b4d8b3109755fe0c3db05c" title="Set the opaque pointer and function pointers to the matrix.">DSDPDataMatSetData</a>(<a class="code" href="structDSDPDataMat__C.html" title="Symmetric data matrix for one block in the semidefinite cone.">DSDPDataMat</a> *A, <span class="keyword">struct</span> <a class="code" href="structDSDPDataMat__Ops.html" title="Table of function pointers that operate on the data matrix.">DSDPDataMat_Ops</a>* ops, <span class="keywordtype">void</span>*data){ <a name="l00026"></a>00026 <span class="keywordtype">int</span> info; <a name="l00027"></a>00027 DSDPFunctionBegin; <a name="l00028"></a>00028 (*A).dsdpops=ops; <a name="l00029"></a>00029 (*A).matdata=data; <a name="l00030"></a>00030 <span class="keywordflow">if</span> (ops==NULL){ <a name="l00031"></a>00031 (*A).dsdpops=&dsdpdatamatdefault; <a name="l00032"></a>00032 } <a name="l00033"></a>00033 info = <a class="code" href="dsdpdatamat_8c.html#a5d7a246134aa5186463e0f1f0fd561bd" title="Initialize the table of function pointers for SDP Data matrices.">DSDPDataMatOpsInitialize</a>(&dsdpdatamatdefault); DSDPCHKERR(info); <a name="l00034"></a>00034 info=<a class="code" href="dsdpdatamat_8c.html#ad664aefaf46e5967727acc54339e23f8" title="Test validity of matrix.">DSDPDataMatTest</a>(*A);DSDPCHKERR(info); <a name="l00035"></a>00035 DSDPFunctionReturn(0); <a name="l00036"></a>00036 } <a name="l00037"></a>00037 <a name="l00038"></a>00038 <span class="keyword">static</span> <span class="keywordtype">char</span> datamatnoname[20]=<span class="stringliteral">"MATRIX NOT SET"</span>; <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__ "DSDPDataMatOpsInitialize"</span> <a name="l00041"></a>00041 <span class="preprocessor"></span> <a name="l00047"></a><a class="code" href="dsdpdatamat__impl_8h.html#aacbfb44021312f0b59e234f29d730c8e">00047</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdatamat_8c.html#a5d7a246134aa5186463e0f1f0fd561bd" title="Initialize the table of function pointers for SDP Data matrices.">DSDPDataMatOpsInitialize</a>(<span class="keyword">struct</span> <a class="code" href="structDSDPDataMat__Ops.html" title="Table of function pointers that operate on the data matrix.">DSDPDataMat_Ops</a>* dops){ <a name="l00048"></a>00048 DSDPFunctionBegin; <a name="l00049"></a>00049 <span class="keywordflow">if</span> (dops==NULL) <span class="keywordflow">return</span> 0; <a name="l00050"></a>00050 dops->matfactor1=0; <a name="l00051"></a>00051 dops->matfactor2=0; <a name="l00052"></a>00052 dops->matgetrank=0; <a name="l00053"></a>00053 dops->matgeteig=0; <a name="l00054"></a>00054 dops->matvecvec=0; <a name="l00055"></a>00055 dops->matdot=0; <a name="l00056"></a>00056 dops->mataddrowmultiple=0; <a name="l00057"></a>00057 dops->mataddallmultiple=0; <a name="l00058"></a>00058 dops->matdestroy=0; <a name="l00059"></a>00059 dops->matview=0; <a name="l00060"></a>00060 dops->matrownz=0; <a name="l00061"></a>00061 dops->matnnz=0; <a name="l00062"></a>00062 dops->matfnorm2=0; <a name="l00063"></a>00063 dops->id=0; <a name="l00064"></a>00064 dops->matname=datamatnoname; <a name="l00065"></a>00065 DSDPFunctionReturn(0); <a name="l00066"></a>00066 } <a name="l00067"></a>00067 <a name="l00068"></a>00068 <a name="l00069"></a>00069 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00070"></a>00070 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDataMatInitialize" </span> <a name="l00071"></a>00071 <span class="preprocessor"></span> <a name="l00078"></a><a class="code" href="dsdpdatamat_8h.html#ae3b3d5d6ee23a615fb649c0532fc0520">00078</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdatamat_8c.html#af1e1ced742957d981e57ca7bb042bd84" title="Set pointers to NULL;.">DSDPDataMatInitialize</a>(<a class="code" href="structDSDPDataMat__C.html" title="Symmetric data matrix for one block in the semidefinite cone.">DSDPDataMat</a> *A){ <a name="l00079"></a>00079 <span class="keywordtype">int</span> info; <a name="l00080"></a>00080 DSDPFunctionBegin; <a name="l00081"></a>00081 info = <a class="code" href="dsdpdatamat_8c.html#a5d7a246134aa5186463e0f1f0fd561bd" title="Initialize the table of function pointers for SDP Data matrices.">DSDPDataMatOpsInitialize</a>(&dsdpdatamatdefault); DSDPCHKERR(info); <a name="l00082"></a>00082 info = <a class="code" href="dsdpdatamat_8c.html#a830de0c064b4d8b3109755fe0c3db05c" title="Set the opaque pointer and function pointers to the matrix.">DSDPDataMatSetData</a>(A, &dsdpdatamatdefault,0); DSDPCHKERR(info); <a name="l00083"></a>00083 DSDPFunctionReturn(0); <a name="l00084"></a>00084 } <a name="l00085"></a>00085 <a name="l00086"></a>00086 <a name="l00087"></a>00087 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00088"></a>00088 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDataMatTest"</span> <a name="l00089"></a>00089 <span class="preprocessor"></span> <a name="l00096"></a><a class="code" href="dsdpdatamat_8h.html#a1c817deb41f660beba606e2d2e09ee2d">00096</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdatamat_8c.html#ad664aefaf46e5967727acc54339e23f8" title="Test validity of matrix.">DSDPDataMatTest</a>(<a class="code" href="structDSDPDataMat__C.html" title="Symmetric data matrix for one block in the semidefinite cone.">DSDPDataMat</a> A){ <a name="l00097"></a>00097 <span class="keywordtype">int</span> info; <a name="l00098"></a>00098 DSDPFunctionBegin; <a name="l00099"></a>00099 <span class="keywordflow">if</span> (A.dsdpops==0 || A.dsdpops==&dsdpdatamatdefault){ <a name="l00100"></a>00100 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (A.dsdpops->mattest){ <a name="l00101"></a>00101 info=(A.dsdpops->mattest)(A.matdata); DSDPChkDataError(A,info); <a name="l00102"></a>00102 } <span class="keywordflow">else</span> { <a name="l00103"></a>00103 <span class="comment">/*</span> <a name="l00104"></a>00104 <span class="comment"> DSDPNoOperationError(A);</span> <a name="l00105"></a>00105 <span class="comment"> */</span> <a name="l00106"></a>00106 } <a name="l00107"></a>00107 DSDPFunctionReturn(0); <a name="l00108"></a>00108 } <a name="l00109"></a>00109 <a name="l00110"></a>00110 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00111"></a>00111 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDataMatGetType"</span> <a name="l00112"></a>00112 <span class="preprocessor"></span><span class="keywordtype">int</span> DSDPDataMatGetType(<a class="code" href="structDSDPDataMat__C.html" title="Symmetric data matrix for one block in the semidefinite cone.">DSDPDataMat</a> A, <span class="keywordtype">int</span> *<span class="keywordtype">id</span>){ <a name="l00113"></a>00113 DSDPFunctionBegin; <a name="l00114"></a>00114 *<span class="keywordtype">id</span>=A.dsdpops->id; <a name="l00115"></a>00115 DSDPFunctionReturn(0); <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__ "DSDPDataMatGetRank"</span> <a name="l00120"></a>00120 <span class="preprocessor"></span> <a name="l00129"></a><a class="code" href="dsdpdatamat_8h.html#a55a1cfd38c8f7587bf65780e36885ae5">00129</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdatamat_8c.html#a935d091cc12e6ce7ec0a8126b4f18df1" title="Get the number of nonzero eigenvalues/eigenvectors for the matrix.">DSDPDataMatGetRank</a>(<a class="code" href="structDSDPDataMat__C.html" title="Symmetric data matrix for one block in the semidefinite cone.">DSDPDataMat</a> A, <span class="keywordtype">int</span> *rank, <span class="keywordtype">int</span> n){ <a name="l00130"></a>00130 <span class="keywordtype">int</span> info; <a name="l00131"></a>00131 DSDPFunctionBegin; <a name="l00132"></a>00132 <span class="keywordflow">if</span> (A.dsdpops->matgetrank){ <a name="l00133"></a>00133 info=(A.dsdpops->matgetrank)(A.matdata,rank,n); DSDPChkDataError(A,info); <a name="l00134"></a>00134 } <span class="keywordflow">else</span> { <a name="l00135"></a>00135 DSDPNoOperationError(A); <a name="l00136"></a>00136 } <a name="l00137"></a>00137 DSDPFunctionReturn(0); <a name="l00138"></a>00138 } <a name="l00139"></a>00139 <a name="l00140"></a>00140 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00141"></a>00141 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDataMatCountNonzeros"</span> <a name="l00142"></a>00142 <span class="preprocessor"></span> <a name="l00152"></a><a class="code" href="dsdpdatamat_8h.html#adf689c6b02ee9552c2e1663dfa4f8048">00152</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdatamat_8c.html#ab728c1dc951c326d197490022b917c52" title="Compute the square of the Frobenius norm.">DSDPDataMatCountNonzeros</a>(<a class="code" href="structDSDPDataMat__C.html" title="Symmetric data matrix for one block in the semidefinite cone.">DSDPDataMat</a> A, <span class="keywordtype">int</span> *nnz, <span class="keywordtype">int</span> n){ <a name="l00153"></a>00153 <span class="keywordtype">int</span> info; <a name="l00154"></a>00154 DSDPFunctionBegin; <a name="l00155"></a>00155 <span class="keywordflow">if</span> (A.dsdpops->matnnz){ <a name="l00156"></a>00156 info=(A.dsdpops->matnnz)(A.matdata,nnz,n); DSDPChkDataError(A,info); <a name="l00157"></a>00157 } <span class="keywordflow">else</span> { <a name="l00158"></a>00158 DSDPNoOperationError(A); <a name="l00159"></a>00159 } <a name="l00160"></a>00160 DSDPFunctionReturn(0); <a name="l00161"></a>00161 } <a name="l00162"></a>00162 <a name="l00163"></a>00163 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00164"></a>00164 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDataMatFNorm2"</span> <a name="l00165"></a>00165 <span class="preprocessor"></span> <a name="l00175"></a><a class="code" href="dsdpdatamat_8h.html#adf8da8a1bf2b41a54a970a6ad8fe790c">00175</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdatamat_8c.html#acbe7617266068f6ae91884e7652c2e71" title="Compute the square of the Frobenius norm.">DSDPDataMatFNorm2</a>(<a class="code" href="structDSDPDataMat__C.html" title="Symmetric data matrix for one block in the semidefinite cone.">DSDPDataMat</a> A, <span class="keywordtype">int</span> n, <span class="keywordtype">double</span> *fnorm2){ <a name="l00176"></a>00176 <span class="keywordtype">int</span> info; <a name="l00177"></a>00177 DSDPFunctionBegin; <a name="l00178"></a>00178 <span class="keywordflow">if</span> (A.dsdpops->matfnorm2){ <a name="l00179"></a>00179 *fnorm2=0.0; <a name="l00180"></a>00180 info=(A.dsdpops->matfnorm2)(A.matdata,n,fnorm2); DSDPChkDataError(A,info); <a name="l00181"></a>00181 } <span class="keywordflow">else</span> { <a name="l00182"></a>00182 DSDPNoOperationError(A); <a name="l00183"></a>00183 } <a name="l00184"></a>00184 DSDPFunctionReturn(0); <a name="l00185"></a>00185 } <a name="l00186"></a>00186 <a name="l00187"></a>00187 <a name="l00188"></a>00188 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00189"></a>00189 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDataMatGetEig"</span> <a name="l00190"></a>00190 <span class="preprocessor"></span> <a name="l00204"></a><a class="code" href="dsdpdatamat_8h.html#a869e4db735cfa24877ed1fbf03f70b36">00204</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdatamat_8c.html#a5a0f6c719037c1998630768a34685414" title="Get an eigenvalue/vector pair.">DSDPDataMatGetEig</a>(<a class="code" href="structDSDPDataMat__C.html" title="Symmetric data matrix for one block in the semidefinite cone.">DSDPDataMat</a> A, <span class="keywordtype">int</span> rr, <a class="code" href="structSDPConeVec__C.html" title="Vector whose length corresponds to dimension of a block in a cone.">SDPConeVec</a> V, DSDPIndex S, <span class="keywordtype">double</span> *eigenvalue){ <a name="l00205"></a>00205 <span class="keywordtype">int</span> info,n; <a name="l00206"></a>00206 <span class="keywordtype">double</span> *vv; <a name="l00207"></a>00207 DSDPFunctionBegin; <a name="l00208"></a>00208 <span class="keywordflow">if</span> (A.dsdpops->matgeteig){ <a name="l00209"></a>00209 info=SDPConeVecGetArray(V,&vv); DSDPCHKERR(info); <a name="l00210"></a>00210 info=SDPConeVecGetSize(V,&n); DSDPCHKERR(info); <a name="l00211"></a>00211 info=(A.dsdpops->matgeteig)(A.matdata,rr, eigenvalue, vv,n,S.indx+1,S.indx); DSDPChkDataError(A,info); <a name="l00212"></a>00212 info=SDPConeVecRestoreArray(V,&vv); DSDPCHKERR(info); <a name="l00213"></a>00213 } <span class="keywordflow">else</span> { <a name="l00214"></a>00214 DSDPNoOperationError(A); <a name="l00215"></a>00215 } <a name="l00216"></a>00216 DSDPFunctionReturn(0); <a name="l00217"></a>00217 } <a name="l00218"></a>00218 <a name="l00219"></a>00219 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00220"></a>00220 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDataMatFactor"</span> <a name="l00221"></a>00221 <span class="preprocessor"></span> <a name="l00240"></a><a class="code" href="dsdpdatamat_8c.html#ae6ea3e2980cd0781f29a1afba6307341">00240</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdatamat_8c.html#ae6ea3e2980cd0781f29a1afba6307341" title="Do eigenvalue/vector or other factorization.">DSDPDataMatFactor</a>(<a class="code" href="structDSDPDataMat__C.html" title="Symmetric data matrix for one block in the semidefinite cone.">DSDPDataMat</a> A, <a class="code" href="structSDPConeVec__C.html" title="Vector whose length corresponds to dimension of a block in a cone.">SDPConeVec</a> W, <span class="keywordtype">double</span>*dworknn, <span class="keywordtype">int</span> nn0, <a name="l00241"></a>00241 <span class="keywordtype">double</span> *dwork3n, <span class="keywordtype">int</span> nd, <span class="keywordtype">int</span>* iwork, <span class="keywordtype">int</span> ni){ <a name="l00242"></a>00242 <span class="keywordtype">int</span> info,n; <a name="l00243"></a>00243 <span class="keywordtype">double</span> *dvecwork; <a name="l00244"></a>00244 DSDPFunctionBegin; <a name="l00245"></a>00245 <span class="keywordflow">if</span> (A.dsdpops->matfactor1){ <a name="l00246"></a>00246 info=(A.dsdpops->matfactor1)(A.matdata); DSDPChkDataError(A,info); <a name="l00247"></a>00247 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (A.dsdpops->matfactor2){ <a name="l00248"></a>00248 info=SDPConeVecGetSize(W,&n); <a name="l00249"></a>00249 info=SDPConeVecGetArray(W,&dvecwork); <a name="l00250"></a>00250 info=(A.dsdpops->matfactor2)(A.matdata,dworknn,nn0,dvecwork,n,dwork3n,nd,iwork,ni); DSDPChkDataError(A,info); <a name="l00251"></a>00251 info=SDPConeVecRestoreArray(W,&dvecwork); <a name="l00252"></a>00252 } <span class="keywordflow">else</span> { <a name="l00253"></a>00253 DSDPNoOperationError(A); <a name="l00254"></a>00254 } <a name="l00255"></a>00255 DSDPFunctionReturn(0); <a name="l00256"></a>00256 } <a name="l00257"></a>00257 <a name="l00258"></a>00258 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00259"></a>00259 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDataMatDot"</span> <a name="l00260"></a>00260 <span class="preprocessor"></span> <a name="l00273"></a><a class="code" href="dsdpdatamat_8h.html#a95a43fa66cd3c7b06125d7bf3292cbda">00273</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdatamat_8c.html#a9c1e1ef6e29007fbe790c8f4935d0cf9" title="Compute inner product of data with a dense matrix.">DSDPDataMatDot</a>(<a class="code" href="structDSDPDataMat__C.html" title="Symmetric data matrix for one block in the semidefinite cone.">DSDPDataMat</a> A, <span class="keywordtype">double</span> x[], <span class="keywordtype">int</span> nn, <span class="keywordtype">int</span> n, <span class="keywordtype">double</span> *v){ <a name="l00274"></a>00274 <span class="keywordtype">int</span> info; <a name="l00275"></a>00275 <a name="l00276"></a>00276 DSDPFunctionBegin; <a name="l00277"></a>00277 <span class="keywordflow">if</span> (A.dsdpops->matdot){ <a name="l00278"></a>00278 info=(A.dsdpops->matdot)(A.matdata,x,nn,n,v); DSDPChkDataError(A,info); <a name="l00279"></a>00279 } <span class="keywordflow">else</span> { <a name="l00280"></a>00280 DSDPNoOperationError(A); <a name="l00281"></a>00281 } <a name="l00282"></a>00282 DSDPFunctionReturn(0); <a name="l00283"></a>00283 } <a name="l00284"></a>00284 <a name="l00285"></a>00285 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00286"></a>00286 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDataMatVecVec"</span> <a name="l00287"></a>00287 <span class="preprocessor"></span> <a name="l00297"></a><a class="code" href="dsdpdatamat_8h.html#ac375312e567bb6f0224a58a8757d85eb">00297</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdatamat_8c.html#a3aab539bab77a672bd8c941016cf221e" title="Compute w' A w.">DSDPDataMatVecVec</a>(<a class="code" href="structDSDPDataMat__C.html" title="Symmetric data matrix for one block in the semidefinite cone.">DSDPDataMat</a> A, <a class="code" href="structSDPConeVec__C.html" title="Vector whose length corresponds to dimension of a block in a cone.">SDPConeVec</a> W, <span class="keywordtype">double</span> *v){ <a name="l00298"></a>00298 <span class="keywordtype">int</span> info,n; <a name="l00299"></a>00299 <span class="keywordtype">double</span> *x; <a name="l00300"></a>00300 <a name="l00301"></a>00301 DSDPFunctionBegin; <a name="l00302"></a>00302 <span class="keywordflow">if</span> (A.dsdpops->matvecvec){ <a name="l00303"></a>00303 info=SDPConeVecGetSize(W,&n); DSDPCHKERR(info); <a name="l00304"></a>00304 info=SDPConeVecGetArray(W,&x); DSDPCHKERR(info); <a name="l00305"></a>00305 info=(A.dsdpops->matvecvec)(A.matdata,x,n,v); DSDPChkDataError(A,info); <a name="l00306"></a>00306 info=SDPConeVecRestoreArray(W,&x); DSDPCHKERR(info); <a name="l00307"></a>00307 } <span class="keywordflow">else</span> { <a name="l00308"></a>00308 DSDPNoOperationError(A); <a name="l00309"></a>00309 } <a name="l00310"></a>00310 DSDPFunctionReturn(0); <a name="l00311"></a>00311 } <a name="l00312"></a>00312 <a name="l00313"></a>00313 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00314"></a>00314 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDataMatMultiply"</span> <a name="l00315"></a>00315 <span class="preprocessor"></span><span class="comment">/*</span> <a name="l00316"></a>00316 <span class="comment">\fn int DSDPDataMatMultiply(DSDPDataMat A, SDPConeVec V1, SDPConeVec V2);</span> <a name="l00317"></a>00317 <span class="comment"></span> <a name="l00318"></a>00318 <span class="comment">\brief Compute V2 = A*V1;</span> <a name="l00319"></a>00319 <span class="comment">\param A symmetric data matrix</span> <a name="l00320"></a>00320 <span class="comment">\param V1 in vector</span> <a name="l00321"></a>00321 <span class="comment">\param V2 the product</span> <a name="l00322"></a>00322 <span class="comment">Not needed.</span> <a name="l00323"></a>00323 <span class="comment">*/</span> <a name="l00324"></a>00324 <span class="keywordtype">int</span> DSDPDataMatMultiply(<a class="code" href="structDSDPDataMat__C.html" title="Symmetric data matrix for one block in the semidefinite cone.">DSDPDataMat</a> A, <a class="code" href="structSDPConeVec__C.html" title="Vector whose length corresponds to dimension of a block in a cone.">SDPConeVec</a> V1, <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="l00325"></a>00325 <span class="keywordtype">int</span> info,n; <a name="l00326"></a>00326 <span class="keywordtype">double</span> *vv1,*vv2; <a name="l00327"></a>00327 <a name="l00328"></a>00328 DSDPFunctionBegin; <a name="l00329"></a>00329 <span class="keywordflow">if</span> (A.dsdpops->matmultiply){ <a name="l00330"></a>00330 info=SDPConeVecGetSize(V1,&n); DSDPCHKERR(info); <a name="l00331"></a>00331 info=SDPConeVecGetArray(V1,&vv1); DSDPCHKERR(info); <a name="l00332"></a>00332 info=SDPConeVecGetArray(V2,&vv2); DSDPCHKERR(info); <a name="l00333"></a>00333 info=(A.dsdpops->matmultiply)(A.matdata,vv1,vv2,n); DSDPChkDataError(A,info); <a name="l00334"></a>00334 info=SDPConeVecRestoreArray(V1,&vv1); DSDPCHKERR(info); <a name="l00335"></a>00335 info=SDPConeVecRestoreArray(V2,&vv2); DSDPCHKERR(info); <a name="l00336"></a>00336 } <span class="keywordflow">else</span> { <a name="l00337"></a>00337 DSDPNoOperationError(A); <a name="l00338"></a>00338 } <a name="l00339"></a>00339 DSDPFunctionReturn(0); <a name="l00340"></a>00340 } <a name="l00341"></a>00341 <a name="l00342"></a>00342 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00343"></a>00343 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDataMatGetRowNonzeros"</span> <a name="l00344"></a>00344 <span class="preprocessor"></span> <a name="l00355"></a><a class="code" href="dsdpdatamat_8h.html#a3d13c00aa6e6c265417167c45005ce28">00355</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdatamat_8c.html#a553eea44af8175e91ee95881df37dc76" title="Get sparsity pattern of a row of the matrix.">DSDPDataMatGetRowNonzeros</a>(<a class="code" href="structDSDPDataMat__C.html" title="Symmetric data matrix for one block in the semidefinite cone.">DSDPDataMat</a> A, <span class="keywordtype">int</span> nrow, <span class="keywordtype">int</span> nmax, <span class="keywordtype">int</span> *nz, <span class="keywordtype">int</span> *nnz){ <a name="l00356"></a>00356 <span class="keywordtype">int</span> i,info; <a name="l00357"></a>00357 DSDPFunctionBegin; <a name="l00358"></a>00358 <span class="keywordflow">if</span> (A.dsdpops->matrownz){ <a name="l00359"></a>00359 info=(A.dsdpops->matrownz)(A.matdata,nrow,nz,nnz,nmax); DSDPChkDataError(A,info); <a name="l00360"></a>00360 } <span class="keywordflow">else</span> { <a name="l00361"></a>00361 *nnz=nmax; <a name="l00362"></a>00362 <span class="keywordflow">for</span> (i=0;i<nmax;i++){ <a name="l00363"></a>00363 nz[i]++; <a name="l00364"></a>00364 } <a name="l00365"></a>00365 } <a name="l00366"></a>00366 DSDPFunctionReturn(0); <a name="l00367"></a>00367 } <a name="l00368"></a>00368 <a name="l00369"></a>00369 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00370"></a>00370 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDataMatAddRowMultipleToVector"</span> <a name="l00371"></a>00371 <span class="preprocessor"></span><span class="keywordtype">int</span> DSDPDataMatAddRowMultipleToVector(<a class="code" href="structDSDPDataMat__C.html" title="Symmetric data matrix for one block in the semidefinite cone.">DSDPDataMat</a> A, <span class="keywordtype">int</span> nrow, <span class="keywordtype">double</span> ytmp, <a class="code" href="structSDPConeVec__C.html" title="Vector whose length corresponds to dimension of a block in a cone.">SDPConeVec</a> R){ <a name="l00372"></a>00372 <span class="keywordtype">int</span> info,n; <a name="l00373"></a>00373 <span class="keywordtype">double</span> *vv; <a name="l00374"></a>00374 DSDPFunctionBegin; <a name="l00375"></a>00375 <span class="keywordflow">if</span> (A.dsdpops->mataddrowmultiple){ <a name="l00376"></a>00376 info=SDPConeVecGetArray(R,&vv);DSDPCHKERR(info); <a name="l00377"></a>00377 info=SDPConeVecGetSize(R,&n);DSDPCHKERR(info); <a name="l00378"></a>00378 info=(A.dsdpops->mataddrowmultiple)(A.matdata,nrow,ytmp,vv,n); DSDPChkDataError(A,info); <a name="l00379"></a>00379 info=SDPConeVecRestoreArray(R,&vv);DSDPCHKERR(info); <a name="l00380"></a>00380 } <span class="keywordflow">else</span> { <a name="l00381"></a>00381 DSDPNoOperationError(A); <a name="l00382"></a>00382 } <a name="l00383"></a>00383 DSDPFunctionReturn(0); <a name="l00384"></a>00384 } <a name="l00385"></a>00385 <a name="l00386"></a>00386 <a name="l00387"></a>00387 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00388"></a>00388 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDataMatAddMultiple"</span> <a name="l00389"></a>00389 <span class="preprocessor"></span> <a name="l00402"></a><a class="code" href="dsdpdatamat_8c.html#a2b122840bbfaf126f620fc0956ef410a">00402</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdatamat_8c.html#a2b122840bbfaf126f620fc0956ef410a" title="Add a multiple the data matrix to the array.">DSDPDataMatAddMultiple</a>(<a class="code" href="structDSDPDataMat__C.html" title="Symmetric data matrix for one block in the semidefinite cone.">DSDPDataMat</a> A, <span class="keywordtype">double</span> ytmp, <span class="keywordtype">double</span> *v, <span class="keywordtype">int</span> nn, <span class="keywordtype">int</span> n){ <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> (A.dsdpops->mataddallmultiple){ <a name="l00406"></a>00406 info=(A.dsdpops->mataddallmultiple)(A.matdata,ytmp,v,nn,n); DSDPChkDataError(A,info); <a name="l00407"></a>00407 } <span class="keywordflow">else</span> { <a name="l00408"></a>00408 DSDPNoOperationError(A); <a name="l00409"></a>00409 } <a name="l00410"></a>00410 DSDPFunctionReturn(0); <a name="l00411"></a>00411 } <a name="l00412"></a>00412 <a name="l00413"></a>00413 <a name="l00414"></a>00414 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00415"></a>00415 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDataMatView"</span> <a name="l00416"></a>00416 <span class="preprocessor"></span> <a name="l00423"></a><a class="code" href="dsdpdatamat_8h.html#a1458358c030c75833d3302f3c17c4e9e">00423</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdatamat_8c.html#a62c8f354eb4dd1e2214670cf4b262b5f" title="Print matrix.">DSDPDataMatView</a>(<a class="code" href="structDSDPDataMat__C.html" title="Symmetric data matrix for one block in the semidefinite cone.">DSDPDataMat</a> A){ <a name="l00424"></a>00424 <span class="keywordtype">int</span> info; <a name="l00425"></a>00425 DSDPFunctionBegin; <a name="l00426"></a>00426 <span class="keywordflow">if</span> (A.dsdpops->matview){ <a name="l00427"></a>00427 info=(A.dsdpops->matview)(A.matdata); DSDPChkDataError(A,info); <a name="l00428"></a>00428 } <span class="keywordflow">else</span> { <a name="l00429"></a>00429 printf(<span class="stringliteral">"No matrix view available for matrix type %s.\n"</span>,A.dsdpops->matname); <a name="l00430"></a>00430 } <a name="l00431"></a>00431 DSDPFunctionReturn(0); <a name="l00432"></a>00432 } <a name="l00433"></a>00433 <a name="l00434"></a>00434 <a name="l00435"></a>00435 <span class="preprocessor">#undef __FUNCT__</span> <a name="l00436"></a>00436 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ "DSDPDataMatDestroy"</span> <a name="l00437"></a>00437 <span class="preprocessor"></span> <a name="l00444"></a><a class="code" href="dsdpdatamat_8h.html#a4169d1bd79a61278d39931e993b6b6e3">00444</a> <span class="keywordtype">int</span> <a class="code" href="dsdpdatamat_8c.html#a44164e8327976dcd8ca234346428d9d7" title="Free the data structures.">DSDPDataMatDestroy</a>(<a class="code" href="structDSDPDataMat__C.html" title="Symmetric data matrix for one block in the semidefinite cone.">DSDPDataMat</a>* A){ <a name="l00445"></a>00445 <span class="keywordtype">int</span> info; <a name="l00446"></a>00446 DSDPFunctionBegin; <a name="l00447"></a>00447 <span class="keywordflow">if</span> ( (*A).dsdpops->matdestroy){ <a name="l00448"></a>00448 info=((*A).dsdpops->matdestroy)((*A).matdata); DSDPChkDataError(*A,info); <a name="l00449"></a>00449 } <span class="keywordflow">else</span> { <a name="l00450"></a>00450 <span class="comment">/* DSDPNoOperationError(*A); */</span> <a name="l00451"></a>00451 } <a name="l00452"></a>00452 info=<a class="code" href="dsdpdatamat_8c.html#af1e1ced742957d981e57ca7bb042bd84" title="Set pointers to NULL;.">DSDPDataMatInitialize</a>(A); DSDPCHKERR(info); <a name="l00453"></a>00453 <span class="comment">/* info=DSDPZeroMatCreate(0,A); DSDPCHKERR(info); */</span> <a name="l00454"></a>00454 <a name="l00455"></a>00455 DSDPFunctionReturn(0); <a name="l00456"></a>00456 } <a name="l00457"></a>00457 </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>