<!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: Example Codes of dgematrix LAPACK Functions</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 class="current"><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><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>
<div class="header">
  <div class="headertitle">
<div class="title">Example Codes of dgematrix LAPACK Functions </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><div class="fragment"><pre class="fragment"><span class="comment">//=============================================================================</span><span class="comment"></span>
<span class="comment">/*! dgesv_check */</span>
<span class="keywordtype">void</span> dgesv_check_vector()
{
  std::cout &lt;&lt; <span class="stringliteral">&quot;############ check dgesv vector ############&quot;</span> &lt;&lt; std::endl;
  
  srand(time(NULL));
  <span class="keywordtype">int</span> M(3);
  <span class="comment"></span>
<span class="comment">  //// make dgematrix A  ////</span>
<span class="comment"></span>  CPPL::dgematrix A(M,M);
  <span class="keywordflow">for</span>(<span class="keywordtype">int</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.<a class="code" href="class__dgematrix.html#a4c07ace0e1899332aa2d620af184dadf" title="matrix row size">m</a>; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){ <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0; j&lt;A.n; j++){
    A(<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>,j) =double( rand() /(RAND_MAX/10) );
  }}
  <span class="comment"></span>
<span class="comment">  //// make dcovector y ////</span>
<span class="comment"></span>  CPPL::dcovector y(M);
  <span class="keywordflow">for</span>(<span class="keywordtype">int</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;y.l; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){
    y(<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>) =double( rand() /(RAND_MAX/10) );
  }
  <span class="comment"></span>
<span class="comment">  //// make A_original and y_original ////</span>
<span class="comment"></span>  CPPL::dgematrix A_original(A);
  CPPL::dcovector y_original(y);
  std::cout &lt;&lt; <span class="stringliteral">&quot;A_original=\n&quot;</span> &lt;&lt; A_original &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;y_original=\n&quot;</span> &lt;&lt; y_original &lt;&lt; std::endl;
  <span class="comment"></span>
<span class="comment">  //// solve Ax=y ////</span>
<span class="comment"></span>  A.dgesv(y);
    <span class="comment"></span>
<span class="comment">  //// print A, y and A_original*y ////</span>
<span class="comment"></span>  std::cout &lt;&lt; <span class="stringliteral">&quot;A=\n&quot;</span> &lt;&lt; A &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;y=\n&quot;</span> &lt;&lt; y &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;A_original*y=\n&quot;</span> &lt;&lt; A_original*y &lt;&lt; std::endl;
}

<span class="keywordtype">void</span> dgesv_check_matrix()
{
  std::cout &lt;&lt; <span class="stringliteral">&quot;############ check dgesv matrix ############&quot;</span> &lt;&lt; std::endl;
  
  srand(time(NULL));
  <span class="keywordtype">int</span> M(3);
  
<span class="comment"></span>
<span class="comment">  //// make dgematrix A  ////</span>
<span class="comment"></span>  CPPL::dgematrix A(M,M);
  <span class="keywordflow">for</span>(<span class="keywordtype">int</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.<a class="code" href="class__dgematrix.html#a4c07ace0e1899332aa2d620af184dadf" title="matrix row size">m</a>; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){ <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0; j&lt;A.n; j++){
    A(<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>,j) =double( rand() /(RAND_MAX/10) );
  }}
   <span class="comment"></span>
<span class="comment">  //// make dgematrix Y  ////</span>
<span class="comment"></span>  CPPL::dgematrix Y(M,M);
  <span class="keywordflow">for</span>(<span class="keywordtype">int</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;Y.<a class="code" href="class__dgematrix.html#a4c07ace0e1899332aa2d620af184dadf" title="matrix row size">m</a>; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){ <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0; j&lt;Y.n; j++){
    Y(<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>,j) =double( rand() /(RAND_MAX/10) );
  }}
   <span class="comment"></span>
<span class="comment">  //// make A_original and Y_original ////</span>
<span class="comment"></span>  CPPL::dgematrix A_original(A);
  CPPL::dgematrix Y_original(Y);
  std::cout &lt;&lt; <span class="stringliteral">&quot;A_original=\n&quot;</span> &lt;&lt; A_original &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;Y_original=\n&quot;</span> &lt;&lt; Y_original &lt;&lt; std::endl;
  <span class="comment"></span>
<span class="comment">  //// solve AY=B ////</span>
<span class="comment"></span>  A.dgesv(Y);
    <span class="comment"></span>
<span class="comment">  //// print A, Y and A_original*Y ////</span>
<span class="comment"></span>  std::cout &lt;&lt; <span class="stringliteral">&quot;A=\n&quot;</span> &lt;&lt; A &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;Y=\n&quot;</span> &lt;&lt; Y &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;A_original*Y=\n&quot;</span> &lt;&lt; A_original*Y &lt;&lt; std::endl;
}
</pre></div> <div class="fragment"><pre class="fragment"><span class="comment">//=============================================================================</span><span class="comment"></span>
<span class="comment">/*! dgels_check */</span>
<span class="keywordtype">void</span> dgels_check_vector()
{
  std::cout &lt;&lt; <span class="stringliteral">&quot;############ check dgels vector ############&quot;</span> &lt;&lt; std::endl;
  
  srand(time(NULL));
  <span class="keywordtype">int</span> M(3), N(2);
  <span class="comment"></span>
<span class="comment">  //// make dgematrix A  ////</span>
<span class="comment"></span>  CPPL::dgematrix A(M,N);
  <span class="keywordflow">for</span>(<span class="keywordtype">int</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.<a class="code" href="class__dgematrix.html#a4c07ace0e1899332aa2d620af184dadf" title="matrix row size">m</a>; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){ <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0; j&lt;A.n; j++){
    A(<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>,j) =double( rand() /(RAND_MAX/10) );
  }}
  <span class="comment"></span>
<span class="comment">  //// make dcovector y  ////</span>
<span class="comment"></span>  CPPL::dcovector y(M);
  <span class="keywordflow">for</span>(<span class="keywordtype">int</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;y.l; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){
    y(<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>) =double( rand() /(RAND_MAX/10) );
  }
  <span class="comment"></span>
<span class="comment">  //// make originals ////</span>
<span class="comment"></span>  CPPL::dgematrix A_original(A);
  CPPL::dcovector y_original(y);
  <span class="comment"></span>
<span class="comment">  //// dgels ////</span>
<span class="comment"></span>  A.dgels(y);
  <span class="comment"></span>
<span class="comment">  //// print ////</span>
<span class="comment"></span>  std::cout &lt;&lt; <span class="stringliteral">&quot;######## dgels(vec) ########&quot;</span> &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;A_original=\n&quot;</span> &lt;&lt; A_original &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;y_original=\n&quot;</span> &lt;&lt; y_original &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;A=\n&quot;</span> &lt;&lt; A &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;y=\n&quot;</span> &lt;&lt; y &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;A_original*y=\n&quot;</span> &lt;&lt; A_original*y &lt;&lt; std::endl;
  <span class="comment"></span>
<span class="comment">  //// reset ////</span>
<span class="comment"></span>  A =A_original;
  y =y_original;
  <span class="keywordtype">double</span> r; <span class="comment">//residual square</span>
  <span class="comment"></span>
<span class="comment">  //// dgels ////</span>
<span class="comment"></span>  A.dgels(y,r);
  <span class="comment"></span>
<span class="comment">  //// print ////</span>
<span class="comment"></span>  std::cout &lt;&lt; <span class="stringliteral">&quot;######## dgels(vec, residual) ########&quot;</span> &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;A_original=\n&quot;</span> &lt;&lt; A_original &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;y_original=\n&quot;</span> &lt;&lt; y_original &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;A=\n&quot;</span> &lt;&lt; A &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;y=\n&quot;</span> &lt;&lt; y &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;residual=&quot;</span> &lt;&lt; r &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;A_original*y=\n&quot;</span> &lt;&lt; A_original*y &lt;&lt; std::endl;
}

<span class="comment">//==============================================================================</span>
<span class="keywordtype">void</span> dgels_check_matrix()
{
  std::cout &lt;&lt; <span class="stringliteral">&quot;############ check dgels matrix ############&quot;</span> &lt;&lt; std::endl;
  
  srand(time(NULL));
  <span class="keywordtype">int</span> M(3), N(2);
  <span class="comment"></span>
<span class="comment">  //// make dgematrix A  ////</span>
<span class="comment"></span>  CPPL::dgematrix A(M,N);
  <span class="keywordflow">for</span>(<span class="keywordtype">int</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.<a class="code" href="class__dgematrix.html#a4c07ace0e1899332aa2d620af184dadf" title="matrix row size">m</a>; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){ <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0; j&lt;A.n; j++){
    A(<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>,j) =double( rand() /(RAND_MAX/10) );
  }}
<span class="comment"></span>
<span class="comment">  //// make dgematrix Y  ////</span>
<span class="comment"></span>  CPPL::dgematrix Y(M,M);
  <span class="keywordflow">for</span>(<span class="keywordtype">int</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;Y.<a class="code" href="class__dgematrix.html#a4c07ace0e1899332aa2d620af184dadf" title="matrix row size">m</a>; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){ <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0; j&lt;Y.n; j++){
    Y(<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>,j) =double( rand() /(RAND_MAX/10) );
  }}
   <span class="comment"></span>
<span class="comment">  //// make originals ////</span>
<span class="comment"></span>  CPPL::dgematrix A_original(A);
  CPPL::dgematrix Y_original(Y);
  <span class="comment"></span>
<span class="comment">  //// dgels ////</span>
<span class="comment"></span>  A.dgels(Y);
  <span class="comment"></span>
<span class="comment">  //// print ////</span>
<span class="comment"></span>  std::cout &lt;&lt; <span class="stringliteral">&quot;######## dgels(mat) ########&quot;</span> &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;A_original=\n&quot;</span> &lt;&lt; A_original &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;Y_original=\n&quot;</span> &lt;&lt; Y_original &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;A=\n&quot;</span> &lt;&lt; A &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;Y=\n&quot;</span> &lt;&lt; Y &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;A_original*Y=\n&quot;</span> &lt;&lt; A_original*Y &lt;&lt; std::endl;
  <span class="comment"></span>
<span class="comment">  //// reset ////</span>
<span class="comment"></span>  A =A_original;
  Y =Y_original;
  CPPL::drovector R; <span class="comment">//residual square</span>
  <span class="comment"></span>
<span class="comment">  //// dgels ////</span>
<span class="comment"></span>  A.dgels(Y,R);
  <span class="comment"></span>
<span class="comment">  //// print ////</span>
<span class="comment"></span>  std::cout &lt;&lt; <span class="stringliteral">&quot;######## dgels(mat, residual) ########&quot;</span> &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;A_original=\n&quot;</span> &lt;&lt; A_original &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;Y_original=\n&quot;</span> &lt;&lt; Y_original &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;A=\n&quot;</span> &lt;&lt; A &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;Y=\n&quot;</span> &lt;&lt; Y &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;residual=&quot;</span> &lt;&lt; R &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;A_original*Y=\n&quot;</span> &lt;&lt; A_original*Y &lt;&lt; std::endl;  
}
</pre></div> <div class="fragment"><pre class="fragment"><span class="comment">//=============================================================================</span><span class="comment"></span>
<span class="comment">/*! dgelss_check_vector */</span>
<span class="keywordtype">void</span> dgelss_check_vector()
{
  std::cout &lt;&lt; <span class="stringliteral">&quot;############ check dgelss vector ############&quot;</span> &lt;&lt; std::endl;
  
  srand(time(NULL));
  <span class="keywordtype">int</span> M(3), N(4);
  <span class="keywordtype">long</span> RANK(0);
  <span class="keywordtype">double</span> RCOND(-1.0);
  <span class="comment"></span>
<span class="comment">  //// make dgematrix A  ////</span>
<span class="comment"></span>  CPPL::dgematrix A(M,N);
  <span class="keywordflow">for</span>(<span class="keywordtype">int</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.<a class="code" href="class__dgematrix.html#a4c07ace0e1899332aa2d620af184dadf" title="matrix row size">m</a>; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){ <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0; j&lt;A.n; j++){
    A(<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>,j) =double( rand() /(RAND_MAX/10) );
  }}
<span class="comment"></span>
<span class="comment">  //// make dcovector b  ////</span>
<span class="comment"></span>  CPPL::dcovector b(M);
  <span class="keywordflow">for</span>(<span class="keywordtype">int</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;b.l; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){
    b(<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>) =double( rand() /(RAND_MAX/10) );
  }
<span class="comment"></span>
<span class="comment">  //// make dcovector s  ////</span>
<span class="comment"></span>  CPPL::dcovector s;
   <span class="comment"></span>
<span class="comment">  //// make A_original ////</span>
<span class="comment"></span>  CPPL::dgematrix A_original(A);
  <span class="comment"></span>
<span class="comment">  //// make A_original ////</span>
<span class="comment"></span>  CPPL::dcovector b_original(b);
  <span class="comment"></span>
<span class="comment">  //// dgels ////</span>
<span class="comment"></span>  A.dgelss(b,s,RANK,RCOND);
  <span class="comment"></span>
<span class="comment">  //// print ////</span>
<span class="comment"></span>  std::cout &lt;&lt; <span class="stringliteral">&quot;A_original=\n&quot;</span> &lt;&lt; A_original &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;b_original=\n&quot;</span> &lt;&lt; b_original &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;A=\n&quot;</span> &lt;&lt; A &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;b=\n&quot;</span> &lt;&lt; b &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;s=\n&quot;</span> &lt;&lt; s &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;A_original*b=\n&quot;</span> &lt;&lt; A_original*b &lt;&lt; std::endl;
}


<span class="comment">//=============================================================================</span><span class="comment"></span>
<span class="comment">/*! dgelss_check_matrix */</span>
<span class="keywordtype">void</span> dgelss_check_matrix()
{
  std::cout &lt;&lt; <span class="stringliteral">&quot;############ check dgelss matrix ############&quot;</span> &lt;&lt; std::endl;
  
  srand(time(NULL));
  <span class="keywordtype">int</span> M(3), N(4);
  <span class="keywordtype">long</span> RANK(0);
  <span class="keywordtype">double</span> RCOND(-1.0);
  <span class="comment"></span>
<span class="comment">  //// make dgematrix A  ////</span>
<span class="comment"></span>  CPPL::dgematrix A(M,N);
  <span class="keywordflow">for</span>(<span class="keywordtype">int</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.<a class="code" href="class__dgematrix.html#a4c07ace0e1899332aa2d620af184dadf" title="matrix row size">m</a>; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){ <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0; j&lt;A.n; j++){
    A(<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>,j) =double( rand() /(RAND_MAX/10) );
  }}
<span class="comment"></span>
<span class="comment">  //// make dgematrix B  ////</span>
<span class="comment"></span>  CPPL::dgematrix b(M,2);
  <span class="keywordflow">for</span>(<span class="keywordtype">int</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;b.<a class="code" href="class__dgematrix.html#a4c07ace0e1899332aa2d620af184dadf" title="matrix row size">m</a>; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){
    <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0; j&lt;b.n; j++){
      b(<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>,j) =double( rand() /(RAND_MAX/10) );
    }
  }
  <span class="comment"></span>
<span class="comment">  //// make dcovector s  ////</span>
<span class="comment"></span>  CPPL::dcovector s;
   <span class="comment"></span>
<span class="comment">  //// make A_original ////</span>
<span class="comment"></span>  CPPL::dgematrix A_original(A);
  <span class="comment"></span>
<span class="comment">  //// make b_original ////</span>
<span class="comment"></span>  CPPL::dgematrix b_original(b);
  <span class="comment"></span>
<span class="comment">  //// dgels ////</span>
<span class="comment"></span>  A.dgelss(b,s,RANK,RCOND);
  <span class="comment"></span>
<span class="comment">  //// print ////</span>
<span class="comment"></span>  std::cout &lt;&lt; <span class="stringliteral">&quot;A_original=\n&quot;</span> &lt;&lt; A_original &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;b_original=\n&quot;</span> &lt;&lt; b_original &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;A=\n&quot;</span> &lt;&lt; A &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;b=\n&quot;</span> &lt;&lt; b &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;s=\n&quot;</span> &lt;&lt; s &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;A_original*b=\n&quot;</span> &lt;&lt; A_original*b &lt;&lt; std::endl;
}
</pre></div> <div class="fragment"><pre class="fragment"><span class="comment">//=============================================================================</span>
<span class="keywordtype">void</span> dgeev_check_value()
{
  std::cout &lt;&lt; <span class="stringliteral">&quot;############ check dgeev value ############&quot;</span> &lt;&lt; std::endl;
  
  srand(time(NULL));
  <span class="keywordtype">int</span> M(3);
  <span class="comment"></span>
<span class="comment">  //// make dgematrix A  ////</span>
<span class="comment"></span>  CPPL::dgematrix A(M,M);
  <span class="keywordflow">for</span>(<span class="keywordtype">int</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.<a class="code" href="class__dgematrix.html#a4c07ace0e1899332aa2d620af184dadf" title="matrix row size">m</a>; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){ <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0; j&lt;A.n; j++){
      A(<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>,j) =double( rand() /(RAND_MAX/10) );
    }}
  <span class="comment"></span>
<span class="comment">  //// make wr wi vr ////</span>
<span class="comment"></span>  std::vector&lt;double&gt; wr, wi;
  <span class="comment"></span>
<span class="comment">  //// make A_original ////</span>
<span class="comment"></span>  CPPL::dgematrix A_original(A);
  <span class="comment"></span>
<span class="comment">  //// dgeev ////</span>
<span class="comment"></span>  A.dgeev(wr, wi);
  <span class="comment"></span>
<span class="comment">  //// print ////</span>
<span class="comment"></span>  std::cout &lt;&lt; <span class="stringliteral">&quot;A_original=\n&quot;</span> &lt;&lt; A_original &lt;&lt; std::endl;
  <span class="keywordflow">for</span>(<span class="keywordtype">int</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.<a class="code" href="class__dgematrix.html#a4c07ace0e1899332aa2d620af184dadf" title="matrix row size">m</a>; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){
    std::cout &lt;&lt; <span class="stringliteral">&quot;#### &quot;</span> &lt;&lt; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a> &lt;&lt; <span class="stringliteral">&quot;th eigen ####&quot;</span> &lt;&lt; std::endl;
    std::cout &lt;&lt; <span class="stringliteral">&quot;wr=&quot;</span> &lt;&lt; wr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>] &lt;&lt;std::endl;
    std::cout &lt;&lt; <span class="stringliteral">&quot;wi=&quot;</span> &lt;&lt; wi[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>] &lt;&lt;std::endl;
  }
}

<span class="comment">//=============================================================================</span>
<span class="keywordtype">void</span> dgeev_check_right()
{
  std::cout &lt;&lt; <span class="stringliteral">&quot;############ check dgeev right ############&quot;</span> &lt;&lt; std::endl;
  
  srand(time(NULL));
  <span class="keywordtype">int</span> M(3);
  <span class="comment"></span>
<span class="comment">  //// make dgematrix A  ////</span>
<span class="comment"></span>  CPPL::dgematrix A(M,M);
  <span class="keywordflow">for</span>(<span class="keywordtype">int</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.<a class="code" href="class__dgematrix.html#a4c07ace0e1899332aa2d620af184dadf" title="matrix row size">m</a>; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){ <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0; j&lt;A.n; j++){
      A(<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>,j) =double( rand() /(RAND_MAX/10) );
    }}
  <span class="comment"></span>
<span class="comment">  //// make wr wi vr ////</span>
<span class="comment"></span>  std::vector&lt;double&gt; wr, wi;
  std::vector&lt;CPPL::dcovector&gt; vrr, vri;
  <span class="comment"></span>
<span class="comment">  //// make A_original ////</span>
<span class="comment"></span>  CPPL::dgematrix A_original(A);
  <span class="comment"></span>
<span class="comment">  //// dgeev ////</span>
<span class="comment"></span>  A.dgeev(wr, wi ,vrr, vri);
  <span class="comment"></span>
<span class="comment">  //// print ////</span>
<span class="comment"></span>  std::cout &lt;&lt; <span class="stringliteral">&quot;A_original=\n&quot;</span> &lt;&lt; A_original &lt;&lt; std::endl;
  <span class="keywordflow">for</span>(<span class="keywordtype">int</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.<a class="code" href="class__dgematrix.html#a4c07ace0e1899332aa2d620af184dadf" title="matrix row size">m</a>; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){
    std::cout &lt;&lt; <span class="stringliteral">&quot;#### &quot;</span> &lt;&lt; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a> &lt;&lt; <span class="stringliteral">&quot;th eigen ####&quot;</span> &lt;&lt; std::endl;
    std::cout &lt;&lt; <span class="stringliteral">&quot;wr=&quot;</span> &lt;&lt; wr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>] &lt;&lt;std::endl;
    std::cout &lt;&lt; <span class="stringliteral">&quot;wi=&quot;</span> &lt;&lt; wi[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>] &lt;&lt;std::endl;
    std::cout &lt;&lt; <span class="stringliteral">&quot;vrr=\n&quot;</span> &lt;&lt; vrr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>] &lt;&lt;std::endl;
    std::cout &lt;&lt; <span class="stringliteral">&quot;vri=\n&quot;</span> &lt;&lt; vri[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>] &lt;&lt;std::endl;
    std::cout &lt;&lt; <span class="stringliteral">&quot;Real[ [A]*{x} -lambda*{x} ] = (Should be zeros)\n&quot;</span>
              &lt;&lt; A_original*vrr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>] -(wr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]*vrr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>] - wi[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]*vri[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]) 
              &lt;&lt; std::endl;
    std::cout &lt;&lt; <span class="stringliteral">&quot;Imag[ [A]*{x} -lambda*{x} ] = (Should be zeros)\n&quot;</span>
              &lt;&lt; A_original*vri[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>] -(wr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]*vri[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>] + wi[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]*vrr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]) 
              &lt;&lt; std::endl;
  }
}

<span class="comment">//=============================================================================</span>
<span class="keywordtype">void</span> dgeev_check_left()
{
  std::cout &lt;&lt; <span class="stringliteral">&quot;############ check dgeev left ############&quot;</span> &lt;&lt; std::endl;
  
  srand(time(NULL));
  <span class="keywordtype">int</span> M(3);
  <span class="comment"></span>
<span class="comment">  //// make dgematrix A  ////</span>
<span class="comment"></span>  CPPL::dgematrix A(M,M);
  <span class="keywordflow">for</span>(<span class="keywordtype">int</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.<a class="code" href="class__dgematrix.html#a4c07ace0e1899332aa2d620af184dadf" title="matrix row size">m</a>; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){ <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0; j&lt;A.n; j++){
      A(<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>,j) =double( rand() /(RAND_MAX/10) );
    }}
  <span class="comment"></span>
<span class="comment">  //// make wr wi vl ////</span>
<span class="comment"></span>  std::vector&lt;double&gt; wr, wi;
  std::vector&lt;CPPL::drovector&gt; vlr, vli;
  <span class="comment"></span>
<span class="comment">  //// make A_original ////</span>
<span class="comment"></span>  CPPL::dgematrix A_original(A);
  <span class="comment"></span>
<span class="comment">  //// dgeev ////</span>
<span class="comment"></span>  A.dgeev(wr, wi ,vlr, vli);
  <span class="comment"></span>
<span class="comment">  //// print ////</span>
<span class="comment"></span>  std::cout &lt;&lt; <span class="stringliteral">&quot;A_original=\n&quot;</span> &lt;&lt; A_original &lt;&lt; std::endl;
  <span class="keywordflow">for</span>(<span class="keywordtype">int</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.<a class="code" href="class__dgematrix.html#a4c07ace0e1899332aa2d620af184dadf" title="matrix row size">m</a>; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){
    std::cout &lt;&lt; <span class="stringliteral">&quot;#### &quot;</span> &lt;&lt; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a> &lt;&lt; <span class="stringliteral">&quot;th eigen ####&quot;</span> &lt;&lt; std::endl;
    std::cout &lt;&lt; <span class="stringliteral">&quot;wr = &quot;</span> &lt;&lt; wr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>] &lt;&lt; std::endl;
    std::cout &lt;&lt; <span class="stringliteral">&quot;wi = &quot;</span> &lt;&lt; wi[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>] &lt;&lt; std::endl;
    std::cout &lt;&lt; <span class="stringliteral">&quot;vlr = &quot;</span> &lt;&lt; vlr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>];
    std::cout &lt;&lt; <span class="stringliteral">&quot;vli = &quot;</span> &lt;&lt; vli[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>] &lt;&lt; std::endl;
    std::cout &lt;&lt; <span class="stringliteral">&quot;Real[ {x}*[A] -{x}*lambda ] = (Should be zeros)\n&quot;</span>
              &lt;&lt; vlr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]*A_original -(vlr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]*wr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>] - vli[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]*wi[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]) 
              &lt;&lt; std::endl;
    std::cout &lt;&lt; <span class="stringliteral">&quot;Imag[ {x}*[A] -{x}*lambda ] = (Should be zeros)\n&quot;</span>
              &lt;&lt; vli[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]*A_original -(vli[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]*wr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>] + vlr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]*wi[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]) 
              &lt;&lt; std::endl;
  }
}
</pre></div> <div class="fragment"><pre class="fragment"><span class="comment">//=============================================================================</span>
<span class="keywordtype">void</span> dggev_check_value()
{
  std::cout &lt;&lt; <span class="stringliteral">&quot;############ check dggev value ############&quot;</span> &lt;&lt; std::endl;
  
  srand(time(NULL));
  <span class="keywordtype">int</span> M(3);
  <span class="comment"></span>
<span class="comment">  //// make dgematrix A and B ////</span>
<span class="comment"></span>  CPPL::dgematrix A(M,M), B(M,M);
  <span class="keywordflow">for</span>(<span class="keywordtype">int</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.<a class="code" href="class__dgematrix.html#a4c07ace0e1899332aa2d620af184dadf" title="matrix row size">m</a>; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){ <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0; j&lt;A.n; j++){
    A(<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>,j) =double( rand() /(RAND_MAX/10) );
    B(<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>,j) =double( rand() /(RAND_MAX/10) );
  }}
  <span class="comment"></span>
<span class="comment">  //// make wr wi vr ////</span>
<span class="comment"></span>  std::vector&lt;double&gt; wr, wi;
  <span class="comment"></span>
<span class="comment">  //// make A_original and B_original ////</span>
<span class="comment"></span>  CPPL::dgematrix A_original(A);
  CPPL::dgematrix B_original(B);
  <span class="comment"></span>
<span class="comment">  //// dggev ////</span>
<span class="comment"></span>  A.dggev(B, wr, wi);
  <span class="comment"></span>
<span class="comment">  //// print ////</span>
<span class="comment"></span>  std::cout &lt;&lt; <span class="stringliteral">&quot;A_original=\n&quot;</span> &lt;&lt; A_original &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;B_original=\n&quot;</span> &lt;&lt; B_original &lt;&lt; std::endl;
  <span class="keywordflow">for</span>(<span class="keywordtype">int</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.<a class="code" href="class__dgematrix.html#a4c07ace0e1899332aa2d620af184dadf" title="matrix row size">m</a>; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){
    std::cout &lt;&lt; <span class="stringliteral">&quot;#### &quot;</span> &lt;&lt; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a> &lt;&lt; <span class="stringliteral">&quot;th eigen ####&quot;</span> &lt;&lt; std::endl;
    std::cout &lt;&lt; <span class="stringliteral">&quot;wr=&quot;</span> &lt;&lt; wr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>] &lt;&lt;std::endl;
    std::cout &lt;&lt; <span class="stringliteral">&quot;wi=&quot;</span> &lt;&lt; wi[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>] &lt;&lt;std::endl;
  }
}

<span class="comment">//=============================================================================</span>
<span class="keywordtype">void</span> dggev_check_right()
{
  std::cout &lt;&lt; <span class="stringliteral">&quot;############ check dggev right ############&quot;</span> &lt;&lt; std::endl;
  
  srand(time(NULL));
  <span class="keywordtype">int</span> M(3);
  <span class="comment"></span>
<span class="comment">  //// make dgematrix A and B ////</span>
<span class="comment"></span>  CPPL::dgematrix A(M,M), B(M,M);
  <span class="keywordflow">for</span>(<span class="keywordtype">int</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.<a class="code" href="class__dgematrix.html#a4c07ace0e1899332aa2d620af184dadf" title="matrix row size">m</a>; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){ <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0; j&lt;A.n; j++){
    A(<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>,j) =double( rand() /(RAND_MAX/10) );
    B(<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>,j) =double( rand() /(RAND_MAX/10) );
  }}
  <span class="comment"></span>
<span class="comment">  //// make wr wi vr ////</span>
<span class="comment"></span>  std::vector&lt;double&gt; wr, wi;
  std::vector&lt;CPPL::dcovector&gt; vrr, vri;
  <span class="comment"></span>
<span class="comment">  //// make A_original and B_original ////</span>
<span class="comment"></span>  CPPL::dgematrix A_original(A);
  CPPL::dgematrix B_original(B);
  <span class="comment"></span>
<span class="comment">  //// dggev ////</span>
<span class="comment"></span>  A.dggev(B, wr, wi ,vrr, vri);
  <span class="comment"></span>
<span class="comment">  //// print ////</span>
<span class="comment"></span>  std::cout &lt;&lt; <span class="stringliteral">&quot;A_original=\n&quot;</span> &lt;&lt; A_original &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;B_original=\n&quot;</span> &lt;&lt; B_original &lt;&lt; std::endl;
  <span class="keywordflow">for</span>(<span class="keywordtype">int</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.<a class="code" href="class__dgematrix.html#a4c07ace0e1899332aa2d620af184dadf" title="matrix row size">m</a>; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){
    std::cout &lt;&lt; <span class="stringliteral">&quot;#### &quot;</span> &lt;&lt; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a> &lt;&lt; <span class="stringliteral">&quot;th eigen ####&quot;</span> &lt;&lt; std::endl;
    std::cout &lt;&lt; <span class="stringliteral">&quot;wr=&quot;</span> &lt;&lt; wr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>] &lt;&lt;std::endl;
    std::cout &lt;&lt; <span class="stringliteral">&quot;wi=&quot;</span> &lt;&lt; wi[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>] &lt;&lt;std::endl;
    std::cout &lt;&lt; <span class="stringliteral">&quot;vrr=\n&quot;</span> &lt;&lt; vrr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>] &lt;&lt;std::endl;
    std::cout &lt;&lt; <span class="stringliteral">&quot;vri=\n&quot;</span> &lt;&lt; vri[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>] &lt;&lt;std::endl;
    std::cout &lt;&lt; <span class="stringliteral">&quot;Real[ [A]*{x} -lambda*[B]*{x} ] = (Should be zeros)\n&quot;</span>
         &lt;&lt; A_original*vrr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]
      -(wr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]*B_original*vrr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>] - wi[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]*B_original*vri[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>])
         &lt;&lt; std::endl;
    std::cout &lt;&lt; <span class="stringliteral">&quot;Imag[ [A]*{x} -lambda*[B]*{x} ] = (Should be zeros)\n&quot;</span>
         &lt;&lt; A_original*vri[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]
      -(wr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]*B_original*vri[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>] + wi[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]*B_original*vrr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>])
         &lt;&lt; std::endl;
  }
}

<span class="comment">//=============================================================================</span>
<span class="keywordtype">void</span> dggev_check_left()
{
  std::cout &lt;&lt; <span class="stringliteral">&quot;############ check dggev left ############&quot;</span> &lt;&lt; std::endl;
  
  srand(time(NULL));
  <span class="keywordtype">int</span> M(3);
  <span class="comment"></span>
<span class="comment">  //// make dgematrix A and B ////</span>
<span class="comment"></span>  CPPL::dgematrix A(M,M), B(M,M);
  <span class="keywordflow">for</span>(<span class="keywordtype">int</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.<a class="code" href="class__dgematrix.html#a4c07ace0e1899332aa2d620af184dadf" title="matrix row size">m</a>; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){ <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0; j&lt;A.n; j++){
    A(<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>,j) =double( rand() /(RAND_MAX/10) );
    B(<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>,j) =double( rand() /(RAND_MAX/10) );
  }}
  <span class="comment"></span>
<span class="comment">  //// make wr wi vl ////</span>
<span class="comment"></span>  std::vector&lt;double&gt; wr, wi;
  std::vector&lt;CPPL::drovector&gt; vlr, vli;
  <span class="comment"></span>
<span class="comment">  //// make A_original and B_original ////</span>
<span class="comment"></span>  CPPL::dgematrix A_original(A);
  CPPL::dgematrix B_original(B);
  <span class="comment"></span>
<span class="comment">  //// dggev ////</span>
<span class="comment"></span>  A.dggev(B, wr, wi ,vlr, vli);
  <span class="comment"></span>
<span class="comment">  //// print ////</span>
<span class="comment"></span>  std::cout &lt;&lt; <span class="stringliteral">&quot;A_original=\n&quot;</span> &lt;&lt; A_original &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;B_original=\n&quot;</span> &lt;&lt; B_original &lt;&lt; std::endl;
  <span class="keywordflow">for</span>(<span class="keywordtype">int</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.<a class="code" href="class__dgematrix.html#a4c07ace0e1899332aa2d620af184dadf" title="matrix row size">m</a>; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){
    std::cout &lt;&lt; <span class="stringliteral">&quot;#### &quot;</span> &lt;&lt; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a> &lt;&lt; <span class="stringliteral">&quot;th eigen ####&quot;</span> &lt;&lt; std::endl;
    std::cout &lt;&lt; <span class="stringliteral">&quot;wr = &quot;</span> &lt;&lt; wr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>] &lt;&lt; std::endl;
    std::cout &lt;&lt; <span class="stringliteral">&quot;wi = &quot;</span> &lt;&lt; wi[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>] &lt;&lt; std::endl;
    std::cout &lt;&lt; <span class="stringliteral">&quot;vlr = &quot;</span> &lt;&lt; vlr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>];
    std::cout &lt;&lt; <span class="stringliteral">&quot;vli = &quot;</span> &lt;&lt; vli[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>] &lt;&lt; std::endl;
    std::cout &lt;&lt; <span class="stringliteral">&quot;Real[ {x}*[A] -lambda*{x}*[B] ] = (Should be zeros)\n&quot;</span>
         &lt;&lt; vlr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]*A_original
      -(wr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]*vlr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]*B_original - wi[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]*vli[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]*B_original)
         &lt;&lt; std::endl;
    std::cout &lt;&lt; <span class="stringliteral">&quot;Imag[ [A]*{x} -lambda*{x}*[B] ] = (Should be zeros)\n&quot;</span>
         &lt;&lt; vli[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]*A_original
      -(wr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]*vli[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]*B_original + wi[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]*vlr[<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>]*B_original)
         &lt;&lt; std::endl;
  }
}
</pre></div> <div class="fragment"><pre class="fragment"><span class="comment">//=============================================================================</span><span class="comment"></span>
<span class="comment">/*! dgesvd_check */</span>
<span class="keywordtype">void</span> dgesvd_check()
{
  std::cout &lt;&lt; <span class="stringliteral">&quot;############ check dgesvd ############&quot;</span> &lt;&lt; std::endl;
  
  srand(time(NULL));
  <span class="keywordtype">int</span> M(4), N(3);
  <span class="comment"></span>
<span class="comment">  //// make dgematrix A  ////</span>
<span class="comment"></span>  CPPL::dgematrix A(M,N);
  <span class="keywordflow">for</span>(<span class="keywordtype">int</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.<a class="code" href="class__dgematrix.html#a4c07ace0e1899332aa2d620af184dadf" title="matrix row size">m</a>; <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){ <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0; j&lt;A.n; j++){
  A(<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>,j) =double( rand() /(RAND_MAX/10) );
  }}
  <span class="comment"></span>
<span class="comment">  //// make A_original ////</span>
<span class="comment"></span>  CPPL::dgematrix A_original(A);
  <span class="comment"></span>
<span class="comment">  //// make S, U and VT ////</span>
<span class="comment"></span>  CPPL::dcovector S;
  CPPL::dgematrix U, VT;
  <span class="comment"></span>
<span class="comment">  //// SVD A ////</span>
<span class="comment"></span>  A.dgesvd(S,U,VT);
  <span class="comment"></span>
<span class="comment">  //// print A, S, U, and VT ////</span>
<span class="comment"></span>  std::cout &lt;&lt; <span class="stringliteral">&quot;A=\n&quot;</span> &lt;&lt; A &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;S=\n&quot;</span> &lt;&lt; S &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;U=\n&quot;</span> &lt;&lt; U &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;VT=\n&quot;</span> &lt;&lt; VT &lt;&lt; std::endl;
  
  CPPL::dgematrix S_matrix(M,N);
  S_matrix.zero();
  <span class="keywordflow">for</span>(<span class="keywordtype">int</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;std::min(M,N); <a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>++){ S_matrix(<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>,<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>) =S(<a class="code" href="__dgbmatrix-calc_8hpp.html#af7c79b3740ba9c1d547f55ac94bc1258">i</a>); }
  std::cout &lt;&lt; <span class="stringliteral">&quot;S_matrix=\n&quot;</span> &lt;&lt; S_matrix &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;A_original=\n&quot;</span> &lt;&lt; A_original &lt;&lt; std::endl;
  std::cout &lt;&lt; <span class="stringliteral">&quot;U*S_matrix*VT=\n&quot;</span> &lt;&lt; U*S_matrix*VT &lt;&lt; std::endl;
}
</pre></div> <div class="fragment"><pre class="fragment"><span class="comment">//=============================================================================</span>
<span class="preprocessor">#include &lt;iostream&gt;</span>
<span class="preprocessor">#include &lt;cstdlib&gt;</span>
<span class="preprocessor">#include &lt;ctime&gt;</span>
<span class="preprocessor">#include &quot;cpplapack.h&quot;</span>

<span class="preprocessor">#include &quot;dgesv_check.hpp&quot;</span>
<span class="preprocessor">#include &quot;dgels_check.hpp&quot;</span>
<span class="preprocessor">#include &quot;dgelss_check.hpp&quot;</span>
<span class="preprocessor">#include &quot;dgeev_check.hpp&quot;</span>
<span class="preprocessor">#include &quot;dggev_check.hpp&quot;</span>
<span class="preprocessor">#include &quot;dgesvd_check.hpp&quot;</span>
<span class="preprocessor">#include &quot;dgglse_check.hpp&quot;</span>

<span class="comment">//=============================================================================</span><span class="comment"></span>
<span class="comment">/*! main */</span>
<span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span>** argv)
{<span class="comment"></span>
<span class="comment">  //////// dgesv ////////</span>
<span class="comment"></span>  dgesv_check_vector();
  dgesv_check_matrix();
  <span class="comment"></span>
<span class="comment">  //////// dgels ////////</span>
<span class="comment"></span>  dgels_check_vector();
  dgels_check_matrix();
  <span class="comment"></span>
<span class="comment">  //////// dgelss ////////</span>
<span class="comment"></span>  dgelss_check_vector();
  dgelss_check_matrix();
  <span class="comment"></span>
<span class="comment">  //////// dgeev ////////</span>
<span class="comment"></span>  dgeev_check_value();
  dgeev_check_right();
  dgeev_check_left();
  <span class="comment"></span>
<span class="comment">  //////// dggev ////////</span>
<span class="comment"></span>  dggev_check_value();
  dggev_check_right();
  dggev_check_left();
  <span class="comment"></span>
<span class="comment">  //////// dgesvd ////////</span>
<span class="comment"></span>  dgesvd_check();
<span class="comment"></span>
<span class="comment">  //////// dgglse ////////</span>
<span class="comment"></span>  dgglse_check();
  
  <span class="keywordflow">return</span> 0;
}
</pre></div> </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>
