<!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: dssmatrix-misc.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_6bdd35f1998b0c46359edc2ea79bce3f.html">dssmatrix-</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">dssmatrix-misc.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="dssmatrix-misc_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">/*! clear all the matrix data and set the sizes 0 */</span>
<a name="l00003"></a><a class="code" href="classdssmatrix.html#a399c7c88c81e9c12b1ac9759e6c5f6cc">00003</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classdssmatrix.html#a399c7c88c81e9c12b1ac9759e6c5f6cc">dssmatrix::clear</a>()
<a name="l00004"></a>00004 {VERBOSE_REPORT;
<a name="l00005"></a>00005   <a class="code" href="classdssmatrix.html#a94fac8a3f08704f5e0001473fa9a937a" title="matrix column size">n</a> =0;
<a name="l00006"></a>00006   <a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.clear();
<a name="l00007"></a>00007   <a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>.clear();
<a name="l00008"></a>00008 }
<a name="l00009"></a>00009 
<a name="l00010"></a>00010 <span class="comment">//=============================================================================</span><span class="comment"></span>
<a name="l00011"></a>00011 <span class="comment">/*! change the matrix into a zero matrix */</span>
<a name="l00012"></a><a class="code" href="classdssmatrix.html#aaf3e5e2b644452fd567174197d4f69b3">00012</a> <span class="keyword">inline</span> <a class="code" href="classdssmatrix.html" title="Real Double-precision Symmetric Sparse Matrix Class.">dssmatrix</a>&amp; <a class="code" href="classdssmatrix.html#aaf3e5e2b644452fd567174197d4f69b3">dssmatrix::zero</a>()
<a name="l00013"></a>00013 {VERBOSE_REPORT;
<a name="l00014"></a>00014   <a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.resize(0);
<a name="l00015"></a>00015   <span class="keywordflow">for</span>(<span class="keywordtype">long</span> <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>=0; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>&lt;<a class="code" href="classdssmatrix.html#a94fac8a3f08704f5e0001473fa9a937a" title="matrix column size">n</a>; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){ <a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>].resize(0); }
<a name="l00016"></a>00016   <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00017"></a>00017 }
<a name="l00018"></a>00018 
<a name="l00019"></a>00019 <span class="comment">//=============================================================================</span><span class="comment"></span>
<a name="l00020"></a>00020 <span class="comment">/*! change sign(+/-) of the matrix */</span>
<a name="l00021"></a><a class="code" href="classdssmatrix.html#aabb19d3737f39fcf8ff7dd430d1c0283">00021</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classdssmatrix.html#aabb19d3737f39fcf8ff7dd430d1c0283">dssmatrix::chsign</a>()
<a name="l00022"></a>00022 {VERBOSE_REPORT;
<a name="l00023"></a>00023   <span class="keywordflow">for</span>(std::vector&lt;dcomponent&gt;::iterator it=<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.begin(); it!=<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.end(); it++){
<a name="l00024"></a>00024     it-&gt;v =-it-&gt;v;
<a name="l00025"></a>00025   }
<a name="l00026"></a>00026 }
<a name="l00027"></a>00027 
<a name="l00028"></a>00028 <span class="comment">//=============================================================================</span><span class="comment"></span>
<a name="l00029"></a>00029 <span class="comment">/*! make a deep copy of the matrix */</span>
<a name="l00030"></a><a class="code" href="classdssmatrix.html#ab61890340f8faafdbec867ca5a61ab95">00030</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classdssmatrix.html#ab61890340f8faafdbec867ca5a61ab95">dssmatrix::copy</a>(<span class="keyword">const</span> <a class="code" href="classdssmatrix.html" title="Real Double-precision Symmetric Sparse Matrix Class.">dssmatrix</a>&amp; mat)
<a name="l00031"></a>00031 {VERBOSE_REPORT;
<a name="l00032"></a>00032   <a class="code" href="classdssmatrix.html#a94fac8a3f08704f5e0001473fa9a937a" title="matrix column size">n</a> =mat.<a class="code" href="classdssmatrix.html#a94fac8a3f08704f5e0001473fa9a937a" title="matrix column size">n</a>;
<a name="l00033"></a>00033   <a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a> =mat.<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>;
<a name="l00034"></a>00034   <a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a> =mat.<a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>;
<a name="l00035"></a>00035 }
<a name="l00036"></a>00036 
<a name="l00037"></a>00037 <span class="comment">//=============================================================================</span><span class="comment"></span>
<a name="l00038"></a>00038 <span class="comment">/*! make a shallow copy of the matrix\n</span>
<a name="l00039"></a>00039 <span class="comment">  This function is not designed to be used in project codes. */</span>
<a name="l00040"></a><a class="code" href="classdssmatrix.html#adbd757ec9c95de11c1c0adeb6ddd895f">00040</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classdssmatrix.html#adbd757ec9c95de11c1c0adeb6ddd895f">dssmatrix::shallow_copy</a>(<span class="keyword">const</span> <a class="code" href="class__dssmatrix.html" title="(DO NOT USE) Smart-temporary Real Double-precision Symmetric Sparse Matrix Class">_dssmatrix</a>&amp; mat)
<a name="l00041"></a>00041 {VERBOSE_REPORT;
<a name="l00042"></a>00042   <a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.clear();
<a name="l00043"></a>00043   <a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>.clear();
<a name="l00044"></a>00044   
<a name="l00045"></a>00045   <a class="code" href="classdssmatrix.html#a94fac8a3f08704f5e0001473fa9a937a" title="matrix column size">n</a> =mat.<a class="code" href="class__dssmatrix.html#ac1de480934f45511a98ddc610868803f" title="matrix column size">n</a>;
<a name="l00046"></a>00046   <a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.swap(mat.<a class="code" href="class__dssmatrix.html#a0c4e6868fac505c8a01b4d26558ec009" title="matrix data">data</a>);
<a name="l00047"></a>00047   <a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>.swap(mat.<a class="code" href="class__dssmatrix.html#a988041b8d0cf2b8cce763f8da302c7e0" title="vector of vector to store the entry information of component for each row and column">line</a>);
<a name="l00048"></a>00048   
<a name="l00049"></a>00049   mat.<a class="code" href="class__dssmatrix.html#ac16e0d54da2261c77918dc25b0f66df2">nullify</a>();
<a name="l00050"></a>00050 }
<a name="l00051"></a>00051 
<a name="l00052"></a>00052 <span class="comment">//=============================================================================</span><span class="comment"></span>
<a name="l00053"></a>00053 <span class="comment">/*! resize the matrix */</span>
<a name="l00054"></a><a class="code" href="classdssmatrix.html#ae17262882f2c0f36fcce8f8e4ee13c9d">00054</a> <span class="keyword">inline</span> <a class="code" href="classdssmatrix.html" title="Real Double-precision Symmetric Sparse Matrix Class.">dssmatrix</a>&amp; <a class="code" href="classdssmatrix.html#ae17262882f2c0f36fcce8f8e4ee13c9d">dssmatrix::resize</a>(<span class="keyword">const</span> <span class="keywordtype">long</span>&amp; _n, <span class="keyword">const</span> <span class="keywordtype">long</span> _c, <span class="keyword">const</span> <span class="keywordtype">long</span> _l)
<a name="l00055"></a>00055 {VERBOSE_REPORT;
<a name="l00056"></a>00056 <span class="preprocessor">#ifdef  CPPL_DEBUG</span>
<a name="l00057"></a>00057 <span class="preprocessor"></span>  <span class="keywordflow">if</span>( _n&lt;0 || _c&lt;0 || _l&lt;0 ){
<a name="l00058"></a>00058     ERROR_REPORT;
<a name="l00059"></a>00059     std::cerr &lt;&lt; <span class="stringliteral">&quot;Matrix sizes, the length of arrays, and line size must be positive integers. &quot;</span> &lt;&lt; std::endl
<a name="l00060"></a>00060               &lt;&lt; <span class="stringliteral">&quot;Your input was (&quot;</span> &lt;&lt; _n &lt;&lt; <span class="stringliteral">&quot;,&quot;</span> &lt;&lt; _c &lt;&lt; <span class="stringliteral">&quot;,&quot;</span> &lt;&lt; _l &lt;&lt; <span class="stringliteral">&quot;).&quot;</span> &lt;&lt; std::endl;
<a name="l00061"></a>00061     exit(1);
<a name="l00062"></a>00062   }
<a name="l00063"></a>00063 <span class="preprocessor">#endif//CPPL_DEBUG</span>
<a name="l00064"></a>00064 <span class="preprocessor"></span>  
<a name="l00065"></a>00065   <a class="code" href="classdssmatrix.html#a94fac8a3f08704f5e0001473fa9a937a" title="matrix column size">n</a> =_n;
<a name="l00066"></a>00066   <a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.resize(0);
<a name="l00067"></a>00067   <a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.reserve(_c);
<a name="l00068"></a>00068   <a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>.resize(<a class="code" href="classdssmatrix.html#a94fac8a3f08704f5e0001473fa9a937a" title="matrix column size">n</a>);
<a name="l00069"></a>00069   <span class="keywordflow">for</span>(<span class="keywordtype">long</span> <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>=0; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>&lt;<a class="code" href="classdssmatrix.html#a94fac8a3f08704f5e0001473fa9a937a" title="matrix column size">n</a>; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){
<a name="l00070"></a>00070     <a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>].resize(0); 
<a name="l00071"></a>00071     <a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>].reserve(_l);
<a name="l00072"></a>00072   }
<a name="l00073"></a>00073   
<a name="l00074"></a>00074   <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00075"></a>00075 }
<a name="l00076"></a>00076 
<a name="l00077"></a>00077 <span class="comment">//=============================================================================</span><span class="comment"></span>
<a name="l00078"></a>00078 <span class="comment">/*! stretch the matrix size */</span>
<a name="l00079"></a><a class="code" href="classdssmatrix.html#a3aa570dbe2fc73e855f0ce68b9ed940c">00079</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classdssmatrix.html#a3aa570dbe2fc73e855f0ce68b9ed940c">dssmatrix::stretch</a>(<span class="keyword">const</span> <span class="keywordtype">long</span>&amp; dn)
<a name="l00080"></a>00080 {VERBOSE_REPORT;
<a name="l00081"></a>00081 <span class="preprocessor">#ifdef  CPPL_DEBUG</span>
<a name="l00082"></a>00082 <span class="preprocessor"></span>  <span class="keywordflow">if</span>( <a class="code" href="classdssmatrix.html#a94fac8a3f08704f5e0001473fa9a937a" title="matrix column size">n</a>+dn&lt;0 ){
<a name="l00083"></a>00083     ERROR_REPORT;
<a name="l00084"></a>00084     std::cerr &lt;&lt; <span class="stringliteral">&quot;The new matrix size must be larger than zero.&quot;</span> &lt;&lt; std::endl
<a name="l00085"></a>00085               &lt;&lt; <span class="stringliteral">&quot;Your input was (&quot;</span> &lt;&lt; dn &lt;&lt; <span class="stringliteral">&quot;).&quot;</span> &lt;&lt; std::endl;
<a name="l00086"></a>00086     exit(1);
<a name="l00087"></a>00087   }
<a name="l00088"></a>00088 <span class="preprocessor">#endif//CPPL_DEBUG</span>
<a name="l00089"></a>00089 <span class="preprocessor"></span>  <span class="comment"></span>
<a name="l00090"></a>00090 <span class="comment">  //////// zero ////////</span>
<a name="l00091"></a>00091 <span class="comment"></span>  <span class="keywordflow">if</span>(dn==0){ <span class="keywordflow">return</span>; }
<a name="l00092"></a>00092 <span class="comment"></span>
<a name="l00093"></a>00093 <span class="comment">  //////// non-zero ////////</span>
<a name="l00094"></a>00094 <span class="comment"></span>  <a class="code" href="classdssmatrix.html#a94fac8a3f08704f5e0001473fa9a937a" title="matrix column size">n</a> +=dn;
<a name="l00095"></a>00095   
<a name="l00096"></a>00096   <span class="keywordflow">if</span>(dn&lt;0){<span class="comment"></span>
<a name="l00097"></a>00097 <span class="comment">    //// delete components over the new size ////</span>
<a name="l00098"></a>00098 <span class="comment"></span>    <span class="keywordflow">for</span>(std::vector&lt;dcomponent&gt;::reverse_iterator it=<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.rbegin(); it!=<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.rend(); it++){
<a name="l00099"></a>00099       <span class="keywordflow">if</span>( <span class="keywordtype">long</span>(it-&gt;i)&gt;=<a class="code" href="classdssmatrix.html#a94fac8a3f08704f5e0001473fa9a937a" title="matrix column size">n</a> ){ <a class="code" href="classdssmatrix.html#abfd167fcf446bc5003545e0d92019442">del</a>(<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.rend()-it-1); }
<a name="l00100"></a>00100     }<span class="comment"></span>
<a name="l00101"></a>00101 <span class="comment">    //// shrink line ////</span>
<a name="l00102"></a>00102 <span class="comment"></span>    <span class="keywordflow">for</span>(<span class="keywordtype">long</span> <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>=0; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>&lt;-dn; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){
<a name="l00103"></a>00103       <a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>.pop_back();
<a name="l00104"></a>00104     }
<a name="l00105"></a>00105   }
<a name="l00106"></a>00106   <span class="keywordflow">else</span>{<span class="comment">//dn&gt;0</span><span class="comment"></span>
<a name="l00107"></a>00107 <span class="comment">    //// expand line ////</span>
<a name="l00108"></a>00108 <span class="comment"></span>    <span class="keywordflow">for</span>(<span class="keywordtype">long</span> <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>=0; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>&lt;dn; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){
<a name="l00109"></a>00109       <a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>.push_back( std::vector&lt;uint32_t&gt;(0) );
<a name="l00110"></a>00110     }
<a name="l00111"></a>00111   }
<a name="l00112"></a>00112 }
<a name="l00113"></a>00113 
<a name="l00114"></a>00114 <span class="comment">//=============================================================================</span><span class="comment"></span>
<a name="l00115"></a>00115 <span class="comment">/*! check if the component is listed */</span>
<a name="l00116"></a><a class="code" href="classdssmatrix.html#a3436ccad07ec887b9fe5262cc6d469cd">00116</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classdssmatrix.html#a3436ccad07ec887b9fe5262cc6d469cd">dssmatrix::isListed</a>(<span class="keyword">const</span> <span class="keywordtype">long</span>&amp; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>, <span class="keyword">const</span> <span class="keywordtype">long</span>&amp; j)<span class="keyword"> const</span>
<a name="l00117"></a>00117 <span class="keyword"></span>{VERBOSE_REPORT;
<a name="l00118"></a>00118 <span class="preprocessor">#ifdef  CPPL_DEBUG</span>
<a name="l00119"></a>00119 <span class="preprocessor"></span>  <span class="keywordflow">if</span>( i&lt;0 || j&lt;0 || <a class="code" href="classdssmatrix.html#a94fac8a3f08704f5e0001473fa9a937a" title="matrix column size">n</a>&lt;=i || <a class="code" href="classdssmatrix.html#a94fac8a3f08704f5e0001473fa9a937a" title="matrix column size">n</a>&lt;=j ){
<a name="l00120"></a>00120     ERROR_REPORT;
<a name="l00121"></a>00121     std::cerr &lt;&lt; <span class="stringliteral">&quot;The required component is out of the matrix size.&quot;</span> &lt;&lt; std::endl
<a name="l00122"></a>00122               &lt;&lt; <span class="stringliteral">&quot;Your input was (&quot;</span> &lt;&lt; i &lt;&lt; <span class="stringliteral">&quot;,&quot;</span> &lt;&lt; j &lt;&lt; <span class="stringliteral">&quot;).&quot;</span> &lt;&lt; std::endl;
<a name="l00123"></a>00123     exit(1);
<a name="l00124"></a>00124   }
<a name="l00125"></a>00125 <span class="preprocessor">#endif//CPPL_DEBUG</span>
<a name="l00126"></a>00126 <span class="preprocessor"></span>  
<a name="l00127"></a>00127   <span class="keyword">const</span> uint32_t ii(std::max(i,j)), jj(std::min(i,j));
<a name="l00128"></a>00128   <span class="keywordflow">for</span>(std::vector&lt;uint32_t&gt;::const_iterator p=<a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>[ii].begin(); p!=<a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>[ii].end(); p++){
<a name="l00129"></a>00129     <span class="keywordflow">if</span>(<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>[*p].i==ii &amp;&amp; <a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>[*p].j==jj){ <span class="keywordflow">return</span> 1; }
<a name="l00130"></a>00130   }
<a name="l00131"></a>00131   
<a name="l00132"></a>00132   <span class="keywordflow">return</span> 0;
<a name="l00133"></a>00133 }
<a name="l00134"></a>00134 
<a name="l00135"></a>00135 <span class="comment">//=============================================================================</span><span class="comment"></span>
<a name="l00136"></a>00136 <span class="comment">/*! return the element number of the component */</span>
<a name="l00137"></a><a class="code" href="classdssmatrix.html#af1b1e77b41864cd93652d7a475ac9b72">00137</a> <span class="keyword">inline</span> <span class="keywordtype">long</span> <a class="code" href="classdssmatrix.html#af1b1e77b41864cd93652d7a475ac9b72">dssmatrix::number</a>(<span class="keyword">const</span> <span class="keywordtype">long</span>&amp; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>, <span class="keyword">const</span> <span class="keywordtype">long</span>&amp; j)<span class="keyword"> const</span>
<a name="l00138"></a>00138 <span class="keyword"></span>{VERBOSE_REPORT;
<a name="l00139"></a>00139 <span class="preprocessor">#ifdef  CPPL_DEBUG</span>
<a name="l00140"></a>00140 <span class="preprocessor"></span>  <span class="keywordflow">if</span>( i&lt;0 || j&lt;0 || <a class="code" href="classdssmatrix.html#a94fac8a3f08704f5e0001473fa9a937a" title="matrix column size">n</a>&lt;=i || <a class="code" href="classdssmatrix.html#a94fac8a3f08704f5e0001473fa9a937a" title="matrix column size">n</a>&lt;=j ){
<a name="l00141"></a>00141     ERROR_REPORT;
<a name="l00142"></a>00142     std::cerr &lt;&lt; <span class="stringliteral">&quot;The required component is out of the matrix size.&quot;</span> &lt;&lt; std::endl
<a name="l00143"></a>00143               &lt;&lt; <span class="stringliteral">&quot;Your input was (&quot;</span> &lt;&lt; i &lt;&lt; <span class="stringliteral">&quot;,&quot;</span> &lt;&lt; j &lt;&lt; <span class="stringliteral">&quot;).&quot;</span> &lt;&lt; std::endl;
<a name="l00144"></a>00144     exit(1);
<a name="l00145"></a>00145   }
<a name="l00146"></a>00146 <span class="preprocessor">#endif//CPPL_DEBUG</span>
<a name="l00147"></a>00147 <span class="preprocessor"></span>  
<a name="l00148"></a>00148   <span class="keyword">const</span> uint32_t ii(std::max(i,j)), jj(std::min(i,j));
<a name="l00149"></a>00149   <span class="keywordflow">for</span>(std::vector&lt;uint32_t&gt;::const_iterator p=<a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>[ii].begin(); p!=<a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>[ii].end(); p++){
<a name="l00150"></a>00150     <span class="keywordflow">if</span>(<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>[*p].i==ii &amp;&amp; <a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>[*p].j==jj){ <span class="keywordflow">return</span> *p; }
<a name="l00151"></a>00151   }
<a name="l00152"></a>00152   
<a name="l00153"></a>00153   <span class="keywordflow">return</span> -1;
<a name="l00154"></a>00154 }
<a name="l00155"></a>00155 <span class="comment"></span>
<a name="l00156"></a>00156 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span>
<a name="l00157"></a>00157 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span>
<a name="l00158"></a>00158 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span>
<a name="l00159"></a>00159 <span class="comment"></span>
<a name="l00160"></a>00160 <span class="comment">//=============================================================================</span><span class="comment"></span>
<a name="l00161"></a>00161 <span class="comment">/*! get row of the matrix */</span>
<a name="l00162"></a><a class="code" href="classdssmatrix.html#a74466758872d0329d260c520b85c25cf">00162</a> <span class="keyword">inline</span> <a class="code" href="class__drovector.html" title="(DO NOT USE) Smart-temporary Real Double-precision Row Vector Class">_drovector</a> <a class="code" href="classdssmatrix.html#a74466758872d0329d260c520b85c25cf">dssmatrix::row</a>(<span class="keyword">const</span> <span class="keywordtype">long</span>&amp; _m)<span class="keyword"> const</span>
<a name="l00163"></a>00163 <span class="keyword"></span>{VERBOSE_REPORT;
<a name="l00164"></a>00164 <span class="preprocessor">#ifdef  CPPL_DEBUG</span>
<a name="l00165"></a>00165 <span class="preprocessor"></span>  <span class="keywordflow">if</span>( _m&lt;0 || _m&gt;<a class="code" href="classdssmatrix.html#adb00c468da489c1d39028f36fb291154" title="matrix row size">m</a> ){
<a name="l00166"></a>00166     ERROR_REPORT;
<a name="l00167"></a>00167     std::cerr &lt;&lt; <span class="stringliteral">&quot;Input row number must be between 0 and &quot;</span> &lt;&lt; m &lt;&lt; <span class="stringliteral">&quot;.&quot;</span> &lt;&lt; std::endl
<a name="l00168"></a>00168               &lt;&lt; <span class="stringliteral">&quot;Your input was &quot;</span> &lt;&lt; _m &lt;&lt; <span class="stringliteral">&quot;.&quot;</span> &lt;&lt; std::endl;
<a name="l00169"></a>00169     exit(1);
<a name="l00170"></a>00170   }
<a name="l00171"></a>00171 <span class="preprocessor">#endif//CPPL_DEBUG</span>
<a name="l00172"></a>00172 <span class="preprocessor"></span>  
<a name="l00173"></a>00173   <a class="code" href="classdrovector.html" title="Real Double-precision Row Vector Class.">drovector</a> vec(<a class="code" href="classdssmatrix.html#a94fac8a3f08704f5e0001473fa9a937a" title="matrix column size">n</a>);
<a name="l00174"></a>00174   vec.<a class="code" href="classdrovector.html#a845494ed14746353f61c962b3a5b5793">zero</a>();
<a name="l00175"></a>00175   <span class="keywordflow">for</span>(std::vector&lt;uint32_t&gt;::const_iterator p=<a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>[_m].begin(); p!=<a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>[_m].end(); p++){
<a name="l00176"></a>00176     <span class="keywordflow">if</span>(<span class="keywordtype">long</span>(<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>[*p].<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>)==_m){
<a name="l00177"></a>00177       vec(<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>[*p].j) =<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>[*p].v;
<a name="l00178"></a>00178     }
<a name="l00179"></a>00179     <span class="keywordflow">else</span>{
<a name="l00180"></a>00180       vec(<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>[*p].i) =<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>[*p].v;
<a name="l00181"></a>00181     }
<a name="l00182"></a>00182   }
<a name="l00183"></a>00183   <span class="keywordflow">return</span> <a class="code" href="classdssmatrix.html#aefa4a107aab1f7733690d96bcfe4c54e">_</a>(vec);
<a name="l00184"></a>00184 }
<a name="l00185"></a>00185 
<a name="l00186"></a>00186 <span class="comment">//=============================================================================</span><span class="comment"></span>
<a name="l00187"></a>00187 <span class="comment">/*! get column of the matrix */</span>
<a name="l00188"></a><a class="code" href="classdssmatrix.html#ab88e607783ac7a24d0d8b262e7209871">00188</a> <span class="keyword">inline</span> <a class="code" href="class__dcovector.html" title="(DO NOT USE) Smart-temporary Real Double-precision Column Vector Class">_dcovector</a> <a class="code" href="classdssmatrix.html#ab88e607783ac7a24d0d8b262e7209871">dssmatrix::col</a>(<span class="keyword">const</span> <span class="keywordtype">long</span>&amp; _n)<span class="keyword"> const</span>
<a name="l00189"></a>00189 <span class="keyword"></span>{VERBOSE_REPORT;
<a name="l00190"></a>00190 <span class="preprocessor">#ifdef  CPPL_DEBUG</span>
<a name="l00191"></a>00191 <span class="preprocessor"></span>  <span class="keywordflow">if</span>( _n&lt;0 || _n&gt;<a class="code" href="classdssmatrix.html#a94fac8a3f08704f5e0001473fa9a937a" title="matrix column size">n</a> ){
<a name="l00192"></a>00192     ERROR_REPORT;
<a name="l00193"></a>00193     std::cerr &lt;&lt; <span class="stringliteral">&quot;Input row number must be between 0 and &quot;</span> &lt;&lt; n &lt;&lt; <span class="stringliteral">&quot;.&quot;</span> &lt;&lt; std::endl
<a name="l00194"></a>00194               &lt;&lt; <span class="stringliteral">&quot;Your input was &quot;</span> &lt;&lt; _n &lt;&lt; <span class="stringliteral">&quot;.&quot;</span> &lt;&lt; std::endl;
<a name="l00195"></a>00195     exit(1);
<a name="l00196"></a>00196   }
<a name="l00197"></a>00197 <span class="preprocessor">#endif//CPPL_DEBUG</span>
<a name="l00198"></a>00198 <span class="preprocessor"></span>  
<a name="l00199"></a>00199   <a class="code" href="classdcovector.html" title="Real Double-precision Column Vector Class.">dcovector</a> vec(<a class="code" href="classdssmatrix.html#adb00c468da489c1d39028f36fb291154" title="matrix row size">m</a>);
<a name="l00200"></a>00200   vec.<a class="code" href="classdcovector.html#a8c4bf5b019db614789daa9d8e991b3f2">zero</a>();
<a name="l00201"></a>00201   <span class="keywordflow">for</span>(std::vector&lt;uint32_t&gt;::const_iterator p=<a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>[_n].begin(); p!=<a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>[_n].end(); p++){
<a name="l00202"></a>00202     <span class="keywordflow">if</span>(<span class="keywordtype">long</span>(<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>[*p].<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>)==_n){
<a name="l00203"></a>00203       vec(<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>[*p].j) =<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>[*p].v;
<a name="l00204"></a>00204     }
<a name="l00205"></a>00205     <span class="keywordflow">else</span>{
<a name="l00206"></a>00206       vec(<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>[*p].i) =<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>[*p].v;
<a name="l00207"></a>00207     }
<a name="l00208"></a>00208   }
<a name="l00209"></a>00209   <span class="keywordflow">return</span> <a class="code" href="classdssmatrix.html#aefa4a107aab1f7733690d96bcfe4c54e">_</a>(vec);
<a name="l00210"></a>00210 }
<a name="l00211"></a>00211 <span class="comment"></span>
<a name="l00212"></a>00212 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span>
<a name="l00213"></a>00213 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span>
<a name="l00214"></a>00214 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span>
<a name="l00215"></a>00215 <span class="comment"></span>
<a name="l00216"></a>00216 <span class="comment">//=============================================================================</span><span class="comment"></span>
<a name="l00217"></a>00217 <span class="comment">/*! erase components less than DBL_MIN */</span>
<a name="l00218"></a><a class="code" href="classdssmatrix.html#a1be78a2507c837f52a68cb15bb32e670">00218</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classdssmatrix.html#a1be78a2507c837f52a68cb15bb32e670">dssmatrix::diet</a>(<span class="keyword">const</span> <span class="keywordtype">double</span> eps)
<a name="l00219"></a>00219 {VERBOSE_REPORT;
<a name="l00220"></a>00220   <span class="keywordflow">for</span>(std::vector&lt;dcomponent&gt;::reverse_iterator it=<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.rbegin(); it!=<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.rend(); it++){
<a name="l00221"></a>00221     <span class="keywordflow">if</span>( fabs(it-&gt;v)&lt;eps ){ <a class="code" href="classdssmatrix.html#abfd167fcf446bc5003545e0d92019442">del</a>(<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.rend()-it-1); }
<a name="l00222"></a>00222   }
<a name="l00223"></a>00223 }
<a name="l00224"></a>00224 
<a name="l00225"></a>00225 <span class="comment">//=============================================================================</span><span class="comment"></span>
<a name="l00226"></a>00226 <span class="comment">/*! reorder components so that all diagonal componets are placed in front */</span>
<a name="l00227"></a><a class="code" href="classdssmatrix.html#a9fec0074e777fb48bfd995fdb22c5b16">00227</a> <span class="keyword">inline</span> <span class="keywordtype">long</span> <a class="code" href="classdssmatrix.html#a9fec0074e777fb48bfd995fdb22c5b16">dssmatrix::diag_front</a>()
<a name="l00228"></a>00228 {VERBOSE_REPORT;<span class="comment"></span>
<a name="l00229"></a>00229 <span class="comment">  //////// set initial dsize ////////</span>
<a name="l00230"></a>00230 <span class="comment"></span>  <span class="keywordtype">long</span> dsize(0);
<a name="l00231"></a>00231   <span class="keywordflow">for</span>(std::vector&lt;dcomponent&gt;::iterator it=<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.begin(); it!=<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.end(); it++){
<a name="l00232"></a>00232     <span class="keywordflow">if</span>(it-&gt;i==it-&gt;j){ dsize++; }
<a name="l00233"></a>00233     <span class="keywordflow">else</span>{ <span class="keywordflow">break</span>; }
<a name="l00234"></a>00234   }
<a name="l00235"></a>00235   <span class="comment"></span>
<a name="l00236"></a>00236 <span class="comment">  //////// swapping loop ////////</span>
<a name="l00237"></a>00237 <span class="comment"></span>  <span class="keywordflow">for</span>(std::vector&lt;dcomponent&gt;::reverse_iterator it=<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.rbegin(); it!=<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.rend()-dsize; it++){
<a name="l00238"></a>00238     <span class="keywordflow">if</span>(it-&gt;i==it-&gt;j){<span class="comment">//is diag</span>
<a name="l00239"></a>00239       <span class="keywordtype">long</span> c(<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.rend()-it-1);<span class="comment">//current it&#39;s index</span>
<a name="l00240"></a>00240       <span class="keywordtype">long</span> <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>(<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>[dsize].<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>), j(<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>[dsize].j), k(it-&gt;i);<span class="comment"></span>
<a name="l00241"></a>00241 <span class="comment">      //// search (k,k) line ////</span>
<a name="l00242"></a>00242 <span class="comment"></span>      <span class="keywordflow">for</span>(std::vector&lt;uint32_t&gt;::iterator p=<a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>[k].begin(); p!=<a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>[k].end(); p++){
<a name="l00243"></a>00243         <span class="keywordflow">if</span>(<span class="keywordtype">long</span>(<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>[*p].i)==k &amp;&amp; long(<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>[*p].j)==k){ *p=dsize; }
<a name="l00244"></a>00244       }<span class="comment"></span>
<a name="l00245"></a>00245 <span class="comment">      //// search (i,j) line ////</span>
<a name="l00246"></a>00246 <span class="comment"></span>      <span class="keywordflow">for</span>(std::vector&lt;uint32_t&gt;::iterator p=<a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>[i].begin(); p!=<a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>].end(); p++){
<a name="l00247"></a>00247         <span class="keywordflow">if</span>(<span class="keywordtype">long</span>(*p)==dsize){ *p=c; }
<a name="l00248"></a>00248       }<span class="comment"></span>
<a name="l00249"></a>00249 <span class="comment">      //// search (j,i) line ////</span>
<a name="l00250"></a>00250 <span class="comment"></span>      <span class="keywordflow">if</span>(i!=j){
<a name="l00251"></a>00251         <span class="keywordflow">for</span>(std::vector&lt;uint32_t&gt;::iterator p=<a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>[j].begin(); p!=<a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>[j].end(); p++){
<a name="l00252"></a>00252           <span class="keywordflow">if</span>(<span class="keywordtype">long</span>(*p)==dsize){ *p=c; }
<a name="l00253"></a>00253         }
<a name="l00254"></a>00254       }
<a name="l00255"></a>00255       <span class="keywordflow">else</span>{<span class="comment">//i==j</span>
<a name="l00256"></a>00256         it--;
<a name="l00257"></a>00257       }<span class="comment"></span>
<a name="l00258"></a>00258 <span class="comment">      //// swap ////</span>
<a name="l00259"></a>00259 <span class="comment"></span>      <a class="code" href="classdssmatrix.html#ac8813cac8bbe03d5a6154f9c663c22ee">std::swap</a>(<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>[dsize],<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>[c]);<span class="comment"></span>
<a name="l00260"></a>00260 <span class="comment">      //// update ////</span>
<a name="l00261"></a>00261 <span class="comment"></span>      dsize++;
<a name="l00262"></a>00262     }
<a name="l00263"></a>00263   }
<a name="l00264"></a>00264   
<a name="l00265"></a>00265   <span class="keywordflow">return</span> dsize;
<a name="l00266"></a>00266 }
<a name="l00267"></a>00267 
<a name="l00268"></a>00268 <span class="comment">//=============================================================================</span><span class="comment"></span>
<a name="l00269"></a>00269 <span class="comment">/*! reorder components */</span>
<a name="l00270"></a><a class="code" href="classdssmatrix.html#acb90d75655c5821bf379cf6431694a6c">00270</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classdssmatrix.html#acb90d75655c5821bf379cf6431694a6c">dssmatrix::reorder</a>(<span class="keyword">const</span> <span class="keywordtype">bool</span> mode)
<a name="l00271"></a>00271 {VERBOSE_REPORT;<span class="comment"></span>
<a name="l00272"></a>00272 <span class="comment">  //// sort data ////</span>
<a name="l00273"></a>00273 <span class="comment"></span>  <span class="keywordflow">if</span>(mode==0){
<a name="l00274"></a>00274     std::sort(<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.begin(), <a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.end(), <a class="code" href="zcomponent_8hpp.html#a82888213c3ecdb9af5e80c26cc5b98ca">dcomponent::ilt</a>);
<a name="l00275"></a>00275   }
<a name="l00276"></a>00276   <span class="keywordflow">else</span>{
<a name="l00277"></a>00277     std::sort(<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.begin(), <a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.end(), <a class="code" href="zcomponent_8hpp.html#a6c6dbac5a1a253a101f8db0678112ae2">dcomponent::jlt</a>);
<a name="l00278"></a>00278   }<span class="comment"></span>
<a name="l00279"></a>00279 <span class="comment">  //// rebuild line ////</span>
<a name="l00280"></a>00280 <span class="comment"></span>  <a class="code" href="classdssmatrix.html#aa08f9ed1e6171e1c9bd067ad12e825bb">rebuild</a>();
<a name="l00281"></a>00281 }
<a name="l00282"></a>00282 
<a name="l00283"></a>00283 <span class="comment">//=============================================================================</span><span class="comment"></span>
<a name="l00284"></a>00284 <span class="comment">/*! rebuild line */</span>
<a name="l00285"></a><a class="code" href="classdssmatrix.html#aa08f9ed1e6171e1c9bd067ad12e825bb">00285</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classdssmatrix.html#aa08f9ed1e6171e1c9bd067ad12e825bb">dssmatrix::rebuild</a>()
<a name="l00286"></a>00286 {VERBOSE_REPORT;<span class="comment"></span>
<a name="l00287"></a>00287 <span class="comment">  //// clear line ////</span>
<a name="l00288"></a>00288 <span class="comment"></span>  <span class="keywordflow">for</span>(<span class="keywordtype">long</span> <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>=0; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>&lt;<a class="code" href="classdssmatrix.html#a94fac8a3f08704f5e0001473fa9a937a" title="matrix column size">n</a>; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){ <a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>].resize(0); }
<a name="l00289"></a>00289   <span class="comment"></span>
<a name="l00290"></a>00290 <span class="comment">  //// build line ////</span>
<a name="l00291"></a>00291 <span class="comment"></span>  uint32_t c(0);
<a name="l00292"></a>00292   <span class="keywordflow">for</span>(std::vector&lt;dcomponent&gt;::iterator it=<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.begin(); it!=<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.end(); it++){
<a name="l00293"></a>00293     <a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>[it-&gt;i].push_back(c);
<a name="l00294"></a>00294     <span class="keywordflow">if</span>( (it-&gt;i) != (it-&gt;j) ){
<a name="l00295"></a>00295       <a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>[it-&gt;j].push_back(c);
<a name="l00296"></a>00296     }
<a name="l00297"></a>00297     c++;
<a name="l00298"></a>00298   }
<a name="l00299"></a>00299 }
<a name="l00300"></a>00300 <span class="comment"></span>
<a name="l00301"></a>00301 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span>
<a name="l00302"></a>00302 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span>
<a name="l00303"></a>00303 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span>
<a name="l00304"></a>00304 <span class="comment"></span>
<a name="l00305"></a>00305 <span class="comment">//=============================================================================</span><span class="comment"></span>
<a name="l00306"></a>00306 <span class="comment">/*! health checkup */</span>
<a name="l00307"></a><a class="code" href="classdssmatrix.html#aca42d5d3610e9592ba78d01fb676ad55">00307</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classdssmatrix.html#aca42d5d3610e9592ba78d01fb676ad55">dssmatrix::checkup</a>()
<a name="l00308"></a>00308 {VERBOSE_REPORT;<span class="comment"></span>
<a name="l00309"></a>00309 <span class="comment">  //////// write ////////</span>
<a name="l00310"></a>00310 <span class="comment"></span>  <span class="keywordflow">for</span>(std::vector&lt;dcomponent&gt;::const_iterator it=<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.begin(); it!=<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.end(); it++){
<a name="l00311"></a>00311     std::cerr &lt;&lt; <span class="stringliteral">&quot;array[&quot;</span> &lt;&lt; it-<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.begin() &lt;&lt; <span class="stringliteral">&quot;] = (&quot;</span> &lt;&lt; it-&gt;i &lt;&lt; <span class="stringliteral">&quot;,&quot;</span> &lt;&lt; it-&gt;j &lt;&lt; <span class="stringliteral">&quot;) = &quot;</span> &lt;&lt; it-&gt;v &lt;&lt; std::endl;
<a name="l00312"></a>00312   }
<a name="l00313"></a>00313   std::cerr &lt;&lt; std::endl;
<a name="l00314"></a>00314   
<a name="l00315"></a>00315   <span class="keywordflow">for</span>(<span class="keywordtype">long</span> <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>=0; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>&lt;<a class="code" href="classdssmatrix.html#a94fac8a3f08704f5e0001473fa9a937a" title="matrix column size">n</a>; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){
<a name="l00316"></a>00316     std::cerr &lt;&lt; <span class="stringliteral">&quot;line[&quot;</span> &lt;&lt; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a> &lt;&lt; <span class="stringliteral">&quot;] =&quot;</span> &lt;&lt; std::flush;
<a name="l00317"></a>00317     <span class="keywordflow">for</span>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> k=0; k&lt;<a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>].size(); k++){
<a name="l00318"></a>00318       std::cerr &lt;&lt; <span class="stringliteral">&quot; &quot;</span> &lt;&lt; <a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>][k] &lt;&lt; std::flush;
<a name="l00319"></a>00319     }
<a name="l00320"></a>00320     std::cerr &lt;&lt; std::endl;
<a name="l00321"></a>00321   }
<a name="l00322"></a>00322   std::cerr &lt;&lt; std::endl;
<a name="l00323"></a>00323   <span class="comment"></span>
<a name="l00324"></a>00324 <span class="comment">  //////// Elements ////////</span>
<a name="l00325"></a>00325 <span class="comment"></span>  <span class="keywordflow">for</span>(std::vector&lt;dcomponent&gt;::const_iterator it=<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.begin(); it!=<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.end(); it++){<span class="comment"></span>
<a name="l00326"></a>00326 <span class="comment">    //// m bound ////</span>
<a name="l00327"></a>00327 <span class="comment"></span>    <span class="keywordflow">if</span>(<span class="keywordtype">long</span>(it-&gt;i)&gt;=<a class="code" href="classdssmatrix.html#a94fac8a3f08704f5e0001473fa9a937a" title="matrix column size">n</a>){
<a name="l00328"></a>00328       ERROR_REPORT;
<a name="l00329"></a>00329       std::cerr &lt;&lt; <span class="stringliteral">&quot;The indx of the &quot;</span> &lt;&lt; it-<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.begin() &lt;&lt; <span class="stringliteral">&quot;th element is out of the matrix size.&quot;</span> &lt;&lt; std::endl
<a name="l00330"></a>00330                 &lt;&lt; <span class="stringliteral">&quot;Its i index was &quot;</span> &lt;&lt; it-&gt;i &lt;&lt; <span class="stringliteral">&quot;.&quot;</span> &lt;&lt; std::endl;
<a name="l00331"></a>00331       exit(1);
<a name="l00332"></a>00332     }
<a name="l00333"></a>00333     <span class="comment"></span>
<a name="l00334"></a>00334 <span class="comment">    //// n bound ////</span>
<a name="l00335"></a>00335 <span class="comment"></span>    <span class="keywordflow">if</span>(<span class="keywordtype">long</span>(it-&gt;j)&gt;=n){
<a name="l00336"></a>00336       ERROR_REPORT;
<a name="l00337"></a>00337       std::cerr &lt;&lt; <span class="stringliteral">&quot;The jndx of the &quot;</span> &lt;&lt; it-<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.begin() &lt;&lt; <span class="stringliteral">&quot;th element is out of the matrix size.&quot;</span> &lt;&lt; std::endl
<a name="l00338"></a>00338                 &lt;&lt; <span class="stringliteral">&quot;Its j index was &quot;</span> &lt;&lt; it-&gt;j &lt;&lt; <span class="stringliteral">&quot;.&quot;</span> &lt;&lt; std::endl;
<a name="l00339"></a>00339       exit(1);
<a name="l00340"></a>00340     }
<a name="l00341"></a>00341     <span class="comment"></span>
<a name="l00342"></a>00342 <span class="comment">    //// double-listed ////</span>
<a name="l00343"></a>00343 <span class="comment"></span>    <span class="keywordflow">for</span>(std::vector&lt;dcomponent&gt;::const_iterator IT=it+1; IT!=<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.end(); IT++){
<a name="l00344"></a>00344       <span class="keywordflow">if</span>( it-&gt;i==IT-&gt;i &amp;&amp; it-&gt;j==IT-&gt;j ){
<a name="l00345"></a>00345         ERROR_REPORT;
<a name="l00346"></a>00346         std::cerr &lt;&lt; <span class="stringliteral">&quot;The (&quot;</span> &lt;&lt; it-&gt;i &lt;&lt; <span class="stringliteral">&quot;, &quot;</span> &lt;&lt; it-&gt;j &lt;&lt; <span class="stringliteral">&quot;) component is double-listed at the &quot;</span> &lt;&lt; it-<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.begin() &lt;&lt; <span class="stringliteral">&quot;th and the&quot;</span> &lt;&lt; IT-<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>.begin() &lt;&lt; <span class="stringliteral">&quot;the elements.&quot;</span>&lt;&lt; std::endl;
<a name="l00347"></a>00347         exit(1);
<a name="l00348"></a>00348       }
<a name="l00349"></a>00349     }
<a name="l00350"></a>00350   }
<a name="l00351"></a>00351   <span class="comment"></span>
<a name="l00352"></a>00352 <span class="comment">  //////// NOTE ////////</span>
<a name="l00353"></a>00353 <span class="comment"></span>  std::cerr &lt;&lt; <span class="stringliteral">&quot;# [NOTE]@dssmatrix::checkup(): This symmetric sparse matrix is fine.&quot;</span> &lt;&lt; std::endl;
<a name="l00354"></a>00354 }
<a name="l00355"></a>00355 <span class="comment"></span>
<a name="l00356"></a>00356 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span>
<a name="l00357"></a>00357 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span>
<a name="l00358"></a>00358 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span>
<a name="l00359"></a>00359 <span class="comment"></span>
<a name="l00360"></a>00360 <span class="comment">//=============================================================================</span><span class="comment"></span>
<a name="l00361"></a>00361 <span class="comment">/*! swap two matrices */</span>
<a name="l00362"></a><a class="code" href="dssmatrix-misc_8hpp.html#a2decfb58e7efd8ea1244e102db53013a">00362</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="dcovector-misc_8hpp.html#a4f6cde9aa05d9af1ec9bf725dd664869">swap</a>(<a class="code" href="classdssmatrix.html" title="Real Double-precision Symmetric Sparse Matrix Class.">dssmatrix</a>&amp; A, <a class="code" href="classdssmatrix.html" title="Real Double-precision Symmetric Sparse Matrix Class.">dssmatrix</a>&amp; B)
<a name="l00363"></a>00363 {VERBOSE_REPORT;
<a name="l00364"></a>00364   <a class="code" href="dcovector-misc_8hpp.html#a4f6cde9aa05d9af1ec9bf725dd664869">std::swap</a>(A.<a class="code" href="classdssmatrix.html#a94fac8a3f08704f5e0001473fa9a937a" title="matrix column size">n</a>,B.<a class="code" href="classdssmatrix.html#a94fac8a3f08704f5e0001473fa9a937a" title="matrix column size">n</a>);
<a name="l00365"></a>00365   <a class="code" href="dcovector-misc_8hpp.html#a4f6cde9aa05d9af1ec9bf725dd664869">std::swap</a>(A.<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>,B.<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>);
<a name="l00366"></a>00366   <a class="code" href="dcovector-misc_8hpp.html#a4f6cde9aa05d9af1ec9bf725dd664869">std::swap</a>(A.<a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>,B.<a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>);
<a name="l00367"></a>00367 }
<a name="l00368"></a>00368 
<a name="l00369"></a>00369 <span class="comment">//=============================================================================</span><span class="comment"></span>
<a name="l00370"></a>00370 <span class="comment">/*! convert user object to smart-temporary object */</span>
<a name="l00371"></a><a class="code" href="dssmatrix-misc_8hpp.html#a0d3c1a6555eda6fde1ab8af35eae244e">00371</a> <span class="keyword">inline</span> <a class="code" href="class__dssmatrix.html" title="(DO NOT USE) Smart-temporary Real Double-precision Symmetric Sparse Matrix Class">_dssmatrix</a> <a class="code" href="dcovector-misc_8hpp.html#a297beda6502b0d92c99576d2fb9548cb">_</a>(<a class="code" href="classdssmatrix.html" title="Real Double-precision Symmetric Sparse Matrix Class.">dssmatrix</a>&amp; mat)
<a name="l00372"></a>00372 {VERBOSE_REPORT;
<a name="l00373"></a>00373   <a class="code" href="class__dssmatrix.html" title="(DO NOT USE) Smart-temporary Real Double-precision Symmetric Sparse Matrix Class">_dssmatrix</a> newmat;
<a name="l00374"></a>00374   <span class="comment"></span>
<a name="l00375"></a>00375 <span class="comment">  //////// shallow copy ////////</span>
<a name="l00376"></a>00376 <span class="comment"></span>  newmat.<a class="code" href="class__dssmatrix.html#ac1de480934f45511a98ddc610868803f" title="matrix column size">n</a> =mat.<a class="code" href="classdssmatrix.html#a94fac8a3f08704f5e0001473fa9a937a" title="matrix column size">n</a>;
<a name="l00377"></a>00377   <a class="code" href="dcovector-misc_8hpp.html#a4f6cde9aa05d9af1ec9bf725dd664869">std::swap</a>(newmat.<a class="code" href="class__dssmatrix.html#a0c4e6868fac505c8a01b4d26558ec009" title="matrix data">data</a>,mat.<a class="code" href="classdssmatrix.html#a258714120e316e12a03ee60dc0151888" title="matrix data">data</a>);
<a name="l00378"></a>00378   <a class="code" href="dcovector-misc_8hpp.html#a4f6cde9aa05d9af1ec9bf725dd664869">std::swap</a>(newmat.<a class="code" href="class__dssmatrix.html#a988041b8d0cf2b8cce763f8da302c7e0" title="vector of vector to store the entry information of component for each row and column">line</a>,mat.<a class="code" href="classdssmatrix.html#afe21536a32fe45971cf2c25bf91903ac" title="vector of vector to store the entry information of component for each row and column">line</a>);
<a name="l00379"></a>00379   <span class="comment"></span>
<a name="l00380"></a>00380 <span class="comment">  //////// nullify ////////</span>
<a name="l00381"></a>00381 <span class="comment"></span>  mat.<a class="code" href="classdssmatrix.html#a94fac8a3f08704f5e0001473fa9a937a" title="matrix column size">n</a> =0;
<a name="l00382"></a>00382   
<a name="l00383"></a>00383   <span class="keywordflow">return</span> newmat;
<a name="l00384"></a>00384 }
</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>
