00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef EIGEN_BLOCKMETHODS_H
00027 #define EIGEN_BLOCKMETHODS_H
00028
00029 #ifndef EIGEN_PARSED_BY_DOXYGEN
00030
00032 typedef Block<Derived, internal::traits<Derived>::RowsAtCompileTime, 1, !IsRowMajor> ColXpr;
00033 typedef const Block<const Derived, internal::traits<Derived>::RowsAtCompileTime, 1, !IsRowMajor> ConstColXpr;
00035 typedef Block<Derived, 1, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> RowXpr;
00036 typedef const Block<const Derived, 1, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> ConstRowXpr;
00038 typedef Block<Derived, internal::traits<Derived>::RowsAtCompileTime, Dynamic, !IsRowMajor> ColsBlockXpr;
00039 typedef const Block<const Derived, internal::traits<Derived>::RowsAtCompileTime, Dynamic, !IsRowMajor> ConstColsBlockXpr;
00041 typedef Block<Derived, Dynamic, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> RowsBlockXpr;
00042 typedef const Block<const Derived, Dynamic, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> ConstRowsBlockXpr;
00044 template<int N> struct NColsBlockXpr { typedef Block<Derived, internal::traits<Derived>::RowsAtCompileTime, N, !IsRowMajor> Type; };
00045 template<int N> struct ConstNColsBlockXpr { typedef const Block<const Derived, internal::traits<Derived>::RowsAtCompileTime, N, !IsRowMajor> Type; };
00047 template<int N> struct NRowsBlockXpr { typedef Block<Derived, N, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> Type; };
00048 template<int N> struct ConstNRowsBlockXpr { typedef const Block<const Derived, N, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> Type; };
00049
00050
00051 #endif // not EIGEN_PARSED_BY_DOXYGEN
00052
00069 inline Block<Derived> block(Index startRow, Index startCol, Index blockRows, Index blockCols)
00070 {
00071 return Block<Derived>(derived(), startRow, startCol, blockRows, blockCols);
00072 }
00073
00075 inline const Block<const Derived> block(Index startRow, Index startCol, Index blockRows, Index blockCols) const
00076 {
00077 return Block<const Derived>(derived(), startRow, startCol, blockRows, blockCols);
00078 }
00079
00080
00081
00082
00093 inline Block<Derived> topRightCorner(Index cRows, Index cCols)
00094 {
00095 return Block<Derived>(derived(), 0, cols() - cCols, cRows, cCols);
00096 }
00097
00099 inline const Block<const Derived> topRightCorner(Index cRows, Index cCols) const
00100 {
00101 return Block<const Derived>(derived(), 0, cols() - cCols, cRows, cCols);
00102 }
00103
00113 template<int CRows, int CCols>
00114 inline Block<Derived, CRows, CCols> topRightCorner()
00115 {
00116 return Block<Derived, CRows, CCols>(derived(), 0, cols() - CCols);
00117 }
00118
00120 template<int CRows, int CCols>
00121 inline const Block<const Derived, CRows, CCols> topRightCorner() const
00122 {
00123 return Block<const Derived, CRows, CCols>(derived(), 0, cols() - CCols);
00124 }
00125
00126
00127
00128
00139 inline Block<Derived> topLeftCorner(Index cRows, Index cCols)
00140 {
00141 return Block<Derived>(derived(), 0, 0, cRows, cCols);
00142 }
00143
00145 inline const Block<const Derived> topLeftCorner(Index cRows, Index cCols) const
00146 {
00147 return Block<const Derived>(derived(), 0, 0, cRows, cCols);
00148 }
00149
00159 template<int CRows, int CCols>
00160 inline Block<Derived, CRows, CCols> topLeftCorner()
00161 {
00162 return Block<Derived, CRows, CCols>(derived(), 0, 0);
00163 }
00164
00166 template<int CRows, int CCols>
00167 inline const Block<const Derived, CRows, CCols> topLeftCorner() const
00168 {
00169 return Block<const Derived, CRows, CCols>(derived(), 0, 0);
00170 }
00171
00172
00173
00184 inline Block<Derived> bottomRightCorner(Index cRows, Index cCols)
00185 {
00186 return Block<Derived>(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
00187 }
00188
00190 inline const Block<const Derived> bottomRightCorner(Index cRows, Index cCols) const
00191 {
00192 return Block<const Derived>(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
00193 }
00194
00204 template<int CRows, int CCols>
00205 inline Block<Derived, CRows, CCols> bottomRightCorner()
00206 {
00207 return Block<Derived, CRows, CCols>(derived(), rows() - CRows, cols() - CCols);
00208 }
00209
00211 template<int CRows, int CCols>
00212 inline const Block<const Derived, CRows, CCols> bottomRightCorner() const
00213 {
00214 return Block<const Derived, CRows, CCols>(derived(), rows() - CRows, cols() - CCols);
00215 }
00216
00217
00218
00229 inline Block<Derived> bottomLeftCorner(Index cRows, Index cCols)
00230 {
00231 return Block<Derived>(derived(), rows() - cRows, 0, cRows, cCols);
00232 }
00233
00235 inline const Block<const Derived> bottomLeftCorner(Index cRows, Index cCols) const
00236 {
00237 return Block<const Derived>(derived(), rows() - cRows, 0, cRows, cCols);
00238 }
00239
00249 template<int CRows, int CCols>
00250 inline Block<Derived, CRows, CCols> bottomLeftCorner()
00251 {
00252 return Block<Derived, CRows, CCols>(derived(), rows() - CRows, 0);
00253 }
00254
00256 template<int CRows, int CCols>
00257 inline const Block<const Derived, CRows, CCols> bottomLeftCorner() const
00258 {
00259 return Block<const Derived, CRows, CCols>(derived(), rows() - CRows, 0);
00260 }
00261
00262
00263
00273 inline RowsBlockXpr topRows(Index n)
00274 {
00275 return RowsBlockXpr(derived(), 0, 0, n, cols());
00276 }
00277
00279 inline ConstRowsBlockXpr topRows(Index n) const
00280 {
00281 return ConstRowsBlockXpr(derived(), 0, 0, n, cols());
00282 }
00283
00293 template<int N>
00294 inline typename NRowsBlockXpr<N>::Type topRows()
00295 {
00296 return typename NRowsBlockXpr<N>::Type(derived(), 0, 0, N, cols());
00297 }
00298
00300 template<int N>
00301 inline typename ConstNRowsBlockXpr<N>::Type topRows() const
00302 {
00303 return typename ConstNRowsBlockXpr<N>::Type(derived(), 0, 0, N, cols());
00304 }
00305
00306
00307
00317 inline RowsBlockXpr bottomRows(Index n)
00318 {
00319 return RowsBlockXpr(derived(), rows() - n, 0, n, cols());
00320 }
00321
00323 inline ConstRowsBlockXpr bottomRows(Index n) const
00324 {
00325 return ConstRowsBlockXpr(derived(), rows() - n, 0, n, cols());
00326 }
00327
00337 template<int N>
00338 inline typename NRowsBlockXpr<N>::Type bottomRows()
00339 {
00340 return typename NRowsBlockXpr<N>::Type(derived(), rows() - N, 0, N, cols());
00341 }
00342
00344 template<int N>
00345 inline typename ConstNRowsBlockXpr<N>::Type bottomRows() const
00346 {
00347 return typename ConstNRowsBlockXpr<N>::Type(derived(), rows() - N, 0, N, cols());
00348 }
00349
00350
00351
00362 inline RowsBlockXpr middleRows(Index startRow, Index numRows)
00363 {
00364 return RowsBlockXpr(derived(), startRow, 0, numRows, cols());
00365 }
00366
00368 inline ConstRowsBlockXpr middleRows(Index startRow, Index numRows) const
00369 {
00370 return ConstRowsBlockXpr(derived(), startRow, 0, numRows, cols());
00371 }
00372
00383 template<int N>
00384 inline typename NRowsBlockXpr<N>::Type middleRows(Index startRow)
00385 {
00386 return typename NRowsBlockXpr<N>::Type(derived(), startRow, 0, N, cols());
00387 }
00388
00390 template<int N>
00391 inline typename ConstNRowsBlockXpr<N>::Type middleRows(Index startRow) const
00392 {
00393 return typename ConstNRowsBlockXpr<N>::Type(derived(), startRow, 0, N, cols());
00394 }
00395
00396
00397
00407 inline ColsBlockXpr leftCols(Index n)
00408 {
00409 return ColsBlockXpr(derived(), 0, 0, rows(), n);
00410 }
00411
00413 inline ConstColsBlockXpr leftCols(Index n) const
00414 {
00415 return ConstColsBlockXpr(derived(), 0, 0, rows(), n);
00416 }
00417
00427 template<int N>
00428 inline typename NColsBlockXpr<N>::Type leftCols()
00429 {
00430 return typename NColsBlockXpr<N>::Type(derived(), 0, 0, rows(), N);
00431 }
00432
00434 template<int N>
00435 inline typename ConstNColsBlockXpr<N>::Type leftCols() const
00436 {
00437 return typename ConstNColsBlockXpr<N>::Type(derived(), 0, 0, rows(), N);
00438 }
00439
00440
00441
00451 inline ColsBlockXpr rightCols(Index n)
00452 {
00453 return ColsBlockXpr(derived(), 0, cols() - n, rows(), n);
00454 }
00455
00457 inline ConstColsBlockXpr rightCols(Index n) const
00458 {
00459 return ConstColsBlockXpr(derived(), 0, cols() - n, rows(), n);
00460 }
00461
00471 template<int N>
00472 inline typename NColsBlockXpr<N>::Type rightCols()
00473 {
00474 return typename NColsBlockXpr<N>::Type(derived(), 0, cols() - N, rows(), N);
00475 }
00476
00478 template<int N>
00479 inline typename ConstNColsBlockXpr<N>::Type rightCols() const
00480 {
00481 return typename ConstNColsBlockXpr<N>::Type(derived(), 0, cols() - N, rows(), N);
00482 }
00483
00484
00485
00496 inline ColsBlockXpr middleCols(Index startCol, Index numCols)
00497 {
00498 return ColsBlockXpr(derived(), 0, startCol, rows(), numCols);
00499 }
00500
00502 inline ConstColsBlockXpr middleCols(Index startCol, Index numCols) const
00503 {
00504 return ConstColsBlockXpr(derived(), 0, startCol, rows(), numCols);
00505 }
00506
00517 template<int N>
00518 inline typename NColsBlockXpr<N>::Type middleCols(Index startCol)
00519 {
00520 return typename NColsBlockXpr<N>::Type(derived(), 0, startCol, rows(), N);
00521 }
00522
00524 template<int N>
00525 inline typename ConstNColsBlockXpr<N>::Type middleCols(Index startCol) const
00526 {
00527 return typename ConstNColsBlockXpr<N>::Type(derived(), 0, startCol, rows(), N);
00528 }
00529
00530
00531
00548 template<int BlockRows, int BlockCols>
00549 inline Block<Derived, BlockRows, BlockCols> block(Index startRow, Index startCol)
00550 {
00551 return Block<Derived, BlockRows, BlockCols>(derived(), startRow, startCol);
00552 }
00553
00555 template<int BlockRows, int BlockCols>
00556 inline const Block<const Derived, BlockRows, BlockCols> block(Index startRow, Index startCol) const
00557 {
00558 return Block<const Derived, BlockRows, BlockCols>(derived(), startRow, startCol);
00559 }
00560
00567 inline ColXpr col(Index i)
00568 {
00569 return ColXpr(derived(), i);
00570 }
00571
00573 inline ConstColXpr col(Index i) const
00574 {
00575 return ConstColXpr(derived(), i);
00576 }
00577
00584 inline RowXpr row(Index i)
00585 {
00586 return RowXpr(derived(), i);
00587 }
00588
00590 inline ConstRowXpr row(Index i) const
00591 {
00592 return ConstRowXpr(derived(), i);
00593 }
00594
00595 #endif // EIGEN_BLOCKMETHODS_H