BlockMethods.h
Go to the documentation of this file.
00001 // This file is part of Eigen, a lightweight C++ template library
00002 // for linear algebra.
00003 //
00004 // Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud@inria.fr>
00005 // Copyright (C) 2006-2010 Benoit Jacob <jacob.benoit.1@gmail.com>
00006 //
00007 // This Source Code Form is subject to the terms of the Mozilla
00008 // Public License v. 2.0. If a copy of the MPL was not distributed
00009 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
00010 
00011 
00012 #ifndef EIGEN_PARSED_BY_DOXYGEN
00013 
00015 typedef Block<Derived, internal::traits<Derived>::RowsAtCompileTime, 1, !IsRowMajor> ColXpr;
00016 typedef const Block<const Derived, internal::traits<Derived>::RowsAtCompileTime, 1, !IsRowMajor> ConstColXpr;
00018 typedef Block<Derived, 1, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> RowXpr;
00019 typedef const Block<const Derived, 1, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> ConstRowXpr;
00021 typedef Block<Derived, internal::traits<Derived>::RowsAtCompileTime, Dynamic, !IsRowMajor> ColsBlockXpr;
00022 typedef const Block<const Derived, internal::traits<Derived>::RowsAtCompileTime, Dynamic, !IsRowMajor> ConstColsBlockXpr;
00024 typedef Block<Derived, Dynamic, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> RowsBlockXpr;
00025 typedef const Block<const Derived, Dynamic, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> ConstRowsBlockXpr;
00027 template<int N> struct NColsBlockXpr { typedef Block<Derived, internal::traits<Derived>::RowsAtCompileTime, N, !IsRowMajor> Type; };
00028 template<int N> struct ConstNColsBlockXpr { typedef const Block<const Derived, internal::traits<Derived>::RowsAtCompileTime, N, !IsRowMajor> Type; };
00030 template<int N> struct NRowsBlockXpr { typedef Block<Derived, N, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> Type; };
00031 template<int N> struct ConstNRowsBlockXpr { typedef const Block<const Derived, N, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> Type; };
00032 
00033 typedef VectorBlock<Derived> SegmentReturnType;
00034 typedef const VectorBlock<const Derived> ConstSegmentReturnType;
00035 template<int Size> struct FixedSegmentReturnType { typedef VectorBlock<Derived, Size> Type; };
00036 template<int Size> struct ConstFixedSegmentReturnType { typedef const VectorBlock<const Derived, Size> Type; };
00037 
00038 #endif // not EIGEN_PARSED_BY_DOXYGEN
00039 
00056 inline Block<Derived> block(Index startRow, Index startCol, Index blockRows, Index blockCols)
00057 {
00058   return Block<Derived>(derived(), startRow, startCol, blockRows, blockCols);
00059 }
00060 
00062 inline const Block<const Derived> block(Index startRow, Index startCol, Index blockRows, Index blockCols) const
00063 {
00064   return Block<const Derived>(derived(), startRow, startCol, blockRows, blockCols);
00065 }
00066 
00067 
00068 
00069 
00080 inline Block<Derived> topRightCorner(Index cRows, Index cCols)
00081 {
00082   return Block<Derived>(derived(), 0, cols() - cCols, cRows, cCols);
00083 }
00084 
00086 inline const Block<const Derived> topRightCorner(Index cRows, Index cCols) const
00087 {
00088   return Block<const Derived>(derived(), 0, cols() - cCols, cRows, cCols);
00089 }
00090 
00101 template<int CRows, int CCols>
00102 inline Block<Derived, CRows, CCols> topRightCorner()
00103 {
00104   return Block<Derived, CRows, CCols>(derived(), 0, cols() - CCols);
00105 }
00106 
00108 template<int CRows, int CCols>
00109 inline const Block<const Derived, CRows, CCols> topRightCorner() const
00110 {
00111   return Block<const Derived, CRows, CCols>(derived(), 0, cols() - CCols);
00112 }
00113 
00131 template<int CRows, int CCols>
00132 inline Block<Derived, CRows, CCols> topRightCorner(Index cRows, Index cCols)
00133 {
00134   return Block<Derived, CRows, CCols>(derived(), 0, cols() - cCols, cRows, cCols);
00135 }
00136 
00138 template<int CRows, int CCols>
00139 inline const Block<const Derived, CRows, CCols> topRightCorner(Index cRows, Index cCols) const
00140 {
00141   return Block<const Derived, CRows, CCols>(derived(), 0, cols() - cCols, cRows, cCols);
00142 }
00143 
00144 
00145 
00156 inline Block<Derived> topLeftCorner(Index cRows, Index cCols)
00157 {
00158   return Block<Derived>(derived(), 0, 0, cRows, cCols);
00159 }
00160 
00162 inline const Block<const Derived> topLeftCorner(Index cRows, Index cCols) const
00163 {
00164   return Block<const Derived>(derived(), 0, 0, cRows, cCols);
00165 }
00166 
00176 template<int CRows, int CCols>
00177 inline Block<Derived, CRows, CCols> topLeftCorner()
00178 {
00179   return Block<Derived, CRows, CCols>(derived(), 0, 0);
00180 }
00181 
00183 template<int CRows, int CCols>
00184 inline const Block<const Derived, CRows, CCols> topLeftCorner() const
00185 {
00186   return Block<const Derived, CRows, CCols>(derived(), 0, 0);
00187 }
00188 
00206 template<int CRows, int CCols>
00207 inline Block<Derived, CRows, CCols> topLeftCorner(Index cRows, Index cCols)
00208 {
00209   return Block<Derived, CRows, CCols>(derived(), 0, 0, cRows, cCols);
00210 }
00211 
00213 template<int CRows, int CCols>
00214 inline const Block<const Derived, CRows, CCols> topLeftCorner(Index cRows, Index cCols) const
00215 {
00216   return Block<const Derived, CRows, CCols>(derived(), 0, 0, cRows, cCols);
00217 }
00218 
00219 
00220 
00231 inline Block<Derived> bottomRightCorner(Index cRows, Index cCols)
00232 {
00233   return Block<Derived>(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
00234 }
00235 
00237 inline const Block<const Derived> bottomRightCorner(Index cRows, Index cCols) const
00238 {
00239   return Block<const Derived>(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
00240 }
00241 
00251 template<int CRows, int CCols>
00252 inline Block<Derived, CRows, CCols> bottomRightCorner()
00253 {
00254   return Block<Derived, CRows, CCols>(derived(), rows() - CRows, cols() - CCols);
00255 }
00256 
00258 template<int CRows, int CCols>
00259 inline const Block<const Derived, CRows, CCols> bottomRightCorner() const
00260 {
00261   return Block<const Derived, CRows, CCols>(derived(), rows() - CRows, cols() - CCols);
00262 }
00263 
00281 template<int CRows, int CCols>
00282 inline Block<Derived, CRows, CCols> bottomRightCorner(Index cRows, Index cCols)
00283 {
00284   return Block<Derived, CRows, CCols>(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
00285 }
00286 
00288 template<int CRows, int CCols>
00289 inline const Block<const Derived, CRows, CCols> bottomRightCorner(Index cRows, Index cCols) const
00290 {
00291   return Block<const Derived, CRows, CCols>(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
00292 }
00293 
00294 
00295 
00306 inline Block<Derived> bottomLeftCorner(Index cRows, Index cCols)
00307 {
00308   return Block<Derived>(derived(), rows() - cRows, 0, cRows, cCols);
00309 }
00310 
00312 inline const Block<const Derived> bottomLeftCorner(Index cRows, Index cCols) const
00313 {
00314   return Block<const Derived>(derived(), rows() - cRows, 0, cRows, cCols);
00315 }
00316 
00326 template<int CRows, int CCols>
00327 inline Block<Derived, CRows, CCols> bottomLeftCorner()
00328 {
00329   return Block<Derived, CRows, CCols>(derived(), rows() - CRows, 0);
00330 }
00331 
00333 template<int CRows, int CCols>
00334 inline const Block<const Derived, CRows, CCols> bottomLeftCorner() const
00335 {
00336   return Block<const Derived, CRows, CCols>(derived(), rows() - CRows, 0);
00337 }
00338 
00356 template<int CRows, int CCols>
00357 inline Block<Derived, CRows, CCols> bottomLeftCorner(Index cRows, Index cCols)
00358 {
00359   return Block<Derived, CRows, CCols>(derived(), rows() - cRows, 0, cRows, cCols);
00360 }
00361 
00363 template<int CRows, int CCols>
00364 inline const Block<const Derived, CRows, CCols> bottomLeftCorner(Index cRows, Index cCols) const
00365 {
00366   return Block<const Derived, CRows, CCols>(derived(), rows() - cRows, 0, cRows, cCols);
00367 }
00368 
00369 
00370 
00380 inline RowsBlockXpr topRows(Index n)
00381 {
00382   return RowsBlockXpr(derived(), 0, 0, n, cols());
00383 }
00384 
00386 inline ConstRowsBlockXpr topRows(Index n) const
00387 {
00388   return ConstRowsBlockXpr(derived(), 0, 0, n, cols());
00389 }
00390 
00400 template<int N>
00401 inline typename NRowsBlockXpr<N>::Type topRows()
00402 {
00403   return typename NRowsBlockXpr<N>::Type(derived(), 0, 0, N, cols());
00404 }
00405 
00407 template<int N>
00408 inline typename ConstNRowsBlockXpr<N>::Type topRows() const
00409 {
00410   return typename ConstNRowsBlockXpr<N>::Type(derived(), 0, 0, N, cols());
00411 }
00412 
00413 
00414 
00424 inline RowsBlockXpr bottomRows(Index n)
00425 {
00426   return RowsBlockXpr(derived(), rows() - n, 0, n, cols());
00427 }
00428 
00430 inline ConstRowsBlockXpr bottomRows(Index n) const
00431 {
00432   return ConstRowsBlockXpr(derived(), rows() - n, 0, n, cols());
00433 }
00434 
00444 template<int N>
00445 inline typename NRowsBlockXpr<N>::Type bottomRows()
00446 {
00447   return typename NRowsBlockXpr<N>::Type(derived(), rows() - N, 0, N, cols());
00448 }
00449 
00451 template<int N>
00452 inline typename ConstNRowsBlockXpr<N>::Type bottomRows() const
00453 {
00454   return typename ConstNRowsBlockXpr<N>::Type(derived(), rows() - N, 0, N, cols());
00455 }
00456 
00457 
00458 
00469 inline RowsBlockXpr middleRows(Index startRow, Index numRows)
00470 {
00471   return RowsBlockXpr(derived(), startRow, 0, numRows, cols());
00472 }
00473 
00475 inline ConstRowsBlockXpr middleRows(Index startRow, Index numRows) const
00476 {
00477   return ConstRowsBlockXpr(derived(), startRow, 0, numRows, cols());
00478 }
00479 
00490 template<int N>
00491 inline typename NRowsBlockXpr<N>::Type middleRows(Index startRow)
00492 {
00493   return typename NRowsBlockXpr<N>::Type(derived(), startRow, 0, N, cols());
00494 }
00495 
00497 template<int N>
00498 inline typename ConstNRowsBlockXpr<N>::Type middleRows(Index startRow) const
00499 {
00500   return typename ConstNRowsBlockXpr<N>::Type(derived(), startRow, 0, N, cols());
00501 }
00502 
00503 
00504 
00514 inline ColsBlockXpr leftCols(Index n)
00515 {
00516   return ColsBlockXpr(derived(), 0, 0, rows(), n);
00517 }
00518 
00520 inline ConstColsBlockXpr leftCols(Index n) const
00521 {
00522   return ConstColsBlockXpr(derived(), 0, 0, rows(), n);
00523 }
00524 
00534 template<int N>
00535 inline typename NColsBlockXpr<N>::Type leftCols()
00536 {
00537   return typename NColsBlockXpr<N>::Type(derived(), 0, 0, rows(), N);
00538 }
00539 
00541 template<int N>
00542 inline typename ConstNColsBlockXpr<N>::Type leftCols() const
00543 {
00544   return typename ConstNColsBlockXpr<N>::Type(derived(), 0, 0, rows(), N);
00545 }
00546 
00547 
00548 
00558 inline ColsBlockXpr rightCols(Index n)
00559 {
00560   return ColsBlockXpr(derived(), 0, cols() - n, rows(), n);
00561 }
00562 
00564 inline ConstColsBlockXpr rightCols(Index n) const
00565 {
00566   return ConstColsBlockXpr(derived(), 0, cols() - n, rows(), n);
00567 }
00568 
00578 template<int N>
00579 inline typename NColsBlockXpr<N>::Type rightCols()
00580 {
00581   return typename NColsBlockXpr<N>::Type(derived(), 0, cols() - N, rows(), N);
00582 }
00583 
00585 template<int N>
00586 inline typename ConstNColsBlockXpr<N>::Type rightCols() const
00587 {
00588   return typename ConstNColsBlockXpr<N>::Type(derived(), 0, cols() - N, rows(), N);
00589 }
00590 
00591 
00592 
00603 inline ColsBlockXpr middleCols(Index startCol, Index numCols)
00604 {
00605   return ColsBlockXpr(derived(), 0, startCol, rows(), numCols);
00606 }
00607 
00609 inline ConstColsBlockXpr middleCols(Index startCol, Index numCols) const
00610 {
00611   return ConstColsBlockXpr(derived(), 0, startCol, rows(), numCols);
00612 }
00613 
00624 template<int N>
00625 inline typename NColsBlockXpr<N>::Type middleCols(Index startCol)
00626 {
00627   return typename NColsBlockXpr<N>::Type(derived(), 0, startCol, rows(), N);
00628 }
00629 
00631 template<int N>
00632 inline typename ConstNColsBlockXpr<N>::Type middleCols(Index startCol) const
00633 {
00634   return typename ConstNColsBlockXpr<N>::Type(derived(), 0, startCol, rows(), N);
00635 }
00636 
00637 
00638 
00655 template<int BlockRows, int BlockCols>
00656 inline Block<Derived, BlockRows, BlockCols> block(Index startRow, Index startCol)
00657 {
00658   return Block<Derived, BlockRows, BlockCols>(derived(), startRow, startCol);
00659 }
00660 
00662 template<int BlockRows, int BlockCols>
00663 inline const Block<const Derived, BlockRows, BlockCols> block(Index startRow, Index startCol) const
00664 {
00665   return Block<const Derived, BlockRows, BlockCols>(derived(), startRow, startCol);
00666 }
00667 
00687 template<int BlockRows, int BlockCols>
00688 inline Block<Derived, BlockRows, BlockCols> block(Index startRow, Index startCol, 
00689                                                   Index blockRows, Index blockCols)
00690 {
00691   return Block<Derived, BlockRows, BlockCols>(derived(), startRow, startCol, blockRows, blockCols);
00692 }
00693 
00695 template<int BlockRows, int BlockCols>
00696 inline const Block<const Derived, BlockRows, BlockCols> block(Index startRow, Index startCol,
00697                                                               Index blockRows, Index blockCols) const
00698 {
00699   return Block<const Derived, BlockRows, BlockCols>(derived(), startRow, startCol, blockRows, blockCols);
00700 }
00701 
00708 inline ColXpr col(Index i)
00709 {
00710   return ColXpr(derived(), i);
00711 }
00712 
00714 inline ConstColXpr col(Index i) const
00715 {
00716   return ConstColXpr(derived(), i);
00717 }
00718 
00725 inline RowXpr row(Index i)
00726 {
00727   return RowXpr(derived(), i);
00728 }
00729 
00731 inline ConstRowXpr row(Index i) const
00732 {
00733   return ConstRowXpr(derived(), i);
00734 }
00735 
00752 inline SegmentReturnType segment(Index start, Index vecSize)
00753 {
00754   EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
00755   return SegmentReturnType(derived(), start, vecSize);
00756 }
00757 
00758 
00760 inline ConstSegmentReturnType segment(Index start, Index vecSize) const
00761 {
00762   EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
00763   return ConstSegmentReturnType(derived(), start, vecSize);
00764 }
00765 
00781 inline SegmentReturnType head(Index vecSize)
00782 {
00783   EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
00784   return SegmentReturnType(derived(), 0, vecSize);
00785 }
00786 
00788 inline ConstSegmentReturnType
00789   head(Index vecSize) const
00790 {
00791   EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
00792   return ConstSegmentReturnType(derived(), 0, vecSize);
00793 }
00794 
00810 inline SegmentReturnType tail(Index vecSize)
00811 {
00812   EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
00813   return SegmentReturnType(derived(), this->size() - vecSize, vecSize);
00814 }
00815 
00817 inline ConstSegmentReturnType tail(Index vecSize) const
00818 {
00819   EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
00820   return ConstSegmentReturnType(derived(), this->size() - vecSize, vecSize);
00821 }
00822 
00836 template<int Size>
00837 inline typename FixedSegmentReturnType<Size>::Type segment(Index start)
00838 {
00839   EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
00840   return typename FixedSegmentReturnType<Size>::Type(derived(), start);
00841 }
00842 
00844 template<int Size>
00845 inline typename ConstFixedSegmentReturnType<Size>::Type segment(Index start) const
00846 {
00847   EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
00848   return typename ConstFixedSegmentReturnType<Size>::Type(derived(), start);
00849 }
00850 
00862 template<int Size>
00863 inline typename FixedSegmentReturnType<Size>::Type head()
00864 {
00865   EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
00866   return typename FixedSegmentReturnType<Size>::Type(derived(), 0);
00867 }
00868 
00870 template<int Size>
00871 inline typename ConstFixedSegmentReturnType<Size>::Type head() const
00872 {
00873   EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
00874   return typename ConstFixedSegmentReturnType<Size>::Type(derived(), 0);
00875 }
00876 
00888 template<int Size>
00889 inline typename FixedSegmentReturnType<Size>::Type tail()
00890 {
00891   EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
00892   return typename FixedSegmentReturnType<Size>::Type(derived(), size() - Size);
00893 }
00894 
00896 template<int Size>
00897 inline typename ConstFixedSegmentReturnType<Size>::Type tail() const
00898 {
00899   EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
00900   return typename ConstFixedSegmentReturnType<Size>::Type(derived(), size() - Size);
00901 }


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Sat Jun 8 2019 19:36:48