<!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: Mechanism of &quot;Smart-Temporary&quot; System</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">Mechanism of "Smart-Temporary" System </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>
Let A, B, C, and X be the dgematrix objects, 
and A, B, and C be the same size and initialized properly. 
</p>

<!---------------------------------------------------------------------------->
<center><table border="3">
<caption align="top">
Calculation Procedures to Process "X=A*B+C;"</caption>
<tr>
  <td></td>
  <td>CPPLapack</td>
  <td>ordinary matrix libraries</td>
</tr>

<tr>
  <td>operator*</td>
  <td>calculate A*B, and put it to a local _dgematrix object P to return</td>
  <td>calculate A*B, and put it to a local  dgematrix object P to return</td>
</tr>

<tr>
  <td>passing of returned object</td>
  <td>make a temporary _dgematrix object Q as the shallow copy of P</td>
  <td>make a temporary  dgematrix object Q as the    deep copy of P</td>
</tr>

<tr>
  <td>destructor for local object</td>
  <td>destruct local object P without deleting the array data</td>
  <td>destruct local object P    with deleting the array data</td>
</tr>

<tr>
  <td>operator+</td>
  <td>add C into Q, and return Q.</td>
  <td>calculate C+Q and, put it to a local dgematrix object R to return.</td>
</tr>

<tr>
  <td>passing of returned object</td>
  <td>make a temporary _dgematrix object R as the shallow copy of Q</td>
  <td>make a temporary  dgematrix object S as the    deep copy of R</td>
</tr>

<tr>
  <td>destructor for local object</td>
  <td>destruct local object Q without deleting the array data</td>
  <td>destruct local object R    with deleting the array data</td>
</tr>

<tr>
  <td>operator=</td>
  <td>set the array address of X to that of R</td>
  <td>copy whole the data of S to X</td>
</tr>

<tr>
  <td>implicit destructer (;)</td>
  <td>destruct the temporary object R without deleting the array data</td>
  <td>destruct the temporary objects Q and S with deleting the array data</td>
</tr>

</table></center>
<!---------------------------------------------------------------------------->

<p>
CPPLapack does not consume any extra memory space 
using its original "Smart-Temporary" system.
On the other hand, ordinary matrix libraries always generate useless 
temporary objects implicitly and consume a lot of extra memory space.
CPPLapack is efficient not only in computing speed 
but also in saving memory space.
</p>


<p>
[NOTE]
Recent advanced compilers automatically optimize 
the way of passing returned objects. 
The steps shown above is the case of the most primitive compiler. 
The performance of ordinary matrix libraries using advanced compilers
becomes close to the performance of CPPLapack.
However, CPPLapack still has some advantages in terms of 
the stepwise elimination, minimization of the number of temporary objects,
and so on.
</p>

 </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>
