Eigne Matrix Class Library
Dependents: MPC_current_control HydraulicControlBoard_SW AHRS Test_ekf ... more
src/plugins/BlockMethods.h@1:3b8049da21b8, 2019-09-24 (annotated)
- Committer:
- jsoh91
- Date:
- Tue Sep 24 00:18:23 2019 +0000
- Revision:
- 1:3b8049da21b8
- Parent:
- 0:13a5d365ba16
ignore and revise some of error parts
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ykuroda | 0:13a5d365ba16 | 1 | // This file is part of Eigen, a lightweight C++ template library |
ykuroda | 0:13a5d365ba16 | 2 | // for linear algebra. |
ykuroda | 0:13a5d365ba16 | 3 | // |
ykuroda | 0:13a5d365ba16 | 4 | // Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud@inria.fr> |
ykuroda | 0:13a5d365ba16 | 5 | // Copyright (C) 2006-2010 Benoit Jacob <jacob.benoit.1@gmail.com> |
ykuroda | 0:13a5d365ba16 | 6 | // |
ykuroda | 0:13a5d365ba16 | 7 | // This Source Code Form is subject to the terms of the Mozilla |
ykuroda | 0:13a5d365ba16 | 8 | // Public License v. 2.0. If a copy of the MPL was not distributed |
ykuroda | 0:13a5d365ba16 | 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. |
ykuroda | 0:13a5d365ba16 | 10 | |
ykuroda | 0:13a5d365ba16 | 11 | |
ykuroda | 0:13a5d365ba16 | 12 | #ifndef EIGEN_PARSED_BY_DOXYGEN |
ykuroda | 0:13a5d365ba16 | 13 | |
ykuroda | 0:13a5d365ba16 | 14 | /** \internal expression type of a column */ |
ykuroda | 0:13a5d365ba16 | 15 | typedef Block<Derived, internal::traits<Derived>::RowsAtCompileTime, 1, !IsRowMajor> ColXpr; |
ykuroda | 0:13a5d365ba16 | 16 | typedef const Block<const Derived, internal::traits<Derived>::RowsAtCompileTime, 1, !IsRowMajor> ConstColXpr; |
ykuroda | 0:13a5d365ba16 | 17 | /** \internal expression type of a row */ |
ykuroda | 0:13a5d365ba16 | 18 | typedef Block<Derived, 1, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> RowXpr; |
ykuroda | 0:13a5d365ba16 | 19 | typedef const Block<const Derived, 1, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> ConstRowXpr; |
ykuroda | 0:13a5d365ba16 | 20 | /** \internal expression type of a block of whole columns */ |
ykuroda | 0:13a5d365ba16 | 21 | typedef Block<Derived, internal::traits<Derived>::RowsAtCompileTime, Dynamic, !IsRowMajor> ColsBlockXpr; |
ykuroda | 0:13a5d365ba16 | 22 | typedef const Block<const Derived, internal::traits<Derived>::RowsAtCompileTime, Dynamic, !IsRowMajor> ConstColsBlockXpr; |
ykuroda | 0:13a5d365ba16 | 23 | /** \internal expression type of a block of whole rows */ |
ykuroda | 0:13a5d365ba16 | 24 | typedef Block<Derived, Dynamic, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> RowsBlockXpr; |
ykuroda | 0:13a5d365ba16 | 25 | typedef const Block<const Derived, Dynamic, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> ConstRowsBlockXpr; |
ykuroda | 0:13a5d365ba16 | 26 | /** \internal expression type of a block of whole columns */ |
ykuroda | 0:13a5d365ba16 | 27 | template<int N> struct NColsBlockXpr { typedef Block<Derived, internal::traits<Derived>::RowsAtCompileTime, N, !IsRowMajor> Type; }; |
ykuroda | 0:13a5d365ba16 | 28 | template<int N> struct ConstNColsBlockXpr { typedef const Block<const Derived, internal::traits<Derived>::RowsAtCompileTime, N, !IsRowMajor> Type; }; |
ykuroda | 0:13a5d365ba16 | 29 | /** \internal expression type of a block of whole rows */ |
ykuroda | 0:13a5d365ba16 | 30 | template<int N> struct NRowsBlockXpr { typedef Block<Derived, N, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> Type; }; |
ykuroda | 0:13a5d365ba16 | 31 | template<int N> struct ConstNRowsBlockXpr { typedef const Block<const Derived, N, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> Type; }; |
ykuroda | 0:13a5d365ba16 | 32 | |
ykuroda | 0:13a5d365ba16 | 33 | typedef VectorBlock<Derived> SegmentReturnType; |
ykuroda | 0:13a5d365ba16 | 34 | typedef const VectorBlock<const Derived> ConstSegmentReturnType; |
ykuroda | 0:13a5d365ba16 | 35 | template<int Size> struct FixedSegmentReturnType { typedef VectorBlock<Derived, Size> Type; }; |
ykuroda | 0:13a5d365ba16 | 36 | template<int Size> struct ConstFixedSegmentReturnType { typedef const VectorBlock<const Derived, Size> Type; }; |
ykuroda | 0:13a5d365ba16 | 37 | |
ykuroda | 0:13a5d365ba16 | 38 | #endif // not EIGEN_PARSED_BY_DOXYGEN |
ykuroda | 0:13a5d365ba16 | 39 | |
ykuroda | 0:13a5d365ba16 | 40 | /** \returns a dynamic-size expression of a block in *this. |
ykuroda | 0:13a5d365ba16 | 41 | * |
ykuroda | 0:13a5d365ba16 | 42 | * \param startRow the first row in the block |
ykuroda | 0:13a5d365ba16 | 43 | * \param startCol the first column in the block |
ykuroda | 0:13a5d365ba16 | 44 | * \param blockRows the number of rows in the block |
ykuroda | 0:13a5d365ba16 | 45 | * \param blockCols the number of columns in the block |
ykuroda | 0:13a5d365ba16 | 46 | * |
ykuroda | 0:13a5d365ba16 | 47 | * Example: \include MatrixBase_block_int_int_int_int.cpp |
ykuroda | 0:13a5d365ba16 | 48 | * Output: \verbinclude MatrixBase_block_int_int_int_int.out |
ykuroda | 0:13a5d365ba16 | 49 | * |
ykuroda | 0:13a5d365ba16 | 50 | * \note Even though the returned expression has dynamic size, in the case |
ykuroda | 0:13a5d365ba16 | 51 | * when it is applied to a fixed-size matrix, it inherits a fixed maximal size, |
ykuroda | 0:13a5d365ba16 | 52 | * which means that evaluating it does not cause a dynamic memory allocation. |
ykuroda | 0:13a5d365ba16 | 53 | * |
ykuroda | 0:13a5d365ba16 | 54 | * \sa class Block, block(Index,Index) |
ykuroda | 0:13a5d365ba16 | 55 | */ |
ykuroda | 0:13a5d365ba16 | 56 | inline Block<Derived> block(Index startRow, Index startCol, Index blockRows, Index blockCols) |
ykuroda | 0:13a5d365ba16 | 57 | { |
ykuroda | 0:13a5d365ba16 | 58 | return Block<Derived>(derived(), startRow, startCol, blockRows, blockCols); |
ykuroda | 0:13a5d365ba16 | 59 | } |
ykuroda | 0:13a5d365ba16 | 60 | |
ykuroda | 0:13a5d365ba16 | 61 | /** This is the const version of block(Index,Index,Index,Index). */ |
ykuroda | 0:13a5d365ba16 | 62 | inline const Block<const Derived> block(Index startRow, Index startCol, Index blockRows, Index blockCols) const |
ykuroda | 0:13a5d365ba16 | 63 | { |
ykuroda | 0:13a5d365ba16 | 64 | return Block<const Derived>(derived(), startRow, startCol, blockRows, blockCols); |
ykuroda | 0:13a5d365ba16 | 65 | } |
ykuroda | 0:13a5d365ba16 | 66 | |
ykuroda | 0:13a5d365ba16 | 67 | |
ykuroda | 0:13a5d365ba16 | 68 | |
ykuroda | 0:13a5d365ba16 | 69 | |
ykuroda | 0:13a5d365ba16 | 70 | /** \returns a dynamic-size expression of a top-right corner of *this. |
ykuroda | 0:13a5d365ba16 | 71 | * |
ykuroda | 0:13a5d365ba16 | 72 | * \param cRows the number of rows in the corner |
ykuroda | 0:13a5d365ba16 | 73 | * \param cCols the number of columns in the corner |
ykuroda | 0:13a5d365ba16 | 74 | * |
ykuroda | 0:13a5d365ba16 | 75 | * Example: \include MatrixBase_topRightCorner_int_int.cpp |
ykuroda | 0:13a5d365ba16 | 76 | * Output: \verbinclude MatrixBase_topRightCorner_int_int.out |
ykuroda | 0:13a5d365ba16 | 77 | * |
ykuroda | 0:13a5d365ba16 | 78 | * \sa class Block, block(Index,Index,Index,Index) |
ykuroda | 0:13a5d365ba16 | 79 | */ |
ykuroda | 0:13a5d365ba16 | 80 | inline Block<Derived> topRightCorner(Index cRows, Index cCols) |
ykuroda | 0:13a5d365ba16 | 81 | { |
ykuroda | 0:13a5d365ba16 | 82 | return Block<Derived>(derived(), 0, cols() - cCols, cRows, cCols); |
ykuroda | 0:13a5d365ba16 | 83 | } |
ykuroda | 0:13a5d365ba16 | 84 | |
ykuroda | 0:13a5d365ba16 | 85 | /** This is the const version of topRightCorner(Index, Index).*/ |
ykuroda | 0:13a5d365ba16 | 86 | inline const Block<const Derived> topRightCorner(Index cRows, Index cCols) const |
ykuroda | 0:13a5d365ba16 | 87 | { |
ykuroda | 0:13a5d365ba16 | 88 | return Block<const Derived>(derived(), 0, cols() - cCols, cRows, cCols); |
ykuroda | 0:13a5d365ba16 | 89 | } |
ykuroda | 0:13a5d365ba16 | 90 | |
ykuroda | 0:13a5d365ba16 | 91 | /** \returns an expression of a fixed-size top-right corner of *this. |
ykuroda | 0:13a5d365ba16 | 92 | * |
ykuroda | 0:13a5d365ba16 | 93 | * \tparam CRows the number of rows in the corner |
ykuroda | 0:13a5d365ba16 | 94 | * \tparam CCols the number of columns in the corner |
ykuroda | 0:13a5d365ba16 | 95 | * |
ykuroda | 0:13a5d365ba16 | 96 | * Example: \include MatrixBase_template_int_int_topRightCorner.cpp |
ykuroda | 0:13a5d365ba16 | 97 | * Output: \verbinclude MatrixBase_template_int_int_topRightCorner.out |
ykuroda | 0:13a5d365ba16 | 98 | * |
ykuroda | 0:13a5d365ba16 | 99 | * \sa class Block, block<int,int>(Index,Index) |
ykuroda | 0:13a5d365ba16 | 100 | */ |
ykuroda | 0:13a5d365ba16 | 101 | template<int CRows, int CCols> |
ykuroda | 0:13a5d365ba16 | 102 | inline Block<Derived, CRows, CCols> topRightCorner() |
ykuroda | 0:13a5d365ba16 | 103 | { |
ykuroda | 0:13a5d365ba16 | 104 | return Block<Derived, CRows, CCols>(derived(), 0, cols() - CCols); |
ykuroda | 0:13a5d365ba16 | 105 | } |
ykuroda | 0:13a5d365ba16 | 106 | |
ykuroda | 0:13a5d365ba16 | 107 | /** This is the const version of topRightCorner<int, int>().*/ |
ykuroda | 0:13a5d365ba16 | 108 | template<int CRows, int CCols> |
ykuroda | 0:13a5d365ba16 | 109 | inline const Block<const Derived, CRows, CCols> topRightCorner() const |
ykuroda | 0:13a5d365ba16 | 110 | { |
ykuroda | 0:13a5d365ba16 | 111 | return Block<const Derived, CRows, CCols>(derived(), 0, cols() - CCols); |
ykuroda | 0:13a5d365ba16 | 112 | } |
ykuroda | 0:13a5d365ba16 | 113 | |
ykuroda | 0:13a5d365ba16 | 114 | /** \returns an expression of a top-right corner of *this. |
ykuroda | 0:13a5d365ba16 | 115 | * |
ykuroda | 0:13a5d365ba16 | 116 | * \tparam CRows number of rows in corner as specified at compile-time |
ykuroda | 0:13a5d365ba16 | 117 | * \tparam CCols number of columns in corner as specified at compile-time |
ykuroda | 0:13a5d365ba16 | 118 | * \param cRows number of rows in corner as specified at run-time |
ykuroda | 0:13a5d365ba16 | 119 | * \param cCols number of columns in corner as specified at run-time |
ykuroda | 0:13a5d365ba16 | 120 | * |
ykuroda | 0:13a5d365ba16 | 121 | * This function is mainly useful for corners where the number of rows is specified at compile-time |
ykuroda | 0:13a5d365ba16 | 122 | * and the number of columns is specified at run-time, or vice versa. The compile-time and run-time |
ykuroda | 0:13a5d365ba16 | 123 | * information should not contradict. In other words, \a cRows should equal \a CRows unless |
ykuroda | 0:13a5d365ba16 | 124 | * \a CRows is \a Dynamic, and the same for the number of columns. |
ykuroda | 0:13a5d365ba16 | 125 | * |
ykuroda | 0:13a5d365ba16 | 126 | * Example: \include MatrixBase_template_int_int_topRightCorner_int_int.cpp |
ykuroda | 0:13a5d365ba16 | 127 | * Output: \verbinclude MatrixBase_template_int_int_topRightCorner_int_int.out |
ykuroda | 0:13a5d365ba16 | 128 | * |
ykuroda | 0:13a5d365ba16 | 129 | * \sa class Block |
ykuroda | 0:13a5d365ba16 | 130 | */ |
ykuroda | 0:13a5d365ba16 | 131 | template<int CRows, int CCols> |
ykuroda | 0:13a5d365ba16 | 132 | inline Block<Derived, CRows, CCols> topRightCorner(Index cRows, Index cCols) |
ykuroda | 0:13a5d365ba16 | 133 | { |
ykuroda | 0:13a5d365ba16 | 134 | return Block<Derived, CRows, CCols>(derived(), 0, cols() - cCols, cRows, cCols); |
ykuroda | 0:13a5d365ba16 | 135 | } |
ykuroda | 0:13a5d365ba16 | 136 | |
ykuroda | 0:13a5d365ba16 | 137 | /** This is the const version of topRightCorner<int, int>(Index, Index).*/ |
ykuroda | 0:13a5d365ba16 | 138 | template<int CRows, int CCols> |
ykuroda | 0:13a5d365ba16 | 139 | inline const Block<const Derived, CRows, CCols> topRightCorner(Index cRows, Index cCols) const |
ykuroda | 0:13a5d365ba16 | 140 | { |
ykuroda | 0:13a5d365ba16 | 141 | return Block<const Derived, CRows, CCols>(derived(), 0, cols() - cCols, cRows, cCols); |
ykuroda | 0:13a5d365ba16 | 142 | } |
ykuroda | 0:13a5d365ba16 | 143 | |
ykuroda | 0:13a5d365ba16 | 144 | |
ykuroda | 0:13a5d365ba16 | 145 | |
ykuroda | 0:13a5d365ba16 | 146 | /** \returns a dynamic-size expression of a top-left corner of *this. |
ykuroda | 0:13a5d365ba16 | 147 | * |
ykuroda | 0:13a5d365ba16 | 148 | * \param cRows the number of rows in the corner |
ykuroda | 0:13a5d365ba16 | 149 | * \param cCols the number of columns in the corner |
ykuroda | 0:13a5d365ba16 | 150 | * |
ykuroda | 0:13a5d365ba16 | 151 | * Example: \include MatrixBase_topLeftCorner_int_int.cpp |
ykuroda | 0:13a5d365ba16 | 152 | * Output: \verbinclude MatrixBase_topLeftCorner_int_int.out |
ykuroda | 0:13a5d365ba16 | 153 | * |
ykuroda | 0:13a5d365ba16 | 154 | * \sa class Block, block(Index,Index,Index,Index) |
ykuroda | 0:13a5d365ba16 | 155 | */ |
ykuroda | 0:13a5d365ba16 | 156 | inline Block<Derived> topLeftCorner(Index cRows, Index cCols) |
ykuroda | 0:13a5d365ba16 | 157 | { |
ykuroda | 0:13a5d365ba16 | 158 | return Block<Derived>(derived(), 0, 0, cRows, cCols); |
ykuroda | 0:13a5d365ba16 | 159 | } |
ykuroda | 0:13a5d365ba16 | 160 | |
ykuroda | 0:13a5d365ba16 | 161 | /** This is the const version of topLeftCorner(Index, Index).*/ |
ykuroda | 0:13a5d365ba16 | 162 | inline const Block<const Derived> topLeftCorner(Index cRows, Index cCols) const |
ykuroda | 0:13a5d365ba16 | 163 | { |
ykuroda | 0:13a5d365ba16 | 164 | return Block<const Derived>(derived(), 0, 0, cRows, cCols); |
ykuroda | 0:13a5d365ba16 | 165 | } |
ykuroda | 0:13a5d365ba16 | 166 | |
ykuroda | 0:13a5d365ba16 | 167 | /** \returns an expression of a fixed-size top-left corner of *this. |
ykuroda | 0:13a5d365ba16 | 168 | * |
ykuroda | 0:13a5d365ba16 | 169 | * The template parameters CRows and CCols are the number of rows and columns in the corner. |
ykuroda | 0:13a5d365ba16 | 170 | * |
ykuroda | 0:13a5d365ba16 | 171 | * Example: \include MatrixBase_template_int_int_topLeftCorner.cpp |
ykuroda | 0:13a5d365ba16 | 172 | * Output: \verbinclude MatrixBase_template_int_int_topLeftCorner.out |
ykuroda | 0:13a5d365ba16 | 173 | * |
ykuroda | 0:13a5d365ba16 | 174 | * \sa class Block, block(Index,Index,Index,Index) |
ykuroda | 0:13a5d365ba16 | 175 | */ |
ykuroda | 0:13a5d365ba16 | 176 | template<int CRows, int CCols> |
ykuroda | 0:13a5d365ba16 | 177 | inline Block<Derived, CRows, CCols> topLeftCorner() |
ykuroda | 0:13a5d365ba16 | 178 | { |
ykuroda | 0:13a5d365ba16 | 179 | return Block<Derived, CRows, CCols>(derived(), 0, 0); |
ykuroda | 0:13a5d365ba16 | 180 | } |
ykuroda | 0:13a5d365ba16 | 181 | |
ykuroda | 0:13a5d365ba16 | 182 | /** This is the const version of topLeftCorner<int, int>().*/ |
ykuroda | 0:13a5d365ba16 | 183 | template<int CRows, int CCols> |
ykuroda | 0:13a5d365ba16 | 184 | inline const Block<const Derived, CRows, CCols> topLeftCorner() const |
ykuroda | 0:13a5d365ba16 | 185 | { |
ykuroda | 0:13a5d365ba16 | 186 | return Block<const Derived, CRows, CCols>(derived(), 0, 0); |
ykuroda | 0:13a5d365ba16 | 187 | } |
ykuroda | 0:13a5d365ba16 | 188 | |
ykuroda | 0:13a5d365ba16 | 189 | /** \returns an expression of a top-left corner of *this. |
ykuroda | 0:13a5d365ba16 | 190 | * |
ykuroda | 0:13a5d365ba16 | 191 | * \tparam CRows number of rows in corner as specified at compile-time |
ykuroda | 0:13a5d365ba16 | 192 | * \tparam CCols number of columns in corner as specified at compile-time |
ykuroda | 0:13a5d365ba16 | 193 | * \param cRows number of rows in corner as specified at run-time |
ykuroda | 0:13a5d365ba16 | 194 | * \param cCols number of columns in corner as specified at run-time |
ykuroda | 0:13a5d365ba16 | 195 | * |
ykuroda | 0:13a5d365ba16 | 196 | * This function is mainly useful for corners where the number of rows is specified at compile-time |
ykuroda | 0:13a5d365ba16 | 197 | * and the number of columns is specified at run-time, or vice versa. The compile-time and run-time |
ykuroda | 0:13a5d365ba16 | 198 | * information should not contradict. In other words, \a cRows should equal \a CRows unless |
ykuroda | 0:13a5d365ba16 | 199 | * \a CRows is \a Dynamic, and the same for the number of columns. |
ykuroda | 0:13a5d365ba16 | 200 | * |
ykuroda | 0:13a5d365ba16 | 201 | * Example: \include MatrixBase_template_int_int_topLeftCorner_int_int.cpp |
ykuroda | 0:13a5d365ba16 | 202 | * Output: \verbinclude MatrixBase_template_int_int_topLeftCorner_int_int.out |
ykuroda | 0:13a5d365ba16 | 203 | * |
ykuroda | 0:13a5d365ba16 | 204 | * \sa class Block |
ykuroda | 0:13a5d365ba16 | 205 | */ |
ykuroda | 0:13a5d365ba16 | 206 | template<int CRows, int CCols> |
ykuroda | 0:13a5d365ba16 | 207 | inline Block<Derived, CRows, CCols> topLeftCorner(Index cRows, Index cCols) |
ykuroda | 0:13a5d365ba16 | 208 | { |
ykuroda | 0:13a5d365ba16 | 209 | return Block<Derived, CRows, CCols>(derived(), 0, 0, cRows, cCols); |
ykuroda | 0:13a5d365ba16 | 210 | } |
ykuroda | 0:13a5d365ba16 | 211 | |
ykuroda | 0:13a5d365ba16 | 212 | /** This is the const version of topLeftCorner<int, int>(Index, Index).*/ |
ykuroda | 0:13a5d365ba16 | 213 | template<int CRows, int CCols> |
ykuroda | 0:13a5d365ba16 | 214 | inline const Block<const Derived, CRows, CCols> topLeftCorner(Index cRows, Index cCols) const |
ykuroda | 0:13a5d365ba16 | 215 | { |
ykuroda | 0:13a5d365ba16 | 216 | return Block<const Derived, CRows, CCols>(derived(), 0, 0, cRows, cCols); |
ykuroda | 0:13a5d365ba16 | 217 | } |
ykuroda | 0:13a5d365ba16 | 218 | |
ykuroda | 0:13a5d365ba16 | 219 | |
ykuroda | 0:13a5d365ba16 | 220 | |
ykuroda | 0:13a5d365ba16 | 221 | /** \returns a dynamic-size expression of a bottom-right corner of *this. |
ykuroda | 0:13a5d365ba16 | 222 | * |
ykuroda | 0:13a5d365ba16 | 223 | * \param cRows the number of rows in the corner |
ykuroda | 0:13a5d365ba16 | 224 | * \param cCols the number of columns in the corner |
ykuroda | 0:13a5d365ba16 | 225 | * |
ykuroda | 0:13a5d365ba16 | 226 | * Example: \include MatrixBase_bottomRightCorner_int_int.cpp |
ykuroda | 0:13a5d365ba16 | 227 | * Output: \verbinclude MatrixBase_bottomRightCorner_int_int.out |
ykuroda | 0:13a5d365ba16 | 228 | * |
ykuroda | 0:13a5d365ba16 | 229 | * \sa class Block, block(Index,Index,Index,Index) |
ykuroda | 0:13a5d365ba16 | 230 | */ |
ykuroda | 0:13a5d365ba16 | 231 | inline Block<Derived> bottomRightCorner(Index cRows, Index cCols) |
ykuroda | 0:13a5d365ba16 | 232 | { |
ykuroda | 0:13a5d365ba16 | 233 | return Block<Derived>(derived(), rows() - cRows, cols() - cCols, cRows, cCols); |
ykuroda | 0:13a5d365ba16 | 234 | } |
ykuroda | 0:13a5d365ba16 | 235 | |
ykuroda | 0:13a5d365ba16 | 236 | /** This is the const version of bottomRightCorner(Index, Index).*/ |
ykuroda | 0:13a5d365ba16 | 237 | inline const Block<const Derived> bottomRightCorner(Index cRows, Index cCols) const |
ykuroda | 0:13a5d365ba16 | 238 | { |
ykuroda | 0:13a5d365ba16 | 239 | return Block<const Derived>(derived(), rows() - cRows, cols() - cCols, cRows, cCols); |
ykuroda | 0:13a5d365ba16 | 240 | } |
ykuroda | 0:13a5d365ba16 | 241 | |
ykuroda | 0:13a5d365ba16 | 242 | /** \returns an expression of a fixed-size bottom-right corner of *this. |
ykuroda | 0:13a5d365ba16 | 243 | * |
ykuroda | 0:13a5d365ba16 | 244 | * The template parameters CRows and CCols are the number of rows and columns in the corner. |
ykuroda | 0:13a5d365ba16 | 245 | * |
ykuroda | 0:13a5d365ba16 | 246 | * Example: \include MatrixBase_template_int_int_bottomRightCorner.cpp |
ykuroda | 0:13a5d365ba16 | 247 | * Output: \verbinclude MatrixBase_template_int_int_bottomRightCorner.out |
ykuroda | 0:13a5d365ba16 | 248 | * |
ykuroda | 0:13a5d365ba16 | 249 | * \sa class Block, block(Index,Index,Index,Index) |
ykuroda | 0:13a5d365ba16 | 250 | */ |
ykuroda | 0:13a5d365ba16 | 251 | template<int CRows, int CCols> |
ykuroda | 0:13a5d365ba16 | 252 | inline Block<Derived, CRows, CCols> bottomRightCorner() |
ykuroda | 0:13a5d365ba16 | 253 | { |
ykuroda | 0:13a5d365ba16 | 254 | return Block<Derived, CRows, CCols>(derived(), rows() - CRows, cols() - CCols); |
ykuroda | 0:13a5d365ba16 | 255 | } |
ykuroda | 0:13a5d365ba16 | 256 | |
ykuroda | 0:13a5d365ba16 | 257 | /** This is the const version of bottomRightCorner<int, int>().*/ |
ykuroda | 0:13a5d365ba16 | 258 | template<int CRows, int CCols> |
ykuroda | 0:13a5d365ba16 | 259 | inline const Block<const Derived, CRows, CCols> bottomRightCorner() const |
ykuroda | 0:13a5d365ba16 | 260 | { |
ykuroda | 0:13a5d365ba16 | 261 | return Block<const Derived, CRows, CCols>(derived(), rows() - CRows, cols() - CCols); |
ykuroda | 0:13a5d365ba16 | 262 | } |
ykuroda | 0:13a5d365ba16 | 263 | |
ykuroda | 0:13a5d365ba16 | 264 | /** \returns an expression of a bottom-right corner of *this. |
ykuroda | 0:13a5d365ba16 | 265 | * |
ykuroda | 0:13a5d365ba16 | 266 | * \tparam CRows number of rows in corner as specified at compile-time |
ykuroda | 0:13a5d365ba16 | 267 | * \tparam CCols number of columns in corner as specified at compile-time |
ykuroda | 0:13a5d365ba16 | 268 | * \param cRows number of rows in corner as specified at run-time |
ykuroda | 0:13a5d365ba16 | 269 | * \param cCols number of columns in corner as specified at run-time |
ykuroda | 0:13a5d365ba16 | 270 | * |
ykuroda | 0:13a5d365ba16 | 271 | * This function is mainly useful for corners where the number of rows is specified at compile-time |
ykuroda | 0:13a5d365ba16 | 272 | * and the number of columns is specified at run-time, or vice versa. The compile-time and run-time |
ykuroda | 0:13a5d365ba16 | 273 | * information should not contradict. In other words, \a cRows should equal \a CRows unless |
ykuroda | 0:13a5d365ba16 | 274 | * \a CRows is \a Dynamic, and the same for the number of columns. |
ykuroda | 0:13a5d365ba16 | 275 | * |
ykuroda | 0:13a5d365ba16 | 276 | * Example: \include MatrixBase_template_int_int_bottomRightCorner_int_int.cpp |
ykuroda | 0:13a5d365ba16 | 277 | * Output: \verbinclude MatrixBase_template_int_int_bottomRightCorner_int_int.out |
ykuroda | 0:13a5d365ba16 | 278 | * |
ykuroda | 0:13a5d365ba16 | 279 | * \sa class Block |
ykuroda | 0:13a5d365ba16 | 280 | */ |
ykuroda | 0:13a5d365ba16 | 281 | template<int CRows, int CCols> |
ykuroda | 0:13a5d365ba16 | 282 | inline Block<Derived, CRows, CCols> bottomRightCorner(Index cRows, Index cCols) |
ykuroda | 0:13a5d365ba16 | 283 | { |
ykuroda | 0:13a5d365ba16 | 284 | return Block<Derived, CRows, CCols>(derived(), rows() - cRows, cols() - cCols, cRows, cCols); |
ykuroda | 0:13a5d365ba16 | 285 | } |
ykuroda | 0:13a5d365ba16 | 286 | |
ykuroda | 0:13a5d365ba16 | 287 | /** This is the const version of bottomRightCorner<int, int>(Index, Index).*/ |
ykuroda | 0:13a5d365ba16 | 288 | template<int CRows, int CCols> |
ykuroda | 0:13a5d365ba16 | 289 | inline const Block<const Derived, CRows, CCols> bottomRightCorner(Index cRows, Index cCols) const |
ykuroda | 0:13a5d365ba16 | 290 | { |
ykuroda | 0:13a5d365ba16 | 291 | return Block<const Derived, CRows, CCols>(derived(), rows() - cRows, cols() - cCols, cRows, cCols); |
ykuroda | 0:13a5d365ba16 | 292 | } |
ykuroda | 0:13a5d365ba16 | 293 | |
ykuroda | 0:13a5d365ba16 | 294 | |
ykuroda | 0:13a5d365ba16 | 295 | |
ykuroda | 0:13a5d365ba16 | 296 | /** \returns a dynamic-size expression of a bottom-left corner of *this. |
ykuroda | 0:13a5d365ba16 | 297 | * |
ykuroda | 0:13a5d365ba16 | 298 | * \param cRows the number of rows in the corner |
ykuroda | 0:13a5d365ba16 | 299 | * \param cCols the number of columns in the corner |
ykuroda | 0:13a5d365ba16 | 300 | * |
ykuroda | 0:13a5d365ba16 | 301 | * Example: \include MatrixBase_bottomLeftCorner_int_int.cpp |
ykuroda | 0:13a5d365ba16 | 302 | * Output: \verbinclude MatrixBase_bottomLeftCorner_int_int.out |
ykuroda | 0:13a5d365ba16 | 303 | * |
ykuroda | 0:13a5d365ba16 | 304 | * \sa class Block, block(Index,Index,Index,Index) |
ykuroda | 0:13a5d365ba16 | 305 | */ |
ykuroda | 0:13a5d365ba16 | 306 | inline Block<Derived> bottomLeftCorner(Index cRows, Index cCols) |
ykuroda | 0:13a5d365ba16 | 307 | { |
ykuroda | 0:13a5d365ba16 | 308 | return Block<Derived>(derived(), rows() - cRows, 0, cRows, cCols); |
ykuroda | 0:13a5d365ba16 | 309 | } |
ykuroda | 0:13a5d365ba16 | 310 | |
ykuroda | 0:13a5d365ba16 | 311 | /** This is the const version of bottomLeftCorner(Index, Index).*/ |
ykuroda | 0:13a5d365ba16 | 312 | inline const Block<const Derived> bottomLeftCorner(Index cRows, Index cCols) const |
ykuroda | 0:13a5d365ba16 | 313 | { |
ykuroda | 0:13a5d365ba16 | 314 | return Block<const Derived>(derived(), rows() - cRows, 0, cRows, cCols); |
ykuroda | 0:13a5d365ba16 | 315 | } |
ykuroda | 0:13a5d365ba16 | 316 | |
ykuroda | 0:13a5d365ba16 | 317 | /** \returns an expression of a fixed-size bottom-left corner of *this. |
ykuroda | 0:13a5d365ba16 | 318 | * |
ykuroda | 0:13a5d365ba16 | 319 | * The template parameters CRows and CCols are the number of rows and columns in the corner. |
ykuroda | 0:13a5d365ba16 | 320 | * |
ykuroda | 0:13a5d365ba16 | 321 | * Example: \include MatrixBase_template_int_int_bottomLeftCorner.cpp |
ykuroda | 0:13a5d365ba16 | 322 | * Output: \verbinclude MatrixBase_template_int_int_bottomLeftCorner.out |
ykuroda | 0:13a5d365ba16 | 323 | * |
ykuroda | 0:13a5d365ba16 | 324 | * \sa class Block, block(Index,Index,Index,Index) |
ykuroda | 0:13a5d365ba16 | 325 | */ |
ykuroda | 0:13a5d365ba16 | 326 | template<int CRows, int CCols> |
ykuroda | 0:13a5d365ba16 | 327 | inline Block<Derived, CRows, CCols> bottomLeftCorner() |
ykuroda | 0:13a5d365ba16 | 328 | { |
ykuroda | 0:13a5d365ba16 | 329 | return Block<Derived, CRows, CCols>(derived(), rows() - CRows, 0); |
ykuroda | 0:13a5d365ba16 | 330 | } |
ykuroda | 0:13a5d365ba16 | 331 | |
ykuroda | 0:13a5d365ba16 | 332 | /** This is the const version of bottomLeftCorner<int, int>().*/ |
ykuroda | 0:13a5d365ba16 | 333 | template<int CRows, int CCols> |
ykuroda | 0:13a5d365ba16 | 334 | inline const Block<const Derived, CRows, CCols> bottomLeftCorner() const |
ykuroda | 0:13a5d365ba16 | 335 | { |
ykuroda | 0:13a5d365ba16 | 336 | return Block<const Derived, CRows, CCols>(derived(), rows() - CRows, 0); |
ykuroda | 0:13a5d365ba16 | 337 | } |
ykuroda | 0:13a5d365ba16 | 338 | |
ykuroda | 0:13a5d365ba16 | 339 | /** \returns an expression of a bottom-left corner of *this. |
ykuroda | 0:13a5d365ba16 | 340 | * |
ykuroda | 0:13a5d365ba16 | 341 | * \tparam CRows number of rows in corner as specified at compile-time |
ykuroda | 0:13a5d365ba16 | 342 | * \tparam CCols number of columns in corner as specified at compile-time |
ykuroda | 0:13a5d365ba16 | 343 | * \param cRows number of rows in corner as specified at run-time |
ykuroda | 0:13a5d365ba16 | 344 | * \param cCols number of columns in corner as specified at run-time |
ykuroda | 0:13a5d365ba16 | 345 | * |
ykuroda | 0:13a5d365ba16 | 346 | * This function is mainly useful for corners where the number of rows is specified at compile-time |
ykuroda | 0:13a5d365ba16 | 347 | * and the number of columns is specified at run-time, or vice versa. The compile-time and run-time |
ykuroda | 0:13a5d365ba16 | 348 | * information should not contradict. In other words, \a cRows should equal \a CRows unless |
ykuroda | 0:13a5d365ba16 | 349 | * \a CRows is \a Dynamic, and the same for the number of columns. |
ykuroda | 0:13a5d365ba16 | 350 | * |
ykuroda | 0:13a5d365ba16 | 351 | * Example: \include MatrixBase_template_int_int_bottomLeftCorner_int_int.cpp |
ykuroda | 0:13a5d365ba16 | 352 | * Output: \verbinclude MatrixBase_template_int_int_bottomLeftCorner_int_int.out |
ykuroda | 0:13a5d365ba16 | 353 | * |
ykuroda | 0:13a5d365ba16 | 354 | * \sa class Block |
ykuroda | 0:13a5d365ba16 | 355 | */ |
ykuroda | 0:13a5d365ba16 | 356 | template<int CRows, int CCols> |
ykuroda | 0:13a5d365ba16 | 357 | inline Block<Derived, CRows, CCols> bottomLeftCorner(Index cRows, Index cCols) |
ykuroda | 0:13a5d365ba16 | 358 | { |
ykuroda | 0:13a5d365ba16 | 359 | return Block<Derived, CRows, CCols>(derived(), rows() - cRows, 0, cRows, cCols); |
ykuroda | 0:13a5d365ba16 | 360 | } |
ykuroda | 0:13a5d365ba16 | 361 | |
ykuroda | 0:13a5d365ba16 | 362 | /** This is the const version of bottomLeftCorner<int, int>(Index, Index).*/ |
ykuroda | 0:13a5d365ba16 | 363 | template<int CRows, int CCols> |
ykuroda | 0:13a5d365ba16 | 364 | inline const Block<const Derived, CRows, CCols> bottomLeftCorner(Index cRows, Index cCols) const |
ykuroda | 0:13a5d365ba16 | 365 | { |
ykuroda | 0:13a5d365ba16 | 366 | return Block<const Derived, CRows, CCols>(derived(), rows() - cRows, 0, cRows, cCols); |
ykuroda | 0:13a5d365ba16 | 367 | } |
ykuroda | 0:13a5d365ba16 | 368 | |
ykuroda | 0:13a5d365ba16 | 369 | |
ykuroda | 0:13a5d365ba16 | 370 | |
ykuroda | 0:13a5d365ba16 | 371 | /** \returns a block consisting of the top rows of *this. |
ykuroda | 0:13a5d365ba16 | 372 | * |
ykuroda | 0:13a5d365ba16 | 373 | * \param n the number of rows in the block |
ykuroda | 0:13a5d365ba16 | 374 | * |
ykuroda | 0:13a5d365ba16 | 375 | * Example: \include MatrixBase_topRows_int.cpp |
ykuroda | 0:13a5d365ba16 | 376 | * Output: \verbinclude MatrixBase_topRows_int.out |
ykuroda | 0:13a5d365ba16 | 377 | * |
ykuroda | 0:13a5d365ba16 | 378 | * \sa class Block, block(Index,Index,Index,Index) |
ykuroda | 0:13a5d365ba16 | 379 | */ |
ykuroda | 0:13a5d365ba16 | 380 | inline RowsBlockXpr topRows(Index n) |
ykuroda | 0:13a5d365ba16 | 381 | { |
ykuroda | 0:13a5d365ba16 | 382 | return RowsBlockXpr(derived(), 0, 0, n, cols()); |
ykuroda | 0:13a5d365ba16 | 383 | } |
ykuroda | 0:13a5d365ba16 | 384 | |
ykuroda | 0:13a5d365ba16 | 385 | /** This is the const version of topRows(Index).*/ |
ykuroda | 0:13a5d365ba16 | 386 | inline ConstRowsBlockXpr topRows(Index n) const |
ykuroda | 0:13a5d365ba16 | 387 | { |
ykuroda | 0:13a5d365ba16 | 388 | return ConstRowsBlockXpr(derived(), 0, 0, n, cols()); |
ykuroda | 0:13a5d365ba16 | 389 | } |
ykuroda | 0:13a5d365ba16 | 390 | |
ykuroda | 0:13a5d365ba16 | 391 | /** \returns a block consisting of the top rows of *this. |
ykuroda | 0:13a5d365ba16 | 392 | * |
ykuroda | 0:13a5d365ba16 | 393 | * \tparam N the number of rows in the block as specified at compile-time |
ykuroda | 0:13a5d365ba16 | 394 | * \param n the number of rows in the block as specified at run-time |
ykuroda | 0:13a5d365ba16 | 395 | * |
ykuroda | 0:13a5d365ba16 | 396 | * The compile-time and run-time information should not contradict. In other words, |
ykuroda | 0:13a5d365ba16 | 397 | * \a n should equal \a N unless \a N is \a Dynamic. |
ykuroda | 0:13a5d365ba16 | 398 | * |
ykuroda | 0:13a5d365ba16 | 399 | * Example: \include MatrixBase_template_int_topRows.cpp |
ykuroda | 0:13a5d365ba16 | 400 | * Output: \verbinclude MatrixBase_template_int_topRows.out |
ykuroda | 0:13a5d365ba16 | 401 | * |
ykuroda | 0:13a5d365ba16 | 402 | * \sa class Block, block(Index,Index,Index,Index) |
ykuroda | 0:13a5d365ba16 | 403 | */ |
ykuroda | 0:13a5d365ba16 | 404 | template<int N> |
ykuroda | 0:13a5d365ba16 | 405 | inline typename NRowsBlockXpr<N>::Type topRows(Index n = N) |
ykuroda | 0:13a5d365ba16 | 406 | { |
ykuroda | 0:13a5d365ba16 | 407 | return typename NRowsBlockXpr<N>::Type(derived(), 0, 0, n, cols()); |
ykuroda | 0:13a5d365ba16 | 408 | } |
ykuroda | 0:13a5d365ba16 | 409 | |
ykuroda | 0:13a5d365ba16 | 410 | /** This is the const version of topRows<int>().*/ |
ykuroda | 0:13a5d365ba16 | 411 | template<int N> |
ykuroda | 0:13a5d365ba16 | 412 | inline typename ConstNRowsBlockXpr<N>::Type topRows(Index n = N) const |
ykuroda | 0:13a5d365ba16 | 413 | { |
ykuroda | 0:13a5d365ba16 | 414 | return typename ConstNRowsBlockXpr<N>::Type(derived(), 0, 0, n, cols()); |
ykuroda | 0:13a5d365ba16 | 415 | } |
ykuroda | 0:13a5d365ba16 | 416 | |
ykuroda | 0:13a5d365ba16 | 417 | |
ykuroda | 0:13a5d365ba16 | 418 | |
ykuroda | 0:13a5d365ba16 | 419 | /** \returns a block consisting of the bottom rows of *this. |
ykuroda | 0:13a5d365ba16 | 420 | * |
ykuroda | 0:13a5d365ba16 | 421 | * \param n the number of rows in the block |
ykuroda | 0:13a5d365ba16 | 422 | * |
ykuroda | 0:13a5d365ba16 | 423 | * Example: \include MatrixBase_bottomRows_int.cpp |
ykuroda | 0:13a5d365ba16 | 424 | * Output: \verbinclude MatrixBase_bottomRows_int.out |
ykuroda | 0:13a5d365ba16 | 425 | * |
ykuroda | 0:13a5d365ba16 | 426 | * \sa class Block, block(Index,Index,Index,Index) |
ykuroda | 0:13a5d365ba16 | 427 | */ |
ykuroda | 0:13a5d365ba16 | 428 | inline RowsBlockXpr bottomRows(Index n) |
ykuroda | 0:13a5d365ba16 | 429 | { |
ykuroda | 0:13a5d365ba16 | 430 | return RowsBlockXpr(derived(), rows() - n, 0, n, cols()); |
ykuroda | 0:13a5d365ba16 | 431 | } |
ykuroda | 0:13a5d365ba16 | 432 | |
ykuroda | 0:13a5d365ba16 | 433 | /** This is the const version of bottomRows(Index).*/ |
ykuroda | 0:13a5d365ba16 | 434 | inline ConstRowsBlockXpr bottomRows(Index n) const |
ykuroda | 0:13a5d365ba16 | 435 | { |
ykuroda | 0:13a5d365ba16 | 436 | return ConstRowsBlockXpr(derived(), rows() - n, 0, n, cols()); |
ykuroda | 0:13a5d365ba16 | 437 | } |
ykuroda | 0:13a5d365ba16 | 438 | |
ykuroda | 0:13a5d365ba16 | 439 | /** \returns a block consisting of the bottom rows of *this. |
ykuroda | 0:13a5d365ba16 | 440 | * |
ykuroda | 0:13a5d365ba16 | 441 | * \tparam N the number of rows in the block as specified at compile-time |
ykuroda | 0:13a5d365ba16 | 442 | * \param n the number of rows in the block as specified at run-time |
ykuroda | 0:13a5d365ba16 | 443 | * |
ykuroda | 0:13a5d365ba16 | 444 | * The compile-time and run-time information should not contradict. In other words, |
ykuroda | 0:13a5d365ba16 | 445 | * \a n should equal \a N unless \a N is \a Dynamic. |
ykuroda | 0:13a5d365ba16 | 446 | * |
ykuroda | 0:13a5d365ba16 | 447 | * Example: \include MatrixBase_template_int_bottomRows.cpp |
ykuroda | 0:13a5d365ba16 | 448 | * Output: \verbinclude MatrixBase_template_int_bottomRows.out |
ykuroda | 0:13a5d365ba16 | 449 | * |
ykuroda | 0:13a5d365ba16 | 450 | * \sa class Block, block(Index,Index,Index,Index) |
ykuroda | 0:13a5d365ba16 | 451 | */ |
ykuroda | 0:13a5d365ba16 | 452 | template<int N> |
ykuroda | 0:13a5d365ba16 | 453 | inline typename NRowsBlockXpr<N>::Type bottomRows(Index n = N) |
ykuroda | 0:13a5d365ba16 | 454 | { |
ykuroda | 0:13a5d365ba16 | 455 | return typename NRowsBlockXpr<N>::Type(derived(), rows() - n, 0, n, cols()); |
ykuroda | 0:13a5d365ba16 | 456 | } |
ykuroda | 0:13a5d365ba16 | 457 | |
ykuroda | 0:13a5d365ba16 | 458 | /** This is the const version of bottomRows<int>().*/ |
ykuroda | 0:13a5d365ba16 | 459 | template<int N> |
ykuroda | 0:13a5d365ba16 | 460 | inline typename ConstNRowsBlockXpr<N>::Type bottomRows(Index n = N) const |
ykuroda | 0:13a5d365ba16 | 461 | { |
ykuroda | 0:13a5d365ba16 | 462 | return typename ConstNRowsBlockXpr<N>::Type(derived(), rows() - n, 0, n, cols()); |
ykuroda | 0:13a5d365ba16 | 463 | } |
ykuroda | 0:13a5d365ba16 | 464 | |
ykuroda | 0:13a5d365ba16 | 465 | |
ykuroda | 0:13a5d365ba16 | 466 | |
ykuroda | 0:13a5d365ba16 | 467 | /** \returns a block consisting of a range of rows of *this. |
ykuroda | 0:13a5d365ba16 | 468 | * |
ykuroda | 0:13a5d365ba16 | 469 | * \param startRow the index of the first row in the block |
ykuroda | 0:13a5d365ba16 | 470 | * \param n the number of rows in the block |
ykuroda | 0:13a5d365ba16 | 471 | * |
ykuroda | 0:13a5d365ba16 | 472 | * Example: \include DenseBase_middleRows_int.cpp |
ykuroda | 0:13a5d365ba16 | 473 | * Output: \verbinclude DenseBase_middleRows_int.out |
ykuroda | 0:13a5d365ba16 | 474 | * |
ykuroda | 0:13a5d365ba16 | 475 | * \sa class Block, block(Index,Index,Index,Index) |
ykuroda | 0:13a5d365ba16 | 476 | */ |
ykuroda | 0:13a5d365ba16 | 477 | inline RowsBlockXpr middleRows(Index startRow, Index n) |
ykuroda | 0:13a5d365ba16 | 478 | { |
ykuroda | 0:13a5d365ba16 | 479 | return RowsBlockXpr(derived(), startRow, 0, n, cols()); |
ykuroda | 0:13a5d365ba16 | 480 | } |
ykuroda | 0:13a5d365ba16 | 481 | |
ykuroda | 0:13a5d365ba16 | 482 | /** This is the const version of middleRows(Index,Index).*/ |
ykuroda | 0:13a5d365ba16 | 483 | inline ConstRowsBlockXpr middleRows(Index startRow, Index n) const |
ykuroda | 0:13a5d365ba16 | 484 | { |
ykuroda | 0:13a5d365ba16 | 485 | return ConstRowsBlockXpr(derived(), startRow, 0, n, cols()); |
ykuroda | 0:13a5d365ba16 | 486 | } |
ykuroda | 0:13a5d365ba16 | 487 | |
ykuroda | 0:13a5d365ba16 | 488 | /** \returns a block consisting of a range of rows of *this. |
ykuroda | 0:13a5d365ba16 | 489 | * |
ykuroda | 0:13a5d365ba16 | 490 | * \tparam N the number of rows in the block as specified at compile-time |
ykuroda | 0:13a5d365ba16 | 491 | * \param startRow the index of the first row in the block |
ykuroda | 0:13a5d365ba16 | 492 | * \param n the number of rows in the block as specified at run-time |
ykuroda | 0:13a5d365ba16 | 493 | * |
ykuroda | 0:13a5d365ba16 | 494 | * The compile-time and run-time information should not contradict. In other words, |
ykuroda | 0:13a5d365ba16 | 495 | * \a n should equal \a N unless \a N is \a Dynamic. |
ykuroda | 0:13a5d365ba16 | 496 | * |
ykuroda | 0:13a5d365ba16 | 497 | * Example: \include DenseBase_template_int_middleRows.cpp |
ykuroda | 0:13a5d365ba16 | 498 | * Output: \verbinclude DenseBase_template_int_middleRows.out |
ykuroda | 0:13a5d365ba16 | 499 | * |
ykuroda | 0:13a5d365ba16 | 500 | * \sa class Block, block(Index,Index,Index,Index) |
ykuroda | 0:13a5d365ba16 | 501 | */ |
ykuroda | 0:13a5d365ba16 | 502 | template<int N> |
ykuroda | 0:13a5d365ba16 | 503 | inline typename NRowsBlockXpr<N>::Type middleRows(Index startRow, Index n = N) |
ykuroda | 0:13a5d365ba16 | 504 | { |
ykuroda | 0:13a5d365ba16 | 505 | return typename NRowsBlockXpr<N>::Type(derived(), startRow, 0, n, cols()); |
ykuroda | 0:13a5d365ba16 | 506 | } |
ykuroda | 0:13a5d365ba16 | 507 | |
ykuroda | 0:13a5d365ba16 | 508 | /** This is the const version of middleRows<int>().*/ |
ykuroda | 0:13a5d365ba16 | 509 | template<int N> |
ykuroda | 0:13a5d365ba16 | 510 | inline typename ConstNRowsBlockXpr<N>::Type middleRows(Index startRow, Index n = N) const |
ykuroda | 0:13a5d365ba16 | 511 | { |
ykuroda | 0:13a5d365ba16 | 512 | return typename ConstNRowsBlockXpr<N>::Type(derived(), startRow, 0, n, cols()); |
ykuroda | 0:13a5d365ba16 | 513 | } |
ykuroda | 0:13a5d365ba16 | 514 | |
ykuroda | 0:13a5d365ba16 | 515 | |
ykuroda | 0:13a5d365ba16 | 516 | |
ykuroda | 0:13a5d365ba16 | 517 | /** \returns a block consisting of the left columns of *this. |
ykuroda | 0:13a5d365ba16 | 518 | * |
ykuroda | 0:13a5d365ba16 | 519 | * \param n the number of columns in the block |
ykuroda | 0:13a5d365ba16 | 520 | * |
ykuroda | 0:13a5d365ba16 | 521 | * Example: \include MatrixBase_leftCols_int.cpp |
ykuroda | 0:13a5d365ba16 | 522 | * Output: \verbinclude MatrixBase_leftCols_int.out |
ykuroda | 0:13a5d365ba16 | 523 | * |
ykuroda | 0:13a5d365ba16 | 524 | * \sa class Block, block(Index,Index,Index,Index) |
ykuroda | 0:13a5d365ba16 | 525 | */ |
ykuroda | 0:13a5d365ba16 | 526 | inline ColsBlockXpr leftCols(Index n) |
ykuroda | 0:13a5d365ba16 | 527 | { |
ykuroda | 0:13a5d365ba16 | 528 | return ColsBlockXpr(derived(), 0, 0, rows(), n); |
ykuroda | 0:13a5d365ba16 | 529 | } |
ykuroda | 0:13a5d365ba16 | 530 | |
ykuroda | 0:13a5d365ba16 | 531 | /** This is the const version of leftCols(Index).*/ |
ykuroda | 0:13a5d365ba16 | 532 | inline ConstColsBlockXpr leftCols(Index n) const |
ykuroda | 0:13a5d365ba16 | 533 | { |
ykuroda | 0:13a5d365ba16 | 534 | return ConstColsBlockXpr(derived(), 0, 0, rows(), n); |
ykuroda | 0:13a5d365ba16 | 535 | } |
ykuroda | 0:13a5d365ba16 | 536 | |
ykuroda | 0:13a5d365ba16 | 537 | /** \returns a block consisting of the left columns of *this. |
ykuroda | 0:13a5d365ba16 | 538 | * |
ykuroda | 0:13a5d365ba16 | 539 | * \tparam N the number of columns in the block as specified at compile-time |
ykuroda | 0:13a5d365ba16 | 540 | * \param n the number of columns in the block as specified at run-time |
ykuroda | 0:13a5d365ba16 | 541 | * |
ykuroda | 0:13a5d365ba16 | 542 | * The compile-time and run-time information should not contradict. In other words, |
ykuroda | 0:13a5d365ba16 | 543 | * \a n should equal \a N unless \a N is \a Dynamic. |
ykuroda | 0:13a5d365ba16 | 544 | * |
ykuroda | 0:13a5d365ba16 | 545 | * Example: \include MatrixBase_template_int_leftCols.cpp |
ykuroda | 0:13a5d365ba16 | 546 | * Output: \verbinclude MatrixBase_template_int_leftCols.out |
ykuroda | 0:13a5d365ba16 | 547 | * |
ykuroda | 0:13a5d365ba16 | 548 | * \sa class Block, block(Index,Index,Index,Index) |
ykuroda | 0:13a5d365ba16 | 549 | */ |
ykuroda | 0:13a5d365ba16 | 550 | template<int N> |
ykuroda | 0:13a5d365ba16 | 551 | inline typename NColsBlockXpr<N>::Type leftCols(Index n = N) |
ykuroda | 0:13a5d365ba16 | 552 | { |
ykuroda | 0:13a5d365ba16 | 553 | return typename NColsBlockXpr<N>::Type(derived(), 0, 0, rows(), n); |
ykuroda | 0:13a5d365ba16 | 554 | } |
ykuroda | 0:13a5d365ba16 | 555 | |
ykuroda | 0:13a5d365ba16 | 556 | /** This is the const version of leftCols<int>().*/ |
ykuroda | 0:13a5d365ba16 | 557 | template<int N> |
ykuroda | 0:13a5d365ba16 | 558 | inline typename ConstNColsBlockXpr<N>::Type leftCols(Index n = N) const |
ykuroda | 0:13a5d365ba16 | 559 | { |
ykuroda | 0:13a5d365ba16 | 560 | return typename ConstNColsBlockXpr<N>::Type(derived(), 0, 0, rows(), n); |
ykuroda | 0:13a5d365ba16 | 561 | } |
ykuroda | 0:13a5d365ba16 | 562 | |
ykuroda | 0:13a5d365ba16 | 563 | |
ykuroda | 0:13a5d365ba16 | 564 | |
ykuroda | 0:13a5d365ba16 | 565 | /** \returns a block consisting of the right columns of *this. |
ykuroda | 0:13a5d365ba16 | 566 | * |
ykuroda | 0:13a5d365ba16 | 567 | * \param n the number of columns in the block |
ykuroda | 0:13a5d365ba16 | 568 | * |
ykuroda | 0:13a5d365ba16 | 569 | * Example: \include MatrixBase_rightCols_int.cpp |
ykuroda | 0:13a5d365ba16 | 570 | * Output: \verbinclude MatrixBase_rightCols_int.out |
ykuroda | 0:13a5d365ba16 | 571 | * |
ykuroda | 0:13a5d365ba16 | 572 | * \sa class Block, block(Index,Index,Index,Index) |
ykuroda | 0:13a5d365ba16 | 573 | */ |
ykuroda | 0:13a5d365ba16 | 574 | inline ColsBlockXpr rightCols(Index n) |
ykuroda | 0:13a5d365ba16 | 575 | { |
ykuroda | 0:13a5d365ba16 | 576 | return ColsBlockXpr(derived(), 0, cols() - n, rows(), n); |
ykuroda | 0:13a5d365ba16 | 577 | } |
ykuroda | 0:13a5d365ba16 | 578 | |
ykuroda | 0:13a5d365ba16 | 579 | /** This is the const version of rightCols(Index).*/ |
ykuroda | 0:13a5d365ba16 | 580 | inline ConstColsBlockXpr rightCols(Index n) const |
ykuroda | 0:13a5d365ba16 | 581 | { |
ykuroda | 0:13a5d365ba16 | 582 | return ConstColsBlockXpr(derived(), 0, cols() - n, rows(), n); |
ykuroda | 0:13a5d365ba16 | 583 | } |
ykuroda | 0:13a5d365ba16 | 584 | |
ykuroda | 0:13a5d365ba16 | 585 | /** \returns a block consisting of the right columns of *this. |
ykuroda | 0:13a5d365ba16 | 586 | * |
ykuroda | 0:13a5d365ba16 | 587 | * \tparam N the number of columns in the block as specified at compile-time |
ykuroda | 0:13a5d365ba16 | 588 | * \param n the number of columns in the block as specified at run-time |
ykuroda | 0:13a5d365ba16 | 589 | * |
ykuroda | 0:13a5d365ba16 | 590 | * The compile-time and run-time information should not contradict. In other words, |
ykuroda | 0:13a5d365ba16 | 591 | * \a n should equal \a N unless \a N is \a Dynamic. |
ykuroda | 0:13a5d365ba16 | 592 | * |
ykuroda | 0:13a5d365ba16 | 593 | * Example: \include MatrixBase_template_int_rightCols.cpp |
ykuroda | 0:13a5d365ba16 | 594 | * Output: \verbinclude MatrixBase_template_int_rightCols.out |
ykuroda | 0:13a5d365ba16 | 595 | * |
ykuroda | 0:13a5d365ba16 | 596 | * \sa class Block, block(Index,Index,Index,Index) |
ykuroda | 0:13a5d365ba16 | 597 | */ |
ykuroda | 0:13a5d365ba16 | 598 | template<int N> |
ykuroda | 0:13a5d365ba16 | 599 | inline typename NColsBlockXpr<N>::Type rightCols(Index n = N) |
ykuroda | 0:13a5d365ba16 | 600 | { |
ykuroda | 0:13a5d365ba16 | 601 | return typename NColsBlockXpr<N>::Type(derived(), 0, cols() - n, rows(), n); |
ykuroda | 0:13a5d365ba16 | 602 | } |
ykuroda | 0:13a5d365ba16 | 603 | |
ykuroda | 0:13a5d365ba16 | 604 | /** This is the const version of rightCols<int>().*/ |
ykuroda | 0:13a5d365ba16 | 605 | template<int N> |
ykuroda | 0:13a5d365ba16 | 606 | inline typename ConstNColsBlockXpr<N>::Type rightCols(Index n = N) const |
ykuroda | 0:13a5d365ba16 | 607 | { |
ykuroda | 0:13a5d365ba16 | 608 | return typename ConstNColsBlockXpr<N>::Type(derived(), 0, cols() - n, rows(), n); |
ykuroda | 0:13a5d365ba16 | 609 | } |
ykuroda | 0:13a5d365ba16 | 610 | |
ykuroda | 0:13a5d365ba16 | 611 | |
ykuroda | 0:13a5d365ba16 | 612 | |
ykuroda | 0:13a5d365ba16 | 613 | /** \returns a block consisting of a range of columns of *this. |
ykuroda | 0:13a5d365ba16 | 614 | * |
ykuroda | 0:13a5d365ba16 | 615 | * \param startCol the index of the first column in the block |
ykuroda | 0:13a5d365ba16 | 616 | * \param numCols the number of columns in the block |
ykuroda | 0:13a5d365ba16 | 617 | * |
ykuroda | 0:13a5d365ba16 | 618 | * Example: \include DenseBase_middleCols_int.cpp |
ykuroda | 0:13a5d365ba16 | 619 | * Output: \verbinclude DenseBase_middleCols_int.out |
ykuroda | 0:13a5d365ba16 | 620 | * |
ykuroda | 0:13a5d365ba16 | 621 | * \sa class Block, block(Index,Index,Index,Index) |
ykuroda | 0:13a5d365ba16 | 622 | */ |
ykuroda | 0:13a5d365ba16 | 623 | inline ColsBlockXpr middleCols(Index startCol, Index numCols) |
ykuroda | 0:13a5d365ba16 | 624 | { |
ykuroda | 0:13a5d365ba16 | 625 | return ColsBlockXpr(derived(), 0, startCol, rows(), numCols); |
ykuroda | 0:13a5d365ba16 | 626 | } |
ykuroda | 0:13a5d365ba16 | 627 | |
ykuroda | 0:13a5d365ba16 | 628 | /** This is the const version of middleCols(Index,Index).*/ |
ykuroda | 0:13a5d365ba16 | 629 | inline ConstColsBlockXpr middleCols(Index startCol, Index numCols) const |
ykuroda | 0:13a5d365ba16 | 630 | { |
ykuroda | 0:13a5d365ba16 | 631 | return ConstColsBlockXpr(derived(), 0, startCol, rows(), numCols); |
ykuroda | 0:13a5d365ba16 | 632 | } |
ykuroda | 0:13a5d365ba16 | 633 | |
ykuroda | 0:13a5d365ba16 | 634 | /** \returns a block consisting of a range of columns of *this. |
ykuroda | 0:13a5d365ba16 | 635 | * |
ykuroda | 0:13a5d365ba16 | 636 | * \tparam N the number of columns in the block as specified at compile-time |
ykuroda | 0:13a5d365ba16 | 637 | * \param startCol the index of the first column in the block |
ykuroda | 0:13a5d365ba16 | 638 | * \param n the number of columns in the block as specified at run-time |
ykuroda | 0:13a5d365ba16 | 639 | * |
ykuroda | 0:13a5d365ba16 | 640 | * The compile-time and run-time information should not contradict. In other words, |
ykuroda | 0:13a5d365ba16 | 641 | * \a n should equal \a N unless \a N is \a Dynamic. |
ykuroda | 0:13a5d365ba16 | 642 | * |
ykuroda | 0:13a5d365ba16 | 643 | * Example: \include DenseBase_template_int_middleCols.cpp |
ykuroda | 0:13a5d365ba16 | 644 | * Output: \verbinclude DenseBase_template_int_middleCols.out |
ykuroda | 0:13a5d365ba16 | 645 | * |
ykuroda | 0:13a5d365ba16 | 646 | * \sa class Block, block(Index,Index,Index,Index) |
ykuroda | 0:13a5d365ba16 | 647 | */ |
ykuroda | 0:13a5d365ba16 | 648 | template<int N> |
ykuroda | 0:13a5d365ba16 | 649 | inline typename NColsBlockXpr<N>::Type middleCols(Index startCol, Index n = N) |
ykuroda | 0:13a5d365ba16 | 650 | { |
ykuroda | 0:13a5d365ba16 | 651 | return typename NColsBlockXpr<N>::Type(derived(), 0, startCol, rows(), n); |
ykuroda | 0:13a5d365ba16 | 652 | } |
ykuroda | 0:13a5d365ba16 | 653 | |
ykuroda | 0:13a5d365ba16 | 654 | /** This is the const version of middleCols<int>().*/ |
ykuroda | 0:13a5d365ba16 | 655 | template<int N> |
ykuroda | 0:13a5d365ba16 | 656 | inline typename ConstNColsBlockXpr<N>::Type middleCols(Index startCol, Index n = N) const |
ykuroda | 0:13a5d365ba16 | 657 | { |
ykuroda | 0:13a5d365ba16 | 658 | return typename ConstNColsBlockXpr<N>::Type(derived(), 0, startCol, rows(), n); |
ykuroda | 0:13a5d365ba16 | 659 | } |
ykuroda | 0:13a5d365ba16 | 660 | |
ykuroda | 0:13a5d365ba16 | 661 | |
ykuroda | 0:13a5d365ba16 | 662 | |
ykuroda | 0:13a5d365ba16 | 663 | /** \returns a fixed-size expression of a block in *this. |
ykuroda | 0:13a5d365ba16 | 664 | * |
ykuroda | 0:13a5d365ba16 | 665 | * The template parameters \a BlockRows and \a BlockCols are the number of |
ykuroda | 0:13a5d365ba16 | 666 | * rows and columns in the block. |
ykuroda | 0:13a5d365ba16 | 667 | * |
ykuroda | 0:13a5d365ba16 | 668 | * \param startRow the first row in the block |
ykuroda | 0:13a5d365ba16 | 669 | * \param startCol the first column in the block |
ykuroda | 0:13a5d365ba16 | 670 | * |
ykuroda | 0:13a5d365ba16 | 671 | * Example: \include MatrixBase_block_int_int.cpp |
ykuroda | 0:13a5d365ba16 | 672 | * Output: \verbinclude MatrixBase_block_int_int.out |
ykuroda | 0:13a5d365ba16 | 673 | * |
ykuroda | 0:13a5d365ba16 | 674 | * \note since block is a templated member, the keyword template has to be used |
ykuroda | 0:13a5d365ba16 | 675 | * if the matrix type is also a template parameter: \code m.template block<3,3>(1,1); \endcode |
ykuroda | 0:13a5d365ba16 | 676 | * |
ykuroda | 0:13a5d365ba16 | 677 | * \sa class Block, block(Index,Index,Index,Index) |
ykuroda | 0:13a5d365ba16 | 678 | */ |
ykuroda | 0:13a5d365ba16 | 679 | template<int BlockRows, int BlockCols> |
ykuroda | 0:13a5d365ba16 | 680 | inline Block<Derived, BlockRows, BlockCols> block(Index startRow, Index startCol) |
ykuroda | 0:13a5d365ba16 | 681 | { |
ykuroda | 0:13a5d365ba16 | 682 | return Block<Derived, BlockRows, BlockCols>(derived(), startRow, startCol); |
ykuroda | 0:13a5d365ba16 | 683 | } |
ykuroda | 0:13a5d365ba16 | 684 | |
ykuroda | 0:13a5d365ba16 | 685 | /** This is the const version of block<>(Index, Index). */ |
ykuroda | 0:13a5d365ba16 | 686 | template<int BlockRows, int BlockCols> |
ykuroda | 0:13a5d365ba16 | 687 | inline const Block<const Derived, BlockRows, BlockCols> block(Index startRow, Index startCol) const |
ykuroda | 0:13a5d365ba16 | 688 | { |
ykuroda | 0:13a5d365ba16 | 689 | return Block<const Derived, BlockRows, BlockCols>(derived(), startRow, startCol); |
ykuroda | 0:13a5d365ba16 | 690 | } |
ykuroda | 0:13a5d365ba16 | 691 | |
ykuroda | 0:13a5d365ba16 | 692 | /** \returns an expression of a block in *this. |
ykuroda | 0:13a5d365ba16 | 693 | * |
ykuroda | 0:13a5d365ba16 | 694 | * \tparam BlockRows number of rows in block as specified at compile-time |
ykuroda | 0:13a5d365ba16 | 695 | * \tparam BlockCols number of columns in block as specified at compile-time |
ykuroda | 0:13a5d365ba16 | 696 | * \param startRow the first row in the block |
ykuroda | 0:13a5d365ba16 | 697 | * \param startCol the first column in the block |
ykuroda | 0:13a5d365ba16 | 698 | * \param blockRows number of rows in block as specified at run-time |
ykuroda | 0:13a5d365ba16 | 699 | * \param blockCols number of columns in block as specified at run-time |
ykuroda | 0:13a5d365ba16 | 700 | * |
ykuroda | 0:13a5d365ba16 | 701 | * This function is mainly useful for blocks where the number of rows is specified at compile-time |
ykuroda | 0:13a5d365ba16 | 702 | * and the number of columns is specified at run-time, or vice versa. The compile-time and run-time |
ykuroda | 0:13a5d365ba16 | 703 | * information should not contradict. In other words, \a blockRows should equal \a BlockRows unless |
ykuroda | 0:13a5d365ba16 | 704 | * \a BlockRows is \a Dynamic, and the same for the number of columns. |
ykuroda | 0:13a5d365ba16 | 705 | * |
ykuroda | 0:13a5d365ba16 | 706 | * Example: \include MatrixBase_template_int_int_block_int_int_int_int.cpp |
ykuroda | 0:13a5d365ba16 | 707 | * Output: \verbinclude MatrixBase_template_int_int_block_int_int_int_int.cpp |
ykuroda | 0:13a5d365ba16 | 708 | * |
ykuroda | 0:13a5d365ba16 | 709 | * \sa class Block, block(Index,Index,Index,Index) |
ykuroda | 0:13a5d365ba16 | 710 | */ |
ykuroda | 0:13a5d365ba16 | 711 | template<int BlockRows, int BlockCols> |
ykuroda | 0:13a5d365ba16 | 712 | inline Block<Derived, BlockRows, BlockCols> block(Index startRow, Index startCol, |
ykuroda | 0:13a5d365ba16 | 713 | Index blockRows, Index blockCols) |
ykuroda | 0:13a5d365ba16 | 714 | { |
ykuroda | 0:13a5d365ba16 | 715 | return Block<Derived, BlockRows, BlockCols>(derived(), startRow, startCol, blockRows, blockCols); |
ykuroda | 0:13a5d365ba16 | 716 | } |
ykuroda | 0:13a5d365ba16 | 717 | |
ykuroda | 0:13a5d365ba16 | 718 | /** This is the const version of block<>(Index, Index, Index, Index). */ |
ykuroda | 0:13a5d365ba16 | 719 | template<int BlockRows, int BlockCols> |
ykuroda | 0:13a5d365ba16 | 720 | inline const Block<const Derived, BlockRows, BlockCols> block(Index startRow, Index startCol, |
ykuroda | 0:13a5d365ba16 | 721 | Index blockRows, Index blockCols) const |
ykuroda | 0:13a5d365ba16 | 722 | { |
ykuroda | 0:13a5d365ba16 | 723 | return Block<const Derived, BlockRows, BlockCols>(derived(), startRow, startCol, blockRows, blockCols); |
ykuroda | 0:13a5d365ba16 | 724 | } |
ykuroda | 0:13a5d365ba16 | 725 | |
ykuroda | 0:13a5d365ba16 | 726 | /** \returns an expression of the \a i-th column of *this. Note that the numbering starts at 0. |
ykuroda | 0:13a5d365ba16 | 727 | * |
ykuroda | 0:13a5d365ba16 | 728 | * Example: \include MatrixBase_col.cpp |
ykuroda | 0:13a5d365ba16 | 729 | * Output: \verbinclude MatrixBase_col.out |
ykuroda | 0:13a5d365ba16 | 730 | * |
ykuroda | 0:13a5d365ba16 | 731 | * \sa row(), class Block */ |
ykuroda | 0:13a5d365ba16 | 732 | inline ColXpr col(Index i) |
ykuroda | 0:13a5d365ba16 | 733 | { |
ykuroda | 0:13a5d365ba16 | 734 | return ColXpr(derived(), i); |
ykuroda | 0:13a5d365ba16 | 735 | } |
ykuroda | 0:13a5d365ba16 | 736 | |
ykuroda | 0:13a5d365ba16 | 737 | /** This is the const version of col(). */ |
ykuroda | 0:13a5d365ba16 | 738 | inline ConstColXpr col(Index i) const |
ykuroda | 0:13a5d365ba16 | 739 | { |
ykuroda | 0:13a5d365ba16 | 740 | return ConstColXpr(derived(), i); |
ykuroda | 0:13a5d365ba16 | 741 | } |
ykuroda | 0:13a5d365ba16 | 742 | |
ykuroda | 0:13a5d365ba16 | 743 | /** \returns an expression of the \a i-th row of *this. Note that the numbering starts at 0. |
ykuroda | 0:13a5d365ba16 | 744 | * |
ykuroda | 0:13a5d365ba16 | 745 | * Example: \include MatrixBase_row.cpp |
ykuroda | 0:13a5d365ba16 | 746 | * Output: \verbinclude MatrixBase_row.out |
ykuroda | 0:13a5d365ba16 | 747 | * |
ykuroda | 0:13a5d365ba16 | 748 | * \sa col(), class Block */ |
ykuroda | 0:13a5d365ba16 | 749 | inline RowXpr row(Index i) |
ykuroda | 0:13a5d365ba16 | 750 | { |
ykuroda | 0:13a5d365ba16 | 751 | return RowXpr(derived(), i); |
ykuroda | 0:13a5d365ba16 | 752 | } |
ykuroda | 0:13a5d365ba16 | 753 | |
ykuroda | 0:13a5d365ba16 | 754 | /** This is the const version of row(). */ |
ykuroda | 0:13a5d365ba16 | 755 | inline ConstRowXpr row(Index i) const |
ykuroda | 0:13a5d365ba16 | 756 | { |
ykuroda | 0:13a5d365ba16 | 757 | return ConstRowXpr(derived(), i); |
ykuroda | 0:13a5d365ba16 | 758 | } |
ykuroda | 0:13a5d365ba16 | 759 | |
ykuroda | 0:13a5d365ba16 | 760 | /** \returns a dynamic-size expression of a segment (i.e. a vector block) in *this. |
ykuroda | 0:13a5d365ba16 | 761 | * |
ykuroda | 0:13a5d365ba16 | 762 | * \only_for_vectors |
ykuroda | 0:13a5d365ba16 | 763 | * |
ykuroda | 0:13a5d365ba16 | 764 | * \param start the first coefficient in the segment |
ykuroda | 0:13a5d365ba16 | 765 | * \param n the number of coefficients in the segment |
ykuroda | 0:13a5d365ba16 | 766 | * |
ykuroda | 0:13a5d365ba16 | 767 | * Example: \include MatrixBase_segment_int_int.cpp |
ykuroda | 0:13a5d365ba16 | 768 | * Output: \verbinclude MatrixBase_segment_int_int.out |
ykuroda | 0:13a5d365ba16 | 769 | * |
ykuroda | 0:13a5d365ba16 | 770 | * \note Even though the returned expression has dynamic size, in the case |
ykuroda | 0:13a5d365ba16 | 771 | * when it is applied to a fixed-size vector, it inherits a fixed maximal size, |
ykuroda | 0:13a5d365ba16 | 772 | * which means that evaluating it does not cause a dynamic memory allocation. |
ykuroda | 0:13a5d365ba16 | 773 | * |
ykuroda | 0:13a5d365ba16 | 774 | * \sa class Block, segment(Index) |
ykuroda | 0:13a5d365ba16 | 775 | */ |
ykuroda | 0:13a5d365ba16 | 776 | inline SegmentReturnType segment(Index start, Index n) |
ykuroda | 0:13a5d365ba16 | 777 | { |
ykuroda | 0:13a5d365ba16 | 778 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) |
ykuroda | 0:13a5d365ba16 | 779 | return SegmentReturnType(derived(), start, n); |
ykuroda | 0:13a5d365ba16 | 780 | } |
ykuroda | 0:13a5d365ba16 | 781 | |
ykuroda | 0:13a5d365ba16 | 782 | |
ykuroda | 0:13a5d365ba16 | 783 | /** This is the const version of segment(Index,Index).*/ |
ykuroda | 0:13a5d365ba16 | 784 | inline ConstSegmentReturnType segment(Index start, Index n) const |
ykuroda | 0:13a5d365ba16 | 785 | { |
ykuroda | 0:13a5d365ba16 | 786 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) |
ykuroda | 0:13a5d365ba16 | 787 | return ConstSegmentReturnType(derived(), start, n); |
ykuroda | 0:13a5d365ba16 | 788 | } |
ykuroda | 0:13a5d365ba16 | 789 | |
ykuroda | 0:13a5d365ba16 | 790 | /** \returns a dynamic-size expression of the first coefficients of *this. |
ykuroda | 0:13a5d365ba16 | 791 | * |
ykuroda | 0:13a5d365ba16 | 792 | * \only_for_vectors |
ykuroda | 0:13a5d365ba16 | 793 | * |
ykuroda | 0:13a5d365ba16 | 794 | * \param n the number of coefficients in the segment |
ykuroda | 0:13a5d365ba16 | 795 | * |
ykuroda | 0:13a5d365ba16 | 796 | * Example: \include MatrixBase_start_int.cpp |
ykuroda | 0:13a5d365ba16 | 797 | * Output: \verbinclude MatrixBase_start_int.out |
ykuroda | 0:13a5d365ba16 | 798 | * |
ykuroda | 0:13a5d365ba16 | 799 | * \note Even though the returned expression has dynamic size, in the case |
ykuroda | 0:13a5d365ba16 | 800 | * when it is applied to a fixed-size vector, it inherits a fixed maximal size, |
ykuroda | 0:13a5d365ba16 | 801 | * which means that evaluating it does not cause a dynamic memory allocation. |
ykuroda | 0:13a5d365ba16 | 802 | * |
ykuroda | 0:13a5d365ba16 | 803 | * \sa class Block, block(Index,Index) |
ykuroda | 0:13a5d365ba16 | 804 | */ |
ykuroda | 0:13a5d365ba16 | 805 | inline SegmentReturnType head(Index n) |
ykuroda | 0:13a5d365ba16 | 806 | { |
ykuroda | 0:13a5d365ba16 | 807 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) |
ykuroda | 0:13a5d365ba16 | 808 | return SegmentReturnType(derived(), 0, n); |
ykuroda | 0:13a5d365ba16 | 809 | } |
ykuroda | 0:13a5d365ba16 | 810 | |
ykuroda | 0:13a5d365ba16 | 811 | /** This is the const version of head(Index).*/ |
ykuroda | 0:13a5d365ba16 | 812 | inline ConstSegmentReturnType head(Index n) const |
ykuroda | 0:13a5d365ba16 | 813 | { |
ykuroda | 0:13a5d365ba16 | 814 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) |
ykuroda | 0:13a5d365ba16 | 815 | return ConstSegmentReturnType(derived(), 0, n); |
ykuroda | 0:13a5d365ba16 | 816 | } |
ykuroda | 0:13a5d365ba16 | 817 | |
ykuroda | 0:13a5d365ba16 | 818 | /** \returns a dynamic-size expression of the last coefficients of *this. |
ykuroda | 0:13a5d365ba16 | 819 | * |
ykuroda | 0:13a5d365ba16 | 820 | * \only_for_vectors |
ykuroda | 0:13a5d365ba16 | 821 | * |
ykuroda | 0:13a5d365ba16 | 822 | * \param n the number of coefficients in the segment |
ykuroda | 0:13a5d365ba16 | 823 | * |
ykuroda | 0:13a5d365ba16 | 824 | * Example: \include MatrixBase_end_int.cpp |
ykuroda | 0:13a5d365ba16 | 825 | * Output: \verbinclude MatrixBase_end_int.out |
ykuroda | 0:13a5d365ba16 | 826 | * |
ykuroda | 0:13a5d365ba16 | 827 | * \note Even though the returned expression has dynamic size, in the case |
ykuroda | 0:13a5d365ba16 | 828 | * when it is applied to a fixed-size vector, it inherits a fixed maximal size, |
ykuroda | 0:13a5d365ba16 | 829 | * which means that evaluating it does not cause a dynamic memory allocation. |
ykuroda | 0:13a5d365ba16 | 830 | * |
ykuroda | 0:13a5d365ba16 | 831 | * \sa class Block, block(Index,Index) |
ykuroda | 0:13a5d365ba16 | 832 | */ |
ykuroda | 0:13a5d365ba16 | 833 | inline SegmentReturnType tail(Index n) |
ykuroda | 0:13a5d365ba16 | 834 | { |
ykuroda | 0:13a5d365ba16 | 835 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) |
ykuroda | 0:13a5d365ba16 | 836 | return SegmentReturnType(derived(), this->size() - n, n); |
ykuroda | 0:13a5d365ba16 | 837 | } |
ykuroda | 0:13a5d365ba16 | 838 | |
ykuroda | 0:13a5d365ba16 | 839 | /** This is the const version of tail(Index).*/ |
ykuroda | 0:13a5d365ba16 | 840 | inline ConstSegmentReturnType tail(Index n) const |
ykuroda | 0:13a5d365ba16 | 841 | { |
ykuroda | 0:13a5d365ba16 | 842 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) |
ykuroda | 0:13a5d365ba16 | 843 | return ConstSegmentReturnType(derived(), this->size() - n, n); |
ykuroda | 0:13a5d365ba16 | 844 | } |
ykuroda | 0:13a5d365ba16 | 845 | |
ykuroda | 0:13a5d365ba16 | 846 | /** \returns a fixed-size expression of a segment (i.e. a vector block) in \c *this |
ykuroda | 0:13a5d365ba16 | 847 | * |
ykuroda | 0:13a5d365ba16 | 848 | * \only_for_vectors |
ykuroda | 0:13a5d365ba16 | 849 | * |
ykuroda | 0:13a5d365ba16 | 850 | * \tparam N the number of coefficients in the segment as specified at compile-time |
ykuroda | 0:13a5d365ba16 | 851 | * \param start the index of the first element in the segment |
ykuroda | 0:13a5d365ba16 | 852 | * \param n the number of coefficients in the segment as specified at compile-time |
ykuroda | 0:13a5d365ba16 | 853 | * |
ykuroda | 0:13a5d365ba16 | 854 | * The compile-time and run-time information should not contradict. In other words, |
ykuroda | 0:13a5d365ba16 | 855 | * \a n should equal \a N unless \a N is \a Dynamic. |
ykuroda | 0:13a5d365ba16 | 856 | * |
ykuroda | 0:13a5d365ba16 | 857 | * Example: \include MatrixBase_template_int_segment.cpp |
ykuroda | 0:13a5d365ba16 | 858 | * Output: \verbinclude MatrixBase_template_int_segment.out |
ykuroda | 0:13a5d365ba16 | 859 | * |
ykuroda | 0:13a5d365ba16 | 860 | * \sa class Block |
ykuroda | 0:13a5d365ba16 | 861 | */ |
ykuroda | 0:13a5d365ba16 | 862 | template<int N> |
ykuroda | 0:13a5d365ba16 | 863 | inline typename FixedSegmentReturnType<N>::Type segment(Index start, Index n = N) |
ykuroda | 0:13a5d365ba16 | 864 | { |
ykuroda | 0:13a5d365ba16 | 865 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) |
ykuroda | 0:13a5d365ba16 | 866 | return typename FixedSegmentReturnType<N>::Type(derived(), start, n); |
ykuroda | 0:13a5d365ba16 | 867 | } |
ykuroda | 0:13a5d365ba16 | 868 | |
ykuroda | 0:13a5d365ba16 | 869 | /** This is the const version of segment<int>(Index).*/ |
ykuroda | 0:13a5d365ba16 | 870 | template<int N> |
ykuroda | 0:13a5d365ba16 | 871 | inline typename ConstFixedSegmentReturnType<N>::Type segment(Index start, Index n = N) const |
ykuroda | 0:13a5d365ba16 | 872 | { |
ykuroda | 0:13a5d365ba16 | 873 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) |
ykuroda | 0:13a5d365ba16 | 874 | return typename ConstFixedSegmentReturnType<N>::Type(derived(), start, n); |
ykuroda | 0:13a5d365ba16 | 875 | } |
ykuroda | 0:13a5d365ba16 | 876 | |
ykuroda | 0:13a5d365ba16 | 877 | /** \returns a fixed-size expression of the first coefficients of *this. |
ykuroda | 0:13a5d365ba16 | 878 | * |
ykuroda | 0:13a5d365ba16 | 879 | * \only_for_vectors |
ykuroda | 0:13a5d365ba16 | 880 | * |
ykuroda | 0:13a5d365ba16 | 881 | * \tparam N the number of coefficients in the segment as specified at compile-time |
ykuroda | 0:13a5d365ba16 | 882 | * \param n the number of coefficients in the segment as specified at run-time |
ykuroda | 0:13a5d365ba16 | 883 | * |
ykuroda | 0:13a5d365ba16 | 884 | * The compile-time and run-time information should not contradict. In other words, |
ykuroda | 0:13a5d365ba16 | 885 | * \a n should equal \a N unless \a N is \a Dynamic. |
ykuroda | 0:13a5d365ba16 | 886 | * |
ykuroda | 0:13a5d365ba16 | 887 | * Example: \include MatrixBase_template_int_start.cpp |
ykuroda | 0:13a5d365ba16 | 888 | * Output: \verbinclude MatrixBase_template_int_start.out |
ykuroda | 0:13a5d365ba16 | 889 | * |
ykuroda | 0:13a5d365ba16 | 890 | * \sa class Block |
ykuroda | 0:13a5d365ba16 | 891 | */ |
ykuroda | 0:13a5d365ba16 | 892 | template<int N> |
ykuroda | 0:13a5d365ba16 | 893 | inline typename FixedSegmentReturnType<N>::Type head(Index n = N) |
ykuroda | 0:13a5d365ba16 | 894 | { |
ykuroda | 0:13a5d365ba16 | 895 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) |
ykuroda | 0:13a5d365ba16 | 896 | return typename FixedSegmentReturnType<N>::Type(derived(), 0, n); |
ykuroda | 0:13a5d365ba16 | 897 | } |
ykuroda | 0:13a5d365ba16 | 898 | |
ykuroda | 0:13a5d365ba16 | 899 | /** This is the const version of head<int>().*/ |
ykuroda | 0:13a5d365ba16 | 900 | template<int N> |
ykuroda | 0:13a5d365ba16 | 901 | inline typename ConstFixedSegmentReturnType<N>::Type head(Index n = N) const |
ykuroda | 0:13a5d365ba16 | 902 | { |
ykuroda | 0:13a5d365ba16 | 903 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) |
ykuroda | 0:13a5d365ba16 | 904 | return typename ConstFixedSegmentReturnType<N>::Type(derived(), 0, n); |
ykuroda | 0:13a5d365ba16 | 905 | } |
ykuroda | 0:13a5d365ba16 | 906 | |
ykuroda | 0:13a5d365ba16 | 907 | /** \returns a fixed-size expression of the last coefficients of *this. |
ykuroda | 0:13a5d365ba16 | 908 | * |
ykuroda | 0:13a5d365ba16 | 909 | * \only_for_vectors |
ykuroda | 0:13a5d365ba16 | 910 | * |
ykuroda | 0:13a5d365ba16 | 911 | * \tparam N the number of coefficients in the segment as specified at compile-time |
ykuroda | 0:13a5d365ba16 | 912 | * \param n the number of coefficients in the segment as specified at run-time |
ykuroda | 0:13a5d365ba16 | 913 | * |
ykuroda | 0:13a5d365ba16 | 914 | * The compile-time and run-time information should not contradict. In other words, |
ykuroda | 0:13a5d365ba16 | 915 | * \a n should equal \a N unless \a N is \a Dynamic. |
ykuroda | 0:13a5d365ba16 | 916 | * |
ykuroda | 0:13a5d365ba16 | 917 | * Example: \include MatrixBase_template_int_end.cpp |
ykuroda | 0:13a5d365ba16 | 918 | * Output: \verbinclude MatrixBase_template_int_end.out |
ykuroda | 0:13a5d365ba16 | 919 | * |
ykuroda | 0:13a5d365ba16 | 920 | * \sa class Block |
ykuroda | 0:13a5d365ba16 | 921 | */ |
ykuroda | 0:13a5d365ba16 | 922 | template<int N> |
ykuroda | 0:13a5d365ba16 | 923 | inline typename FixedSegmentReturnType<N>::Type tail(Index n = N) |
ykuroda | 0:13a5d365ba16 | 924 | { |
ykuroda | 0:13a5d365ba16 | 925 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) |
ykuroda | 0:13a5d365ba16 | 926 | return typename FixedSegmentReturnType<N>::Type(derived(), size() - n); |
ykuroda | 0:13a5d365ba16 | 927 | } |
ykuroda | 0:13a5d365ba16 | 928 | |
ykuroda | 0:13a5d365ba16 | 929 | /** This is the const version of tail<int>.*/ |
ykuroda | 0:13a5d365ba16 | 930 | template<int N> |
ykuroda | 0:13a5d365ba16 | 931 | inline typename ConstFixedSegmentReturnType<N>::Type tail(Index n = N) const |
ykuroda | 0:13a5d365ba16 | 932 | { |
ykuroda | 0:13a5d365ba16 | 933 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) |
ykuroda | 0:13a5d365ba16 | 934 | return typename ConstFixedSegmentReturnType<N>::Type(derived(), size() - n); |
ykuroda | 0:13a5d365ba16 | 935 | } |