<!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"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>CPPLapack: dsymatrix-calc.hpp Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">CPPLapack
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <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="annotated.html"><span>Classes</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>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </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>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Friends</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="dir_a37d0dd275f7ec49ee26f1d33d1059f5.html">include</a>      </li>
      <li class="navelem"><a class="el" href="dir_19fe6fec48ebb32a77b25b76521af88b.html">dsymatrix-</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">dsymatrix-calc.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="dsymatrix-calc_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">//=============================================================================</span><span class="comment"></span>
<a name="l00002"></a>00002 <span class="comment">/*! return transposed dgematrix */</span>
<a name="l00003"></a><a class="code" href="dsymatrix-calc_8hpp.html#a80186013d5ec13c51fb777e1529f3de1">00003</a> <span class="keyword">inline</span> <a class="code" href="class__dsymatrix.html" title="(DO NOT USE) Smart-temporary Real Double-precision Symmetric Matrix Class">_dsymatrix</a> <a class="code" href="__dcovector-calc_8hpp.html#afe5475fdf72e825c1fea5f306d686664">t</a>(<span class="keyword">const</span> <a class="code" href="classdsymatrix.html" title="Real Double-precision Symmetric Matrix Class [l-type (UPLO=l) Strage].">dsymatrix</a>&amp; mat)
<a name="l00004"></a>00004 {VERBOSE_REPORT;
<a name="l00005"></a>00005 <span class="preprocessor">#ifdef  CPPL_DEBUG</span>
<a name="l00006"></a>00006 <span class="preprocessor"></span>  WARNING_REPORT;
<a name="l00007"></a>00007   std::cerr &lt;&lt; <span class="stringliteral">&quot;This function call has no effect since the matrix is symmetric.&quot;</span> &lt;&lt; std::endl;
<a name="l00008"></a>00008 <span class="preprocessor">#endif//CPPL_DEBUG</span>
<a name="l00009"></a>00009 <span class="preprocessor"></span>  
<a name="l00010"></a>00010   <a class="code" href="classdsymatrix.html" title="Real Double-precision Symmetric Matrix Class [l-type (UPLO=l) Strage].">dsymatrix</a> newmat(mat);
<a name="l00011"></a>00011   <span class="keywordflow">return</span> <a class="code" href="dcovector-misc_8hpp.html#a297beda6502b0d92c99576d2fb9548cb">_</a>(newmat);
<a name="l00012"></a>00012 }
<a name="l00013"></a>00013 
<a name="l00014"></a>00014 <span class="comment">//=============================================================================</span><span class="comment"></span>
<a name="l00015"></a>00015 <span class="comment">/*! return its inverse matrix */</span>
<a name="l00016"></a><a class="code" href="dsymatrix-calc_8hpp.html#ab60f1da7386ac7655533349f5e5cf870">00016</a> <span class="keyword">inline</span> <a class="code" href="class__dsymatrix.html" title="(DO NOT USE) Smart-temporary Real Double-precision Symmetric Matrix Class">_dsymatrix</a> <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>(<span class="keyword">const</span> <a class="code" href="classdsymatrix.html" title="Real Double-precision Symmetric Matrix Class [l-type (UPLO=l) Strage].">dsymatrix</a>&amp; mat)
<a name="l00017"></a>00017 {VERBOSE_REPORT;
<a name="l00018"></a>00018   <a class="code" href="classdsymatrix.html" title="Real Double-precision Symmetric Matrix Class [l-type (UPLO=l) Strage].">dsymatrix</a> mat_cp(mat);
<a name="l00019"></a>00019   <a class="code" href="classdsymatrix.html" title="Real Double-precision Symmetric Matrix Class [l-type (UPLO=l) Strage].">dsymatrix</a> mat_inv(mat.<a class="code" href="classdsymatrix.html#a4a2ca7ec3f2b7bd62139777fbb6ad1a9" title="matrix column size">n</a>);
<a name="l00020"></a>00020   mat_inv.<a class="code" href="classdsymatrix.html#a0bbf9e39f4ed24a61102362477389d19">identity</a>();
<a name="l00021"></a>00021   
<a name="l00022"></a>00022   <span class="keywordtype">char</span> UPLO(<span class="charliteral">&#39;l&#39;</span>);
<a name="l00023"></a>00023   <span class="keywordtype">long</span> NRHS(mat.<a class="code" href="classdsymatrix.html#a4a2ca7ec3f2b7bd62139777fbb6ad1a9" title="matrix column size">n</a>), LDA(mat.<a class="code" href="classdsymatrix.html#a4a2ca7ec3f2b7bd62139777fbb6ad1a9" title="matrix column size">n</a>), *IPIV(<span class="keyword">new</span> <span class="keywordtype">long</span>[mat.<a class="code" href="classdsymatrix.html#a4a2ca7ec3f2b7bd62139777fbb6ad1a9" title="matrix column size">n</a>]), LDB(mat.<a class="code" href="classdsymatrix.html#a4a2ca7ec3f2b7bd62139777fbb6ad1a9" title="matrix column size">n</a>), LWORK(-1), INFO(1);
<a name="l00024"></a>00024   <span class="keywordtype">double</span> *WORK( <span class="keyword">new</span> <span class="keywordtype">double</span>[1] );
<a name="l00025"></a>00025   dsysv_(UPLO, mat.<a class="code" href="classdsymatrix.html#a4a2ca7ec3f2b7bd62139777fbb6ad1a9" title="matrix column size">n</a>, NRHS, mat_cp.<a class="code" href="classdsymatrix.html#a7efa7c974733dc3111167a9ebb217e1f" title="1D array to store matrix data">array</a>, LDA, IPIV, mat_inv.<a class="code" href="classdsymatrix.html#a7efa7c974733dc3111167a9ebb217e1f" title="1D array to store matrix data">array</a>, LDB, WORK, LWORK, INFO);
<a name="l00026"></a>00026   LWORK = long(WORK[0]);
<a name="l00027"></a>00027   <span class="keyword">delete</span> [] WORK;  WORK = <span class="keyword">new</span> <span class="keywordtype">double</span>[LWORK];
<a name="l00028"></a>00028   dsysv_(UPLO, mat.<a class="code" href="classdsymatrix.html#a4a2ca7ec3f2b7bd62139777fbb6ad1a9" title="matrix column size">n</a>, NRHS, mat_cp.<a class="code" href="classdsymatrix.html#a7efa7c974733dc3111167a9ebb217e1f" title="1D array to store matrix data">array</a>, LDA, IPIV, mat_inv.<a class="code" href="classdsymatrix.html#a7efa7c974733dc3111167a9ebb217e1f" title="1D array to store matrix data">array</a>, LDB, WORK, LWORK, INFO);
<a name="l00029"></a>00029   <span class="keyword">delete</span> [] WORK; <span class="keyword">delete</span> [] IPIV;
<a name="l00030"></a>00030   <span class="keywordflow">if</span>(INFO!=0){
<a name="l00031"></a>00031     WARNING_REPORT;
<a name="l00032"></a>00032     std::cerr &lt;&lt; <span class="stringliteral">&quot;Serious trouble happend. INFO = &quot;</span> &lt;&lt; INFO &lt;&lt; <span class="stringliteral">&quot;.&quot;</span> &lt;&lt; std::endl;
<a name="l00033"></a>00033   }
<a name="l00034"></a>00034   
<a name="l00035"></a>00035   <span class="keywordflow">return</span> <a class="code" href="dcovector-misc_8hpp.html#a297beda6502b0d92c99576d2fb9548cb">_</a>(mat_inv);
<a name="l00036"></a>00036 }
<a name="l00037"></a>00037 
<a name="l00038"></a>00038 <span class="comment"></span>
<a name="l00039"></a>00039 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span>
<a name="l00040"></a>00040 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span>
<a name="l00041"></a>00041 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span>
<a name="l00042"></a>00042 <span class="comment"></span>
<a name="l00043"></a>00043 <span class="comment">//=============================================================================</span><span class="comment"></span>
<a name="l00044"></a>00044 <span class="comment">/*! search the index of element having the largest absolute value</span>
<a name="l00045"></a>00045 <span class="comment">  in 0-based numbering system */</span>
<a name="l00046"></a><a class="code" href="dsymatrix-calc_8hpp.html#a4faf823f7a52a4f9da6dbd4c8d3d87f3">00046</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="__dcovector-calc_8hpp.html#a250895c0528a387beace5e285fe82354">idamax</a>(<span class="keywordtype">long</span>&amp; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>, <span class="keywordtype">long</span>&amp; j, <span class="keyword">const</span> <a class="code" href="classdsymatrix.html" title="Real Double-precision Symmetric Matrix Class [l-type (UPLO=l) Strage].">dsymatrix</a>&amp; mat)
<a name="l00047"></a>00047 {VERBOSE_REPORT;
<a name="l00048"></a>00048   i=j=0;
<a name="l00049"></a>00049   <span class="keywordtype">double</span> val(0.);
<a name="l00050"></a>00050   <span class="keywordflow">for</span>(<span class="keywordtype">long</span> J=0; J&lt;mat.<a class="code" href="classdsymatrix.html#a4a2ca7ec3f2b7bd62139777fbb6ad1a9" title="matrix column size">n</a>; J++){
<a name="l00051"></a>00051     <span class="keywordtype">long</span> I( J +idamax_(mat.<a class="code" href="classdsymatrix.html#a955f345240dab42d931f4c8700dc43d5" title="matrix row size">m</a>-J, mat.<a class="code" href="classdsymatrix.html#a786e420fb2551cffb147af789197a681" title="array of pointers of column head addresses">darray</a>[J]+J, 1) -1 );
<a name="l00052"></a>00052     <span class="keywordflow">if</span>( val&lt;fabs(mat.<a class="code" href="classdsymatrix.html#a786e420fb2551cffb147af789197a681" title="array of pointers of column head addresses">darray</a>[J][I]) ){
<a name="l00053"></a>00053       val =fabs(mat.<a class="code" href="classdsymatrix.html#a786e420fb2551cffb147af789197a681" title="array of pointers of column head addresses">darray</a>[J][I]);
<a name="l00054"></a>00054       i=I;
<a name="l00055"></a>00055       j=J;
<a name="l00056"></a>00056     }
<a name="l00057"></a>00057   }
<a name="l00058"></a>00058 }
<a name="l00059"></a>00059 
<a name="l00060"></a>00060 <span class="comment">//=============================================================================</span><span class="comment"></span>
<a name="l00061"></a>00061 <span class="comment">/*! return its largest absolute value */</span>
<a name="l00062"></a><a class="code" href="dsymatrix-calc_8hpp.html#ab5fc9cd37dd9395c1759ff01edce21e4">00062</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="__dcovector-calc_8hpp.html#af6c2b89c85cc70c33b7028fb27bf3a0f">damax</a>(<span class="keyword">const</span> <a class="code" href="classdsymatrix.html" title="Real Double-precision Symmetric Matrix Class [l-type (UPLO=l) Strage].">dsymatrix</a>&amp; mat)
<a name="l00063"></a>00063 {VERBOSE_REPORT;
<a name="l00064"></a>00064   <span class="keywordtype">long</span> <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>,j;
<a name="l00065"></a>00065   <a class="code" href="__dcovector-calc_8hpp.html#a250895c0528a387beace5e285fe82354">idamax</a>(i, j, mat);
<a name="l00066"></a>00066   <span class="keywordflow">return</span> mat(i,j);
<a name="l00067"></a>00067 }
</pre></div></div><!-- contents -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Friends</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>
