<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>The MRPT project: VectorBlock.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <div align="left"><a href="http://www.mrpt.org/">Main MRPT website</a> > <b>C++ reference</b> </div> <div align="right"> <a href="index.html"><img border="0" src="mrpt_logo.png" alt="MRPT logo"></a> </div> <!-- Generated by Doxygen 1.7.2 --> <script type="text/javascript"><!-- var searchBox = new SearchBox("searchBox", "search",false,'Search'); --></script> <div class="navigation" id="top"> <div class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</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 id="searchli"> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <form id="FSearchBox" action="search.php" method="get"> <img id="MSearchSelect" src="search/mag.png" alt=""/> <input type="text" id="MSearchField" name="query" value="Search" size="20" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)"/> </form> </span><span class="right"></span> </div> </li> </ul> </div> <div class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <div class="header"> <div class="headertitle"> <h1>VectorBlock.h</h1> </div> </div> <div class="contents"> <a href="_core_2_vector_block_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// This file is part of Eigen, a lightweight C++ template library</span> <a name="l00002"></a>00002 <span class="comment">// for linear algebra.</span> <a name="l00003"></a>00003 <span class="comment">//</span> <a name="l00004"></a>00004 <span class="comment">// Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud@inria.fr></span> <a name="l00005"></a>00005 <span class="comment">// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com></span> <a name="l00006"></a>00006 <span class="comment">//</span> <a name="l00007"></a>00007 <span class="comment">// Eigen is free software; you can redistribute it and/or</span> <a name="l00008"></a>00008 <span class="comment">// modify it under the terms of the GNU Lesser General Public</span> <a name="l00009"></a>00009 <span class="comment">// License as published by the Free Software Foundation; either</span> <a name="l00010"></a>00010 <span class="comment">// version 3 of the License, or (at your option) any later version.</span> <a name="l00011"></a>00011 <span class="comment">//</span> <a name="l00012"></a>00012 <span class="comment">// Alternatively, you can redistribute it and/or</span> <a name="l00013"></a>00013 <span class="comment">// modify it under the terms of the GNU General Public License as</span> <a name="l00014"></a>00014 <span class="comment">// published by the Free Software Foundation; either version 2 of</span> <a name="l00015"></a>00015 <span class="comment">// the License, or (at your option) any later version.</span> <a name="l00016"></a>00016 <span class="comment">//</span> <a name="l00017"></a>00017 <span class="comment">// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY</span> <a name="l00018"></a>00018 <span class="comment">// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS</span> <a name="l00019"></a>00019 <span class="comment">// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the</span> <a name="l00020"></a>00020 <span class="comment">// GNU General Public License for more details.</span> <a name="l00021"></a>00021 <span class="comment">//</span> <a name="l00022"></a>00022 <span class="comment">// You should have received a copy of the GNU Lesser General Public</span> <a name="l00023"></a>00023 <span class="comment">// License and a copy of the GNU General Public License along with</span> <a name="l00024"></a>00024 <span class="comment">// Eigen. If not, see <http://www.gnu.org/licenses/>.</span> <a name="l00025"></a>00025 <a name="l00026"></a>00026 <span class="preprocessor">#ifndef EIGEN_VECTORBLOCK_H</span> <a name="l00027"></a>00027 <span class="preprocessor"></span><span class="preprocessor">#define EIGEN_VECTORBLOCK_H</span> <a name="l00028"></a>00028 <span class="preprocessor"></span><span class="comment"></span> <a name="l00029"></a>00029 <span class="comment">/** \class VectorBlock</span> <a name="l00030"></a>00030 <span class="comment"> * \ingroup Core_Module</span> <a name="l00031"></a>00031 <span class="comment"> *</span> <a name="l00032"></a>00032 <span class="comment"> * \brief Expression of a fixed-size or dynamic-size sub-vector</span> <a name="l00033"></a>00033 <span class="comment"> *</span> <a name="l00034"></a>00034 <span class="comment"> * \param VectorType the type of the object in which we are taking a sub-vector</span> <a name="l00035"></a>00035 <span class="comment"> * \param Size size of the sub-vector we are taking at compile time (optional)</span> <a name="l00036"></a>00036 <span class="comment"> *</span> <a name="l00037"></a>00037 <span class="comment"> * This class represents an expression of either a fixed-size or dynamic-size sub-vector.</span> <a name="l00038"></a>00038 <span class="comment"> * It is the return type of DenseBase::segment(Index,Index) and DenseBase::segment<int>(Index) and</span> <a name="l00039"></a>00039 <span class="comment"> * most of the time this is the only way it is used.</span> <a name="l00040"></a>00040 <span class="comment"> *</span> <a name="l00041"></a>00041 <span class="comment"> * However, if you want to directly maniputate sub-vector expressions,</span> <a name="l00042"></a>00042 <span class="comment"> * for instance if you want to write a function returning such an expression, you</span> <a name="l00043"></a>00043 <span class="comment"> * will need to use this class.</span> <a name="l00044"></a>00044 <span class="comment"> *</span> <a name="l00045"></a>00045 <span class="comment"> * Here is an example illustrating the dynamic case:</span> <a name="l00046"></a>00046 <span class="comment"> * \include class_VectorBlock.cpp</span> <a name="l00047"></a>00047 <span class="comment"> * Output: \verbinclude class_VectorBlock.out</span> <a name="l00048"></a>00048 <span class="comment"> *</span> <a name="l00049"></a>00049 <span class="comment"> * \note Even though this expression has dynamic size, in the case where \a VectorType</span> <a name="l00050"></a>00050 <span class="comment"> * has fixed size, this expression inherits a fixed maximal size which means that evaluating</span> <a name="l00051"></a>00051 <span class="comment"> * it does not cause a dynamic memory allocation.</span> <a name="l00052"></a>00052 <span class="comment"> *</span> <a name="l00053"></a>00053 <span class="comment"> * Here is an example illustrating the fixed-size case:</span> <a name="l00054"></a>00054 <span class="comment"> * \include class_FixedVectorBlock.cpp</span> <a name="l00055"></a>00055 <span class="comment"> * Output: \verbinclude class_FixedVectorBlock.out</span> <a name="l00056"></a>00056 <span class="comment"> *</span> <a name="l00057"></a>00057 <span class="comment"> * \sa class Block, DenseBase::segment(Index,Index,Index,Index), DenseBase::segment(Index,Index)</span> <a name="l00058"></a>00058 <span class="comment"> */</span> <a name="l00059"></a>00059 <a name="l00060"></a>00060 <span class="keyword">namespace </span>internal { <a name="l00061"></a>00061 <span class="keyword">template</span><<span class="keyword">typename</span> VectorType, <span class="keywordtype">int</span> Size> <a name="l00062"></a><a class="code" href="structinternal_1_1traits_3_01_vector_block_3_01_vector_type_00_01_size_01_4_01_4.html">00062</a> <span class="keyword">struct </span>traits<<a class="code" href="class_vector_block.html" title="Expression of a fixed-size or dynamic-size sub-vector.">VectorBlock</a><VectorType, Size> > <a name="l00063"></a>00063 : <span class="keyword">public</span> traits<Block<VectorType, <a name="l00064"></a>00064 traits<VectorType>::Flags & RowMajorBit ? 1 : Size, <a name="l00065"></a>00065 traits<VectorType>::Flags & RowMajorBit ? Size : 1> > <a name="l00066"></a>00066 { <a name="l00067"></a>00067 }; <a name="l00068"></a>00068 } <a name="l00069"></a>00069 <a name="l00070"></a><a class="code" href="class_vector_block.html">00070</a> <span class="keyword">template</span><<span class="keyword">typename</span> VectorType, <span class="keywordtype">int</span> Size> <span class="keyword">class </span><a class="code" href="class_vector_block.html" title="Expression of a fixed-size or dynamic-size sub-vector.">VectorBlock</a> <a name="l00071"></a>00071 : <span class="keyword">public</span> <a class="code" href="class_block.html" title="Expression of a fixed-size or dynamic-size block.">Block</a><VectorType, <a name="l00072"></a>00072 internal::traits<VectorType>::Flags & RowMajorBit ? 1 : Size, <a name="l00073"></a>00073 internal::traits<VectorType>::Flags & RowMajorBit ? Size : 1> <a name="l00074"></a>00074 { <a name="l00075"></a>00075 <span class="keyword">typedef</span> <a class="code" href="class_block.html" title="Expression of a fixed-size or dynamic-size block.">Block</a><VectorType, <a name="l00076"></a>00076 internal::traits<VectorType>::Flags & <a class="code" href="group__flags.html#ga7bd49e7b260e869e10fb9dc4fd081a85" title="for a matrix, this means that the storage order is row-major.">RowMajorBit</a> ? 1 : Size, <a name="l00077"></a><a class="code" href="class_vector_block.html#a42675bf11f3a9bb27c8bbacfb8b84201">00077</a> internal::traits<VectorType>::Flags & <a class="code" href="group__flags.html#ga7bd49e7b260e869e10fb9dc4fd081a85" title="for a matrix, this means that the storage order is row-major.">RowMajorBit</a> ? Size : 1> <a class="code" href="class_vector_block.html#a42675bf11f3a9bb27c8bbacfb8b84201">Base</a>; <a name="l00078"></a>00078 <span class="keyword">enum</span> { <a name="l00079"></a><a class="code" href="class_vector_block.html#adb332192a608d3768569cb6c667c6914ac4df99a642ae78c6d2e7a316c5d021b3">00079</a> <a class="code" href="class_vector_block.html#adb332192a608d3768569cb6c667c6914ac4df99a642ae78c6d2e7a316c5d021b3">IsColVector</a> = !(internal::traits<VectorType>::Flags & <a class="code" href="group__flags.html#ga7bd49e7b260e869e10fb9dc4fd081a85" title="for a matrix, this means that the storage order is row-major.">RowMajorBit</a>) <a name="l00080"></a>00080 }; <a name="l00081"></a>00081 <span class="keyword">public</span>: <a name="l00082"></a>00082 <a class="code" href="_macros_8h.html#ab29ea1da9635d033ca44cf26ad6fa0cf">EIGEN_DENSE_PUBLIC_INTERFACE</a>(<a class="code" href="class_vector_block.html" title="Expression of a fixed-size or dynamic-size sub-vector.">VectorBlock</a>) <a name="l00083"></a>00083 <a name="l00084"></a>00084 using <a class="code" href="class_block.html">Base</a>::operator=; <a name="l00085"></a>00085 <span class="comment"></span> <a name="l00086"></a>00086 <span class="comment"> /** Dynamic-size constructor</span> <a name="l00087"></a>00087 <span class="comment"> */</span> <a name="l00088"></a><a class="code" href="class_vector_block.html#ae2ddb62f7e143cc20052c8e8056d5536">00088</a> inline <a class="code" href="class_vector_block.html" title="Expression of a fixed-size or dynamic-size sub-vector.">VectorBlock</a>(VectorType& vector, Index start, Index <a class="code" href="namespacemrpt_1_1math.html#a34f37758cc35f29279a8e6ad91215ad1">size</a>) <a name="l00089"></a>00089 : <a class="code" href="class_block.html">Base</a>(vector, <a name="l00090"></a>00090 <a class="code" href="class_vector_block.html#adb332192a608d3768569cb6c667c6914ac4df99a642ae78c6d2e7a316c5d021b3">IsColVector</a> ? start : 0, <a class="code" href="class_vector_block.html#adb332192a608d3768569cb6c667c6914ac4df99a642ae78c6d2e7a316c5d021b3">IsColVector</a> ? 0 : start, <a name="l00091"></a>00091 <a class="code" href="class_vector_block.html#adb332192a608d3768569cb6c667c6914ac4df99a642ae78c6d2e7a316c5d021b3">IsColVector</a> ? <a class="code" href="namespacemrpt_1_1math.html#a34f37758cc35f29279a8e6ad91215ad1">size</a> : 1, <a class="code" href="class_vector_block.html#adb332192a608d3768569cb6c667c6914ac4df99a642ae78c6d2e7a316c5d021b3">IsColVector</a> ? 1 : size) <a name="l00092"></a>00092 { <a name="l00093"></a>00093 <a class="code" href="_static_assert_8h.html#ac04a73705a0aa1d66c4b80f6338db904">EIGEN_STATIC_ASSERT_VECTOR_ONLY</a>(<a class="code" href="class_vector_block.html" title="Expression of a fixed-size or dynamic-size sub-vector.">VectorBlock</a>); <a name="l00094"></a>00094 } <a name="l00095"></a>00095 <span class="comment"></span> <a name="l00096"></a>00096 <span class="comment"> /** Fixed-size constructor</span> <a name="l00097"></a>00097 <span class="comment"> */</span> <a name="l00098"></a><a class="code" href="class_vector_block.html#abb6ea1340c9f5c63faa1ac3dc73fab09">00098</a> <span class="keyword">inline</span> <a class="code" href="class_vector_block.html#ae2ddb62f7e143cc20052c8e8056d5536" title="Dynamic-size constructor.">VectorBlock</a>(VectorType& vector, Index start) <a name="l00099"></a>00099 : <a class="code" href="class_block.html">Base</a>(vector, <a class="code" href="class_vector_block.html#adb332192a608d3768569cb6c667c6914ac4df99a642ae78c6d2e7a316c5d021b3">IsColVector</a> ? start : 0, <a class="code" href="class_vector_block.html#adb332192a608d3768569cb6c667c6914ac4df99a642ae78c6d2e7a316c5d021b3">IsColVector</a> ? 0 : start) <a name="l00100"></a>00100 { <a name="l00101"></a>00101 <a class="code" href="_static_assert_8h.html#ac04a73705a0aa1d66c4b80f6338db904">EIGEN_STATIC_ASSERT_VECTOR_ONLY</a>(<a class="code" href="class_vector_block.html" title="Expression of a fixed-size or dynamic-size sub-vector.">VectorBlock</a>); <a name="l00102"></a>00102 } <a name="l00103"></a>00103 }; <a name="l00104"></a>00104 <a name="l00105"></a>00105 <span class="comment"></span> <a name="l00106"></a>00106 <span class="comment">/** \returns a dynamic-size expression of a segment (i.e. a vector block) in *this.</span> <a name="l00107"></a>00107 <span class="comment"> *</span> <a name="l00108"></a>00108 <span class="comment"> * \only_for_vectors</span> <a name="l00109"></a>00109 <span class="comment"> *</span> <a name="l00110"></a>00110 <span class="comment"> * \param start the first coefficient in the segment</span> <a name="l00111"></a>00111 <span class="comment"> * \param size the number of coefficients in the segment</span> <a name="l00112"></a>00112 <span class="comment"> *</span> <a name="l00113"></a>00113 <span class="comment"> * Example: \include MatrixBase_segment_int_int.cpp</span> <a name="l00114"></a>00114 <span class="comment"> * Output: \verbinclude MatrixBase_segment_int_int.out</span> <a name="l00115"></a>00115 <span class="comment"> *</span> <a name="l00116"></a>00116 <span class="comment"> * \note Even though the returned expression has dynamic size, in the case</span> <a name="l00117"></a>00117 <span class="comment"> * when it is applied to a fixed-size vector, it inherits a fixed maximal size,</span> <a name="l00118"></a>00118 <span class="comment"> * which means that evaluating it does not cause a dynamic memory allocation.</span> <a name="l00119"></a>00119 <span class="comment"> *</span> <a name="l00120"></a>00120 <span class="comment"> * \sa class Block, segment(Index)</span> <a name="l00121"></a>00121 <span class="comment"> */</span> <a name="l00122"></a>00122 <span class="keyword">template</span><<span class="keyword">typename</span> Derived> <a name="l00123"></a>00123 <span class="keyword">inline</span> <span class="keyword">typename</span> <a class="code" href="class_vector_block.html" title="Expression of a fixed-size or dynamic-size sub-vector.">DenseBase<Derived>::SegmentReturnType</a> <a name="l00124"></a><a class="code" href="class_dense_base.html#a3dc59503efd09955827da239d45a70e7">00124</a> <a class="code" href="class_dense_base.html" title="Base class for all dense matrices, vectors, and arrays.">DenseBase<Derived>::segment</a>(<a class="code" href="class_dense_base.html#a059039d9d011413c873e6ae05ee912b6" title="The type of indices.">Index</a> start, <a class="code" href="class_dense_base.html#a059039d9d011413c873e6ae05ee912b6" title="The type of indices.">Index</a> <a class="code" href="namespacemrpt_1_1math.html#a34f37758cc35f29279a8e6ad91215ad1">size</a>) <a name="l00125"></a>00125 { <a name="l00126"></a>00126 <a class="code" href="_static_assert_8h.html#ac04a73705a0aa1d66c4b80f6338db904">EIGEN_STATIC_ASSERT_VECTOR_ONLY</a>(Derived) <a name="l00127"></a>00127 <span class="keywordflow">return</span> <a class="code" href="class_vector_block.html" title="Expression of a fixed-size or dynamic-size sub-vector.">SegmentReturnType</a>(derived(), start, size); <a name="l00128"></a>00128 } <a name="l00129"></a>00129 <span class="comment"></span> <a name="l00130"></a>00130 <span class="comment">/** This is the const version of segment(Index,Index).*/</span> <a name="l00131"></a>00131 <span class="keyword">template</span><<span class="keyword">typename</span> Derived> <a name="l00132"></a>00132 <span class="keyword">inline</span> <span class="keyword">typename</span> <a class="code" href="class_vector_block.html" title="Expression of a fixed-size or dynamic-size sub-vector.">DenseBase<Derived>::ConstSegmentReturnType</a> <a name="l00133"></a><a class="code" href="class_dense_base.html#a0d4229526d3244fc62fef96257c2ad9b">00133</a> <a class="code" href="class_dense_base.html" title="Base class for all dense matrices, vectors, and arrays.">DenseBase<Derived>::segment</a>(<a class="code" href="class_dense_base.html#a059039d9d011413c873e6ae05ee912b6" title="The type of indices.">Index</a> start, <a class="code" href="class_dense_base.html#a059039d9d011413c873e6ae05ee912b6" title="The type of indices.">Index</a> <a class="code" href="namespacemrpt_1_1math.html#a34f37758cc35f29279a8e6ad91215ad1">size</a>)<span class="keyword"> const</span> <a name="l00134"></a>00134 <span class="keyword"></span>{ <a name="l00135"></a>00135 <a class="code" href="_static_assert_8h.html#ac04a73705a0aa1d66c4b80f6338db904">EIGEN_STATIC_ASSERT_VECTOR_ONLY</a>(Derived) <a name="l00136"></a>00136 <span class="keywordflow">return</span> <a class="code" href="class_vector_block.html" title="Expression of a fixed-size or dynamic-size sub-vector.">ConstSegmentReturnType</a>(derived(), start, size); <a name="l00137"></a>00137 } <a name="l00138"></a>00138 <span class="comment"></span> <a name="l00139"></a>00139 <span class="comment">/** \returns a dynamic-size expression of the first coefficients of *this.</span> <a name="l00140"></a>00140 <span class="comment"> *</span> <a name="l00141"></a>00141 <span class="comment"> * \only_for_vectors</span> <a name="l00142"></a>00142 <span class="comment"> *</span> <a name="l00143"></a>00143 <span class="comment"> * \param size the number of coefficients in the block</span> <a name="l00144"></a>00144 <span class="comment"> *</span> <a name="l00145"></a>00145 <span class="comment"> * Example: \include MatrixBase_start_int.cpp</span> <a name="l00146"></a>00146 <span class="comment"> * Output: \verbinclude MatrixBase_start_int.out</span> <a name="l00147"></a>00147 <span class="comment"> *</span> <a name="l00148"></a>00148 <span class="comment"> * \note Even though the returned expression has dynamic size, in the case</span> <a name="l00149"></a>00149 <span class="comment"> * when it is applied to a fixed-size vector, it inherits a fixed maximal size,</span> <a name="l00150"></a>00150 <span class="comment"> * which means that evaluating it does not cause a dynamic memory allocation.</span> <a name="l00151"></a>00151 <span class="comment"> *</span> <a name="l00152"></a>00152 <span class="comment"> * \sa class Block, block(Index,Index)</span> <a name="l00153"></a>00153 <span class="comment"> */</span> <a name="l00154"></a>00154 <span class="keyword">template</span><<span class="keyword">typename</span> Derived> <a name="l00155"></a>00155 <span class="keyword">inline</span> <span class="keyword">typename</span> <a class="code" href="class_vector_block.html" title="Expression of a fixed-size or dynamic-size sub-vector.">DenseBase<Derived>::SegmentReturnType</a> <a name="l00156"></a><a class="code" href="class_dense_base.html#a7ba451458b55b75327435d96610f063a">00156</a> <a class="code" href="class_dense_base.html" title="Base class for all dense matrices, vectors, and arrays.">DenseBase<Derived>::head</a>(<a class="code" href="class_dense_base.html#a059039d9d011413c873e6ae05ee912b6" title="The type of indices.">Index</a> <a class="code" href="namespacemrpt_1_1math.html#a34f37758cc35f29279a8e6ad91215ad1">size</a>) <a name="l00157"></a>00157 { <a name="l00158"></a>00158 <a class="code" href="_static_assert_8h.html#ac04a73705a0aa1d66c4b80f6338db904">EIGEN_STATIC_ASSERT_VECTOR_ONLY</a>(Derived) <a name="l00159"></a>00159 <span class="keywordflow">return</span> <a class="code" href="class_vector_block.html" title="Expression of a fixed-size or dynamic-size sub-vector.">SegmentReturnType</a>(derived(), 0, size); <a name="l00160"></a>00160 } <a name="l00161"></a>00161 <span class="comment"></span> <a name="l00162"></a>00162 <span class="comment">/** This is the const version of head(Index).*/</span> <a name="l00163"></a>00163 <span class="keyword">template</span><<span class="keyword">typename</span> Derived> <a name="l00164"></a>00164 <span class="keyword">inline</span> <span class="keyword">typename</span> <a class="code" href="class_vector_block.html" title="Expression of a fixed-size or dynamic-size sub-vector.">DenseBase<Derived>::ConstSegmentReturnType</a> <a name="l00165"></a><a class="code" href="class_dense_base.html#af61e1c03d4918517e84f9701ec7561b8">00165</a> <a class="code" href="class_dense_base.html" title="Base class for all dense matrices, vectors, and arrays.">DenseBase<Derived>::head</a>(<a class="code" href="class_dense_base.html#a059039d9d011413c873e6ae05ee912b6" title="The type of indices.">Index</a> <a class="code" href="namespacemrpt_1_1math.html#a34f37758cc35f29279a8e6ad91215ad1">size</a>)<span class="keyword"> const</span> <a name="l00166"></a>00166 <span class="keyword"></span>{ <a name="l00167"></a>00167 <a class="code" href="_static_assert_8h.html#ac04a73705a0aa1d66c4b80f6338db904">EIGEN_STATIC_ASSERT_VECTOR_ONLY</a>(Derived) <a name="l00168"></a>00168 <span class="keywordflow">return</span> <a class="code" href="class_vector_block.html" title="Expression of a fixed-size or dynamic-size sub-vector.">ConstSegmentReturnType</a>(derived(), 0, size); <a name="l00169"></a>00169 } <a name="l00170"></a>00170 <span class="comment"></span> <a name="l00171"></a>00171 <span class="comment">/** \returns a dynamic-size expression of the last coefficients of *this.</span> <a name="l00172"></a>00172 <span class="comment"> *</span> <a name="l00173"></a>00173 <span class="comment"> * \only_for_vectors</span> <a name="l00174"></a>00174 <span class="comment"> *</span> <a name="l00175"></a>00175 <span class="comment"> * \param size the number of coefficients in the block</span> <a name="l00176"></a>00176 <span class="comment"> *</span> <a name="l00177"></a>00177 <span class="comment"> * Example: \include MatrixBase_end_int.cpp</span> <a name="l00178"></a>00178 <span class="comment"> * Output: \verbinclude MatrixBase_end_int.out</span> <a name="l00179"></a>00179 <span class="comment"> *</span> <a name="l00180"></a>00180 <span class="comment"> * \note Even though the returned expression has dynamic size, in the case</span> <a name="l00181"></a>00181 <span class="comment"> * when it is applied to a fixed-size vector, it inherits a fixed maximal size,</span> <a name="l00182"></a>00182 <span class="comment"> * which means that evaluating it does not cause a dynamic memory allocation.</span> <a name="l00183"></a>00183 <span class="comment"> *</span> <a name="l00184"></a>00184 <span class="comment"> * \sa class Block, block(Index,Index)</span> <a name="l00185"></a>00185 <span class="comment"> */</span> <a name="l00186"></a>00186 <span class="keyword">template</span><<span class="keyword">typename</span> Derived> <a name="l00187"></a>00187 <span class="keyword">inline</span> <span class="keyword">typename</span> <a class="code" href="class_vector_block.html" title="Expression of a fixed-size or dynamic-size sub-vector.">DenseBase<Derived>::SegmentReturnType</a> <a name="l00188"></a><a class="code" href="class_dense_base.html#a1433ce449bcab332c7611ab33e71ad79">00188</a> <a class="code" href="class_dense_base.html" title="Base class for all dense matrices, vectors, and arrays.">DenseBase<Derived>::tail</a>(<a class="code" href="class_dense_base.html#a059039d9d011413c873e6ae05ee912b6" title="The type of indices.">Index</a> <a class="code" href="namespacemrpt_1_1math.html#a34f37758cc35f29279a8e6ad91215ad1">size</a>) <a name="l00189"></a>00189 { <a name="l00190"></a>00190 <a class="code" href="_static_assert_8h.html#ac04a73705a0aa1d66c4b80f6338db904">EIGEN_STATIC_ASSERT_VECTOR_ONLY</a>(Derived) <a name="l00191"></a>00191 <span class="keywordflow">return</span> <a class="code" href="class_vector_block.html" title="Expression of a fixed-size or dynamic-size sub-vector.">SegmentReturnType</a>(derived(), this-><a class="code" href="namespacemrpt_1_1math.html#a34f37758cc35f29279a8e6ad91215ad1">size</a>() - size, size); <a name="l00192"></a>00192 } <a name="l00193"></a>00193 <span class="comment"></span> <a name="l00194"></a>00194 <span class="comment">/** This is the const version of tail(Index).*/</span> <a name="l00195"></a>00195 <span class="keyword">template</span><<span class="keyword">typename</span> Derived> <a name="l00196"></a>00196 <span class="keyword">inline</span> <span class="keyword">typename</span> <a class="code" href="class_vector_block.html" title="Expression of a fixed-size or dynamic-size sub-vector.">DenseBase<Derived>::ConstSegmentReturnType</a> <a name="l00197"></a><a class="code" href="class_dense_base.html#ac812b028f9fc391a61427a54e5b9d2b2">00197</a> <a class="code" href="class_dense_base.html" title="Base class for all dense matrices, vectors, and arrays.">DenseBase<Derived>::tail</a>(<a class="code" href="class_dense_base.html#a059039d9d011413c873e6ae05ee912b6" title="The type of indices.">Index</a> <a class="code" href="namespacemrpt_1_1math.html#a34f37758cc35f29279a8e6ad91215ad1">size</a>)<span class="keyword"> const</span> <a name="l00198"></a>00198 <span class="keyword"></span>{ <a name="l00199"></a>00199 <a class="code" href="_static_assert_8h.html#ac04a73705a0aa1d66c4b80f6338db904">EIGEN_STATIC_ASSERT_VECTOR_ONLY</a>(Derived) <a name="l00200"></a>00200 <span class="keywordflow">return</span> <a class="code" href="class_vector_block.html" title="Expression of a fixed-size or dynamic-size sub-vector.">ConstSegmentReturnType</a>(derived(), this-><a class="code" href="namespacemrpt_1_1math.html#a34f37758cc35f29279a8e6ad91215ad1">size</a>() - size, size); <a name="l00201"></a>00201 } <a name="l00202"></a>00202 <span class="comment"></span> <a name="l00203"></a>00203 <span class="comment">/** \returns a fixed-size expression of a segment (i.e. a vector block) in \c *this</span> <a name="l00204"></a>00204 <span class="comment"> *</span> <a name="l00205"></a>00205 <span class="comment"> * \only_for_vectors</span> <a name="l00206"></a>00206 <span class="comment"> *</span> <a name="l00207"></a>00207 <span class="comment"> * The template parameter \a Size is the number of coefficients in the block</span> <a name="l00208"></a>00208 <span class="comment"> *</span> <a name="l00209"></a>00209 <span class="comment"> * \param start the index of the first element of the sub-vector</span> <a name="l00210"></a>00210 <span class="comment"> *</span> <a name="l00211"></a>00211 <span class="comment"> * Example: \include MatrixBase_template_int_segment.cpp</span> <a name="l00212"></a>00212 <span class="comment"> * Output: \verbinclude MatrixBase_template_int_segment.out</span> <a name="l00213"></a>00213 <span class="comment"> *</span> <a name="l00214"></a>00214 <span class="comment"> * \sa class Block</span> <a name="l00215"></a>00215 <span class="comment"> */</span> <a name="l00216"></a>00216 <span class="keyword">template</span><<span class="keyword">typename</span> Derived> <a name="l00217"></a>00217 <span class="keyword">template</span><<span class="keywordtype">int</span> Size> <a name="l00218"></a>00218 <span class="keyword">inline</span> <span class="keyword">typename</span> <a class="code" href="class_dense_base.html" title="Base class for all dense matrices, vectors, and arrays.">DenseBase<Derived>::template</a> <a class="code" href="namespace_architecture.html#a7ae6186419ae33e4d9019df7b18d883e">FixedSegmentReturnType<Size>::Type</a> <a name="l00219"></a><a class="code" href="class_dense_base.html#a0029004691d83343ed13cee0135f2869">00219</a> <a class="code" href="class_dense_base.html" title="Base class for all dense matrices, vectors, and arrays.">DenseBase<Derived>::segment</a>(<a class="code" href="class_dense_base.html#a059039d9d011413c873e6ae05ee912b6" title="The type of indices.">Index</a> start) <a name="l00220"></a>00220 { <a name="l00221"></a>00221 <a class="code" href="_static_assert_8h.html#ac04a73705a0aa1d66c4b80f6338db904">EIGEN_STATIC_ASSERT_VECTOR_ONLY</a>(Derived) <a name="l00222"></a>00222 <span class="keywordflow">return</span> <span class="keyword">typename</span> <a class="code" href="namespace_architecture.html#a7ae6186419ae33e4d9019df7b18d883e">FixedSegmentReturnType<Size>::Type</a>(derived(), start); <a name="l00223"></a>00223 } <a name="l00224"></a>00224 <span class="comment"></span> <a name="l00225"></a>00225 <span class="comment">/** This is the const version of segment<int>(Index).*/</span> <a name="l00226"></a>00226 <span class="keyword">template</span><<span class="keyword">typename</span> Derived> <a name="l00227"></a>00227 <span class="keyword">template</span><<span class="keywordtype">int</span> Size> <a name="l00228"></a>00228 <span class="keyword">inline</span> <span class="keyword">typename</span> <a class="code" href="class_dense_base.html" title="Base class for all dense matrices, vectors, and arrays.">DenseBase<Derived>::template</a> <a class="code" href="namespace_architecture.html#a7ae6186419ae33e4d9019df7b18d883e">ConstFixedSegmentReturnType<Size>::Type</a> <a name="l00229"></a><a class="code" href="class_dense_base.html#ac1f0556680c0b94513202de8755f8a93">00229</a> <a class="code" href="class_dense_base.html" title="Base class for all dense matrices, vectors, and arrays.">DenseBase<Derived>::segment</a>(<a class="code" href="class_dense_base.html#a059039d9d011413c873e6ae05ee912b6" title="The type of indices.">Index</a> start)<span class="keyword"> const</span> <a name="l00230"></a>00230 <span class="keyword"></span>{ <a name="l00231"></a>00231 <a class="code" href="_static_assert_8h.html#ac04a73705a0aa1d66c4b80f6338db904">EIGEN_STATIC_ASSERT_VECTOR_ONLY</a>(Derived) <a name="l00232"></a>00232 <span class="keywordflow">return</span> <span class="keyword">typename</span> <a class="code" href="namespace_architecture.html#a7ae6186419ae33e4d9019df7b18d883e">ConstFixedSegmentReturnType<Size>::Type</a>(derived(), start); <a name="l00233"></a>00233 } <a name="l00234"></a>00234 <span class="comment"></span> <a name="l00235"></a>00235 <span class="comment">/** \returns a fixed-size expression of the first coefficients of *this.</span> <a name="l00236"></a>00236 <span class="comment"> *</span> <a name="l00237"></a>00237 <span class="comment"> * \only_for_vectors</span> <a name="l00238"></a>00238 <span class="comment"> *</span> <a name="l00239"></a>00239 <span class="comment"> * The template parameter \a Size is the number of coefficients in the block</span> <a name="l00240"></a>00240 <span class="comment"> *</span> <a name="l00241"></a>00241 <span class="comment"> * Example: \include MatrixBase_template_int_start.cpp</span> <a name="l00242"></a>00242 <span class="comment"> * Output: \verbinclude MatrixBase_template_int_start.out</span> <a name="l00243"></a>00243 <span class="comment"> *</span> <a name="l00244"></a>00244 <span class="comment"> * \sa class Block</span> <a name="l00245"></a>00245 <span class="comment"> */</span> <a name="l00246"></a>00246 <span class="keyword">template</span><<span class="keyword">typename</span> Derived> <a name="l00247"></a>00247 <span class="keyword">template</span><<span class="keywordtype">int</span> Size> <a name="l00248"></a>00248 <span class="keyword">inline</span> <span class="keyword">typename</span> <a class="code" href="class_dense_base.html" title="Base class for all dense matrices, vectors, and arrays.">DenseBase<Derived>::template</a> <a class="code" href="namespace_architecture.html#a7ae6186419ae33e4d9019df7b18d883e">FixedSegmentReturnType<Size>::Type</a> <a name="l00249"></a><a class="code" href="class_dense_base.html#a316f67d85af5552c45e62b6d8a722409">00249</a> <a class="code" href="class_dense_base.html" title="Base class for all dense matrices, vectors, and arrays.">DenseBase<Derived>::head</a>() <a name="l00250"></a>00250 { <a name="l00251"></a>00251 <a class="code" href="_static_assert_8h.html#ac04a73705a0aa1d66c4b80f6338db904">EIGEN_STATIC_ASSERT_VECTOR_ONLY</a>(Derived) <a name="l00252"></a>00252 <span class="keywordflow">return</span> <span class="keyword">typename</span> <a class="code" href="namespace_architecture.html#a7ae6186419ae33e4d9019df7b18d883e">FixedSegmentReturnType<Size>::Type</a>(derived(), 0); <a name="l00253"></a>00253 } <a name="l00254"></a>00254 <span class="comment"></span> <a name="l00255"></a>00255 <span class="comment">/** This is the const version of head<int>().*/</span> <a name="l00256"></a>00256 <span class="keyword">template</span><<span class="keyword">typename</span> Derived> <a name="l00257"></a>00257 <span class="keyword">template</span><<span class="keywordtype">int</span> Size> <a name="l00258"></a>00258 <span class="keyword">inline</span> <span class="keyword">typename</span> <a class="code" href="class_dense_base.html" title="Base class for all dense matrices, vectors, and arrays.">DenseBase<Derived>::template</a> <a class="code" href="namespace_architecture.html#a7ae6186419ae33e4d9019df7b18d883e">ConstFixedSegmentReturnType<Size>::Type</a> <a name="l00259"></a><a class="code" href="class_dense_base.html#ad2cada725bb76e7ce03613d29d2b90d0">00259</a> <a class="code" href="class_dense_base.html" title="Base class for all dense matrices, vectors, and arrays.">DenseBase<Derived>::head</a>()<span class="keyword"> const</span> <a name="l00260"></a>00260 <span class="keyword"></span>{ <a name="l00261"></a>00261 <a class="code" href="_static_assert_8h.html#ac04a73705a0aa1d66c4b80f6338db904">EIGEN_STATIC_ASSERT_VECTOR_ONLY</a>(Derived) <a name="l00262"></a>00262 <span class="keywordflow">return</span> <span class="keyword">typename</span> <a class="code" href="namespace_architecture.html#a7ae6186419ae33e4d9019df7b18d883e">ConstFixedSegmentReturnType<Size>::Type</a>(derived(), 0); <a name="l00263"></a>00263 } <a name="l00264"></a>00264 <span class="comment"></span> <a name="l00265"></a>00265 <span class="comment">/** \returns a fixed-size expression of the last coefficients of *this.</span> <a name="l00266"></a>00266 <span class="comment"> *</span> <a name="l00267"></a>00267 <span class="comment"> * \only_for_vectors</span> <a name="l00268"></a>00268 <span class="comment"> *</span> <a name="l00269"></a>00269 <span class="comment"> * The template parameter \a Size is the number of coefficients in the block</span> <a name="l00270"></a>00270 <span class="comment"> *</span> <a name="l00271"></a>00271 <span class="comment"> * Example: \include MatrixBase_template_int_end.cpp</span> <a name="l00272"></a>00272 <span class="comment"> * Output: \verbinclude MatrixBase_template_int_end.out</span> <a name="l00273"></a>00273 <span class="comment"> *</span> <a name="l00274"></a>00274 <span class="comment"> * \sa class Block</span> <a name="l00275"></a>00275 <span class="comment"> */</span> <a name="l00276"></a>00276 <span class="keyword">template</span><<span class="keyword">typename</span> Derived> <a name="l00277"></a>00277 <span class="keyword">template</span><<span class="keywordtype">int</span> Size> <a name="l00278"></a>00278 <span class="keyword">inline</span> <span class="keyword">typename</span> <a class="code" href="class_dense_base.html" title="Base class for all dense matrices, vectors, and arrays.">DenseBase<Derived>::template</a> <a class="code" href="namespace_architecture.html#a7ae6186419ae33e4d9019df7b18d883e">FixedSegmentReturnType<Size>::Type</a> <a name="l00279"></a><a class="code" href="class_dense_base.html#a2103dc38d00d5837875022284c4ccce1">00279</a> <a class="code" href="class_dense_base.html" title="Base class for all dense matrices, vectors, and arrays.">DenseBase<Derived>::tail</a>() <a name="l00280"></a>00280 { <a name="l00281"></a>00281 <a class="code" href="_static_assert_8h.html#ac04a73705a0aa1d66c4b80f6338db904">EIGEN_STATIC_ASSERT_VECTOR_ONLY</a>(Derived) <a name="l00282"></a>00282 <span class="keywordflow">return</span> <span class="keyword">typename</span> <a class="code" href="namespace_architecture.html#a7ae6186419ae33e4d9019df7b18d883e">FixedSegmentReturnType<Size>::Type</a>(derived(), <a class="code" href="namespacemrpt_1_1math.html#a34f37758cc35f29279a8e6ad91215ad1">size</a>() - Size); <a name="l00283"></a>00283 } <a name="l00284"></a>00284 <span class="comment"></span> <a name="l00285"></a>00285 <span class="comment">/** This is the const version of tail<int>.*/</span> <a name="l00286"></a>00286 <span class="keyword">template</span><<span class="keyword">typename</span> Derived> <a name="l00287"></a>00287 <span class="keyword">template</span><<span class="keywordtype">int</span> Size> <a name="l00288"></a>00288 <span class="keyword">inline</span> <span class="keyword">typename</span> <a class="code" href="class_dense_base.html" title="Base class for all dense matrices, vectors, and arrays.">DenseBase<Derived>::template</a> <a class="code" href="namespace_architecture.html#a7ae6186419ae33e4d9019df7b18d883e">ConstFixedSegmentReturnType<Size>::Type</a> <a name="l00289"></a><a class="code" href="class_dense_base.html#a1901c3f400c641b3f20c16460b2d760c">00289</a> <a class="code" href="class_dense_base.html" title="Base class for all dense matrices, vectors, and arrays.">DenseBase<Derived>::tail</a>()<span class="keyword"> const</span> <a name="l00290"></a>00290 <span class="keyword"></span>{ <a name="l00291"></a>00291 <a class="code" href="_static_assert_8h.html#ac04a73705a0aa1d66c4b80f6338db904">EIGEN_STATIC_ASSERT_VECTOR_ONLY</a>(Derived) <a name="l00292"></a>00292 <span class="keywordflow">return</span> <span class="keyword">typename</span> <a class="code" href="namespace_architecture.html#a7ae6186419ae33e4d9019df7b18d883e">ConstFixedSegmentReturnType<Size>::Type</a>(derived(), <a class="code" href="namespacemrpt_1_1math.html#a34f37758cc35f29279a8e6ad91215ad1">size</a>() - Size); <a name="l00293"></a>00293 } <a name="l00294"></a>00294 <a name="l00295"></a>00295 <a name="l00296"></a>00296 <span class="preprocessor">#endif // EIGEN_VECTORBLOCK_H</span> </pre></div></div> </div> <br><hr><br> <table border="0" width="100%"> <tr> <td> Page generated by <a href="http://www.doxygen.org" target="_blank">Doxygen 1.7.2</a> for MRPT 0.9.4 SVN: at Mon Jan 10 22:30:30 UTC 2011</td><td></td> <td width="100"> </td> <td width="150"> </td></tr> </table> </body></html>