Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > 99cb5ede6a5329071fbeecc8218deb35 > files > 1087

eigen3-doc-3.2-3.mga4.noarch.rpm

<!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"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>Eigen: Advanced initialization</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css"   rel="stylesheet" type="text/css" />
<link href="eigendoxy.css" rel="stylesheet" type="text/css">
<!--  -->
<script type="text/javascript" src="eigen_navtree_hacks.js"></script>
<!-- <script type="text/javascript"> -->
<!-- </script> -->
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<!-- <a name="top"></a> -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="Eigen_Silly_Professor_64x64.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname"><a href="http://eigen.tuxfamily.org">Eigen</a>
   &#160;<span id="projectnumber">3.2.0</span>
   </div>
  </td>
   <td>        <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>
</td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__TutorialAdvancedInitialization.html','');});
</script>
<div id="doc-content">
<!-- 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>Namespaces</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>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Pages</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 class="header">
  <div class="headertitle">
<div class="title">Advanced initialization<div class="ingroups"><a class="el" href="group__DenseMatrixManipulation__chapter.html">Dense matrix and array manipulation</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<p>This page discusses several advanced methods for initializing matrices. It gives more details on the comma-initializer, which was introduced before. It also explains how to get special matrices such as the identity matrix and the zero matrix.</p>
<h1><a class="anchor" id="TutorialAdvancedInitializationCommaInitializer"></a>
The comma initializer</h1>
<p><a class="el" href="namespaceEigen.html" title="Namespace containing all symbols from the Eigen library. ">Eigen</a> offers a comma initializer syntax which allows the user to easily set all the coefficients of a matrix, vector or array. Simply list the coefficients, starting at the top-left corner and moving from left to right and from the top to the bottom. The size of the object needs to be specified beforehand. If you list too few or too many coefficients, <a class="el" href="namespaceEigen.html" title="Namespace containing all symbols from the Eigen library. ">Eigen</a> will complain.</p>
<table  class="example">
<tr>
<th>Example:</th><th>Output: </th></tr>
<tr>
<td><div class="fragment"><div class="line"><a class="code" href="group__matrixtypedefs.html#ga2b787393a7fc870d99aa634f60b2510c">Matrix3f</a> m;</div>
<div class="line">m &lt;&lt; 1, 2, 3,</div>
<div class="line">     4, 5, 6,</div>
<div class="line">     7, 8, 9;</div>
<div class="line">std::cout &lt;&lt; m;</div>
</div><!-- fragment -->  </td><td><pre class="fragment">1 2 3
4 5 6
7 8 9</pre> </td></tr>
</table>
<p>Moreover, the elements of the initialization list may themselves be vectors or matrices. A common use is to join vectors or matrices together. For example, here is how to join two row vectors together. Remember that you have to set the size before you can use the comma initializer.</p>
<table  class="example">
<tr>
<th>Example:</th><th>Output: </th></tr>
<tr>
<td><div class="fragment"><div class="line"><a class="code" href="group__matrixtypedefs.html#gaa444957bc5772dc8e8cdfd1e3782234d">RowVectorXd</a> vec1(3);</div>
<div class="line">vec1 &lt;&lt; 1, 2, 3;</div>
<div class="line">std::cout &lt;&lt; <span class="stringliteral">&quot;vec1 = &quot;</span> &lt;&lt; vec1 &lt;&lt; std::endl;</div>
<div class="line"></div>
<div class="line"><a class="code" href="group__matrixtypedefs.html#gaa444957bc5772dc8e8cdfd1e3782234d">RowVectorXd</a> vec2(4);</div>
<div class="line">vec2 &lt;&lt; 1, 4, 9, 16;;</div>
<div class="line">std::cout &lt;&lt; <span class="stringliteral">&quot;vec2 = &quot;</span> &lt;&lt; vec2 &lt;&lt; std::endl;</div>
<div class="line"></div>
<div class="line"><a class="code" href="group__matrixtypedefs.html#gaa444957bc5772dc8e8cdfd1e3782234d">RowVectorXd</a> joined(7);</div>
<div class="line">joined &lt;&lt; vec1, vec2;</div>
<div class="line">std::cout &lt;&lt; <span class="stringliteral">&quot;joined = &quot;</span> &lt;&lt; joined &lt;&lt; std::endl;</div>
</div><!-- fragment -->  </td><td><pre class="fragment">vec1 = 1 2 3
vec2 =  1  4  9 16
joined =  1  2  3  1  4  9 16
</pre> </td></tr>
</table>
<p>We can use the same technique to initialize matrices with a block structure.</p>
<table  class="example">
<tr>
<th>Example:</th><th>Output: </th></tr>
<tr>
<td><div class="fragment"><div class="line"><a class="code" href="group__matrixtypedefs.html#gabab09c32e96cfa9829a88400627af162">MatrixXf</a> matA(2, 2);</div>
<div class="line">matA &lt;&lt; 1, 2, 3, 4;</div>
<div class="line"><a class="code" href="group__matrixtypedefs.html#gabab09c32e96cfa9829a88400627af162">MatrixXf</a> matB(4, 4);</div>
<div class="line">matB &lt;&lt; matA, matA/10, matA/10, matA;</div>
<div class="line">std::cout &lt;&lt; matB &lt;&lt; std::endl;</div>
</div><!-- fragment -->  </td><td><pre class="fragment">  1   2 0.1 0.2
  3   4 0.3 0.4
0.1 0.2   1   2
0.3 0.4   3   4
</pre> </td></tr>
</table>
<p>The comma initializer can also be used to fill block expressions such as <code>m.row(i)</code>. Here is a more complicated way to get the same result as in the first example above:</p>
<table  class="example">
<tr>
<th>Example:</th><th>Output: </th></tr>
<tr>
<td><div class="fragment"><div class="line"><a class="code" href="group__matrixtypedefs.html#ga2b787393a7fc870d99aa634f60b2510c">Matrix3f</a> m;</div>
<div class="line">m.row(0) &lt;&lt; 1, 2, 3;</div>
<div class="line">m.block(1,0,2,2) &lt;&lt; 4, 5, 7, 8;</div>
<div class="line">m.col(2).tail(2) &lt;&lt; 6, 9;                   </div>
<div class="line">std::cout &lt;&lt; m;</div>
</div><!-- fragment -->  </td><td><pre class="fragment">1 2 3
4 5 6
7 8 9</pre> </td></tr>
</table>
<h1><a class="anchor" id="TutorialAdvancedInitializationSpecialMatrices"></a>
Special matrices and arrays</h1>
<p>The <a class="el" href="classEigen_1_1Matrix.html" title="The matrix class, also used for vectors and row-vectors. ">Matrix</a> and <a class="el" href="classEigen_1_1Array.html" title="General-purpose arrays with easy API for coefficient-wise operations. ">Array</a> classes have static methods like <a class="el" href="classEigen_1_1DenseBase.html#a2e36721b4833498b713e94a7948c6a29">Zero()</a>, which can be used to initialize all coefficients to zero. There are three variants. The first variant takes no arguments and can only be used for fixed-size objects. If you want to initialize a dynamic-size object to zero, you need to specify the size. Thus, the second variant requires one argument and can be used for one-dimensional dynamic-size objects, while the third variant requires two arguments and can be used for two-dimensional objects. All three variants are illustrated in the following example:</p>
<table  class="example">
<tr>
<th>Example:</th><th>Output: </th></tr>
<tr>
<td><div class="fragment"><div class="line">std::cout &lt;&lt; <span class="stringliteral">&quot;A fixed-size array:\n&quot;</span>;</div>
<div class="line">Array33f a1 = Array33f::Zero();</div>
<div class="line">std::cout &lt;&lt; a1 &lt;&lt; <span class="stringliteral">&quot;\n\n&quot;</span>;</div>
<div class="line"></div>
<div class="line"></div>
<div class="line">std::cout &lt;&lt; <span class="stringliteral">&quot;A one-dimensional dynamic-size array:\n&quot;</span>;</div>
<div class="line">ArrayXf a2 = ArrayXf::Zero(3);</div>
<div class="line">std::cout &lt;&lt; a2 &lt;&lt; <span class="stringliteral">&quot;\n\n&quot;</span>;</div>
<div class="line"></div>
<div class="line"></div>
<div class="line">std::cout &lt;&lt; <span class="stringliteral">&quot;A two-dimensional dynamic-size array:\n&quot;</span>;</div>
<div class="line">ArrayXXf a3 = ArrayXXf::Zero(3, 4);</div>
<div class="line">std::cout &lt;&lt; a3 &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div>
</div><!-- fragment -->  </td><td><pre class="fragment">A fixed-size array:
0 0 0
0 0 0
0 0 0

A one-dimensional dynamic-size array:
0
0
0

A two-dimensional dynamic-size array:
0 0 0 0
0 0 0 0
0 0 0 0
</pre> </td></tr>
</table>
<p>Similarly, the static method <a class="el" href="classEigen_1_1DenseBase.html#abb7652b9ae2c6ee26be9db276613c4f6">Constant</a>(value) sets all coefficients to <code>value</code>. If the size of the object needs to be specified, the additional arguments go before the <code>value</code> argument, as in <code>MatrixXd::Constant(rows, cols, value)</code>. The method <a class="el" href="classEigen_1_1DenseBase.html#a8e759dafdd9ecc446d397b7f5435f60a">Random() </a> fills the matrix or array with random coefficients. The identity matrix can be obtained by calling <a class="el" href="classEigen_1_1MatrixBase.html#a0650b65c6ae6c3d19a138b72a6d68568">Identity()</a>; this method is only available for <a class="el" href="classEigen_1_1Matrix.html" title="The matrix class, also used for vectors and row-vectors. ">Matrix</a>, not for <a class="el" href="classEigen_1_1Array.html" title="General-purpose arrays with easy API for coefficient-wise operations. ">Array</a>, because "identity matrix" is a linear algebra concept. The method <a class="el" href="classEigen_1_1DenseBase.html#a03a4ddf48fc9f3674a783da9c6ae34d8">LinSpaced</a>(size, low, high) is only available for vectors and one-dimensional arrays; it yields a vector of the specified size whose coefficients are equally spaced between <code>low</code> and <code>high</code>. The method <code>LinSpaced()</code> is illustrated in the following example, which prints a table with angles in degrees, the corresponding angle in radians, and their sine and cosine.</p>
<table  class="example">
<tr>
<th>Example:</th><th>Output: </th></tr>
<tr>
<td><div class="fragment"><div class="line">ArrayXXf table(10, 4);</div>
<div class="line">table.col(0) = ArrayXf::LinSpaced(10, 0, 90);</div>
<div class="line">table.col(1) = M_PI / 180 * table.col(0);</div>
<div class="line">table.col(2) = table.col(1).sin();</div>
<div class="line">table.col(3) = table.col(1).cos();</div>
<div class="line">std::cout &lt;&lt; <span class="stringliteral">&quot;  Degrees   Radians      Sine    Cosine\n&quot;</span>;</div>
<div class="line">std::cout &lt;&lt; table &lt;&lt; std::endl;</div>
</div><!-- fragment -->  </td><td><pre class="fragment">  Degrees   Radians      Sine    Cosine
        0         0         0         1
       10     0.175     0.174     0.985
       20     0.349     0.342      0.94
       30     0.524       0.5     0.866
       40     0.698     0.643     0.766
       50     0.873     0.766     0.643
       60      1.05     0.866       0.5
       70      1.22      0.94     0.342
       80       1.4     0.985     0.174
       90      1.57         1 -4.37e-08
</pre> </td></tr>
</table>
<p>This example shows that objects like the ones returned by LinSpaced() can be assigned to variables (and expressions). <a class="el" href="namespaceEigen.html" title="Namespace containing all symbols from the Eigen library. ">Eigen</a> defines utility functions like <a class="el" href="classEigen_1_1DenseBase.html#a9053ca03ac251002768a54742be28fce">setZero()</a>, <a class="el" href="classEigen_1_1MatrixBase.html#af1b15ae4c6f69b7324dd8ef70089dfc3">MatrixBase::setIdentity()</a> and <a class="el" href="classEigen_1_1DenseBase.html#aca96b3050ceeffaa781d3d4ee185bd1d">DenseBase::setLinSpaced()</a> to do this conveniently. The following example contrasts three ways to construct the matrix <img class="formulaInl" alt="$ J = \bigl[ \begin{smallmatrix} O &amp; I \\ I &amp; O \end{smallmatrix} \bigr] $" src="form_182.png"/>: using static methods and assignment, using static methods and the comma-initializer, or using the setXxx() methods.</p>
<table  class="example">
<tr>
<th>Example:</th><th>Output: </th></tr>
<tr>
<td><div class="fragment"><div class="line"><span class="keyword">const</span> <span class="keywordtype">int</span> size = 6;</div>
<div class="line"><a class="code" href="group__matrixtypedefs.html#ga0750af9a6b82761985a15fe77256de87">MatrixXd</a> mat1(size, size);</div>
<div class="line">mat1.topLeftCorner(size/2, size/2)     = <a class="code" href="classEigen_1_1DenseBase.html#a2e36721b4833498b713e94a7948c6a29">MatrixXd::Zero</a>(size/2, size/2);</div>
<div class="line">mat1.topRightCorner(size/2, size/2)    = <a class="code" href="classEigen_1_1MatrixBase.html#a0650b65c6ae6c3d19a138b72a6d68568">MatrixXd::Identity</a>(size/2, size/2);</div>
<div class="line">mat1.bottomLeftCorner(size/2, size/2)  = <a class="code" href="classEigen_1_1MatrixBase.html#a0650b65c6ae6c3d19a138b72a6d68568">MatrixXd::Identity</a>(size/2, size/2);</div>
<div class="line">mat1.bottomRightCorner(size/2, size/2) = <a class="code" href="classEigen_1_1DenseBase.html#a2e36721b4833498b713e94a7948c6a29">MatrixXd::Zero</a>(size/2, size/2);</div>
<div class="line">std::cout &lt;&lt; mat1 &lt;&lt; std::endl &lt;&lt; std::endl;</div>
<div class="line"></div>
<div class="line"><a class="code" href="group__matrixtypedefs.html#ga0750af9a6b82761985a15fe77256de87">MatrixXd</a> mat2(size, size);</div>
<div class="line">mat2.topLeftCorner(size/2, size/2).setZero();</div>
<div class="line">mat2.topRightCorner(size/2, size/2).setIdentity();</div>
<div class="line">mat2.bottomLeftCorner(size/2, size/2).setIdentity();</div>
<div class="line">mat2.bottomRightCorner(size/2, size/2).setZero();</div>
<div class="line">std::cout &lt;&lt; mat2 &lt;&lt; std::endl &lt;&lt; std::endl;</div>
<div class="line"></div>
<div class="line"><a class="code" href="group__matrixtypedefs.html#ga0750af9a6b82761985a15fe77256de87">MatrixXd</a> mat3(size, size);</div>
<div class="line">mat3 &lt;&lt; <a class="code" href="classEigen_1_1DenseBase.html#a2e36721b4833498b713e94a7948c6a29">MatrixXd::Zero</a>(size/2, size/2), <a class="code" href="classEigen_1_1MatrixBase.html#a0650b65c6ae6c3d19a138b72a6d68568">MatrixXd::Identity</a>(size/2, size/2),</div>
<div class="line">        <a class="code" href="classEigen_1_1MatrixBase.html#a0650b65c6ae6c3d19a138b72a6d68568">MatrixXd::Identity</a>(size/2, size/2), <a class="code" href="classEigen_1_1DenseBase.html#a2e36721b4833498b713e94a7948c6a29">MatrixXd::Zero</a>(size/2, size/2);</div>
<div class="line">std::cout &lt;&lt; mat3 &lt;&lt; std::endl;</div>
<div class="line"></div>
</div><!-- fragment -->  </td><td><pre class="fragment">0 0 0 1 0 0
0 0 0 0 1 0
0 0 0 0 0 1
1 0 0 0 0 0
0 1 0 0 0 0
0 0 1 0 0 0

0 0 0 1 0 0
0 0 0 0 1 0
0 0 0 0 0 1
1 0 0 0 0 0
0 1 0 0 0 0
0 0 1 0 0 0

0 0 0 1 0 0
0 0 0 0 1 0
0 0 0 0 0 1
1 0 0 0 0 0
0 1 0 0 0 0
0 0 1 0 0 0
</pre> </td></tr>
</table>
<p>A summary of all pre-defined matrix, vector and array objects can be found in the <a class="el" href="group__QuickRefPage.html">Quick reference guide</a>.</p>
<h1><a class="anchor" id="TutorialAdvancedInitializationTemporaryObjects"></a>
Usage as temporary objects</h1>
<p>As shown above, static methods as Zero() and Constant() can be used to initialize variables at the time of declaration or at the right-hand side of an assignment operator. You can think of these methods as returning a matrix or array; in fact, they return so-called <a class="el" href="TopicEigenExpressionTemplates.html">expression objects</a> which evaluate to a matrix or array when needed, so that this syntax does not incur any overhead.</p>
<p>These expressions can also be used as a temporary object. The second example in the <a class="el" href="GettingStarted.html">Getting started</a> guide, which we reproduce here, already illustrates this.</p>
<table  class="example">
<tr>
<th>Example:</th><th>Output: </th></tr>
<tr>
<td><div class="fragment"><div class="line"><span class="preprocessor">#include &lt;iostream&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;Eigen/Dense&gt;</span></div>
<div class="line"></div>
<div class="line"><span class="keyword">using namespace </span>Eigen;</div>
<div class="line"><span class="keyword">using namespace </span>std;</div>
<div class="line"></div>
<div class="line"><span class="keywordtype">int</span> main()</div>
<div class="line">{</div>
<div class="line">  <a class="code" href="classEigen_1_1Matrix.html">MatrixXd</a> m = <a class="code" href="classEigen_1_1DenseBase.html#a8e759dafdd9ecc446d397b7f5435f60a">MatrixXd::Random</a>(3,3);</div>
<div class="line">  m = (m + <a class="code" href="classEigen_1_1DenseBase.html#abb7652b9ae2c6ee26be9db276613c4f6">MatrixXd::Constant</a>(3,3,1.2)) * 50;</div>
<div class="line">  cout &lt;&lt; <span class="stringliteral">&quot;m =&quot;</span> &lt;&lt; endl &lt;&lt; m &lt;&lt; endl;</div>
<div class="line">  <a class="code" href="classEigen_1_1Matrix.html">VectorXd</a> v(3);</div>
<div class="line">  v &lt;&lt; 1, 2, 3;</div>
<div class="line">  cout &lt;&lt; <span class="stringliteral">&quot;m * v =&quot;</span> &lt;&lt; endl &lt;&lt; m * v &lt;&lt; endl;</div>
<div class="line">}</div>
</div><!-- fragment -->  </td><td><pre class="fragment">m =
  94 89.8 43.5
49.4  101 86.8
88.3 29.8 37.8
m * v =
404
512
261
</pre> </td></tr>
</table>
<p>The expression <code>m + <a class="el" href="classEigen_1_1DenseBase.html#abb7652b9ae2c6ee26be9db276613c4f6">MatrixXf::Constant</a>(3,3,1.2)</code> constructs the 3-by-3 matrix expression with all its coefficients equal to 1.2 plus the corresponding coefficient of <em>m</em>.</p>
<p>The comma-initializer, too, can also be used to construct temporary objects. The following example constructs a random matrix of size 2-by-3, and then multiplies this matrix on the left with <img class="formulaInl" alt="$ \bigl[ \begin{smallmatrix} 0 &amp; 1 \\ 1 &amp; 0 \end{smallmatrix} \bigr] $" src="form_183.png"/>.</p>
<table  class="example">
<tr>
<th>Example:</th><th>Output: </th></tr>
<tr>
<td><div class="fragment"><div class="line"><a class="code" href="group__matrixtypedefs.html#gabab09c32e96cfa9829a88400627af162">MatrixXf</a> mat = <a class="code" href="classEigen_1_1DenseBase.html#a8e759dafdd9ecc446d397b7f5435f60a">MatrixXf::Random</a>(2, 3);</div>
<div class="line">std::cout &lt;&lt; mat &lt;&lt; std::endl &lt;&lt; std::endl;</div>
<div class="line">mat = (<a class="code" href="group__matrixtypedefs.html#gabab09c32e96cfa9829a88400627af162">MatrixXf</a>(2,2) &lt;&lt; 0, 1, 1, 0).finished() * mat;</div>
<div class="line">std::cout &lt;&lt; mat &lt;&lt; std::endl;</div>
</div><!-- fragment -->  </td><td><pre class="fragment">  0.68  0.566  0.823
-0.211  0.597 -0.605

-0.211  0.597 -0.605
  0.68  0.566  0.823
</pre> </td></tr>
</table>
<p>The <a class="el" href="structEigen_1_1CommaInitializer.html#a1f065adc0c5e868f62cea827286f6d40">finished() </a> method is necessary here to get the actual matrix object once the comma initialization of our temporary submatrix is done. </p>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Mon Oct 28 2013 11:04:27 for Eigen by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.5 </li>
  </ul>
</div>
<!-- Piwik --> 
<!--
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://stats.sylphide-consulting.com/piwik/" : "http://stats.sylphide-consulting.com/piwik/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 20);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script><noscript><p><img src="http://stats.sylphide-consulting.com/piwik/piwik.php?idsite=20" style="border:0" alt="" /></p></noscript>
-->
<!-- End Piwik Tracking Code -->
</body>
</html>