$treeview $search $mathjax
Eigen
3.2.5
$projectbrief
|
$projectbrief
|
$searchbox |
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 00404 template<int N> 00405 inline typename NRowsBlockXpr<N>::Type topRows(Index n = N) 00406 { 00407 return typename NRowsBlockXpr<N>::Type(derived(), 0, 0, n, cols()); 00408 } 00409 00411 template<int N> 00412 inline typename ConstNRowsBlockXpr<N>::Type topRows(Index n = N) const 00413 { 00414 return typename ConstNRowsBlockXpr<N>::Type(derived(), 0, 0, n, cols()); 00415 } 00416 00417 00418 00428 inline RowsBlockXpr bottomRows(Index n) 00429 { 00430 return RowsBlockXpr(derived(), rows() - n, 0, n, cols()); 00431 } 00432 00434 inline ConstRowsBlockXpr bottomRows(Index n) const 00435 { 00436 return ConstRowsBlockXpr(derived(), rows() - n, 0, n, cols()); 00437 } 00438 00452 template<int N> 00453 inline typename NRowsBlockXpr<N>::Type bottomRows(Index n = N) 00454 { 00455 return typename NRowsBlockXpr<N>::Type(derived(), rows() - n, 0, n, cols()); 00456 } 00457 00459 template<int N> 00460 inline typename ConstNRowsBlockXpr<N>::Type bottomRows(Index n = N) const 00461 { 00462 return typename ConstNRowsBlockXpr<N>::Type(derived(), rows() - n, 0, n, cols()); 00463 } 00464 00465 00466 00477 inline RowsBlockXpr middleRows(Index startRow, Index n) 00478 { 00479 return RowsBlockXpr(derived(), startRow, 0, n, cols()); 00480 } 00481 00483 inline ConstRowsBlockXpr middleRows(Index startRow, Index n) const 00484 { 00485 return ConstRowsBlockXpr(derived(), startRow, 0, n, cols()); 00486 } 00487 00502 template<int N> 00503 inline typename NRowsBlockXpr<N>::Type middleRows(Index startRow, Index n = N) 00504 { 00505 return typename NRowsBlockXpr<N>::Type(derived(), startRow, 0, n, cols()); 00506 } 00507 00509 template<int N> 00510 inline typename ConstNRowsBlockXpr<N>::Type middleRows(Index startRow, Index n = N) const 00511 { 00512 return typename ConstNRowsBlockXpr<N>::Type(derived(), startRow, 0, n, cols()); 00513 } 00514 00515 00516 00526 inline ColsBlockXpr leftCols(Index n) 00527 { 00528 return ColsBlockXpr(derived(), 0, 0, rows(), n); 00529 } 00530 00532 inline ConstColsBlockXpr leftCols(Index n) const 00533 { 00534 return ConstColsBlockXpr(derived(), 0, 0, rows(), n); 00535 } 00536 00550 template<int N> 00551 inline typename NColsBlockXpr<N>::Type leftCols(Index n = N) 00552 { 00553 return typename NColsBlockXpr<N>::Type(derived(), 0, 0, rows(), n); 00554 } 00555 00557 template<int N> 00558 inline typename ConstNColsBlockXpr<N>::Type leftCols(Index n = N) const 00559 { 00560 return typename ConstNColsBlockXpr<N>::Type(derived(), 0, 0, rows(), n); 00561 } 00562 00563 00564 00574 inline ColsBlockXpr rightCols(Index n) 00575 { 00576 return ColsBlockXpr(derived(), 0, cols() - n, rows(), n); 00577 } 00578 00580 inline ConstColsBlockXpr rightCols(Index n) const 00581 { 00582 return ConstColsBlockXpr(derived(), 0, cols() - n, rows(), n); 00583 } 00584 00598 template<int N> 00599 inline typename NColsBlockXpr<N>::Type rightCols(Index n = N) 00600 { 00601 return typename NColsBlockXpr<N>::Type(derived(), 0, cols() - n, rows(), n); 00602 } 00603 00605 template<int N> 00606 inline typename ConstNColsBlockXpr<N>::Type rightCols(Index n = N) const 00607 { 00608 return typename ConstNColsBlockXpr<N>::Type(derived(), 0, cols() - n, rows(), n); 00609 } 00610 00611 00612 00623 inline ColsBlockXpr middleCols(Index startCol, Index numCols) 00624 { 00625 return ColsBlockXpr(derived(), 0, startCol, rows(), numCols); 00626 } 00627 00629 inline ConstColsBlockXpr middleCols(Index startCol, Index numCols) const 00630 { 00631 return ConstColsBlockXpr(derived(), 0, startCol, rows(), numCols); 00632 } 00633 00648 template<int N> 00649 inline typename NColsBlockXpr<N>::Type middleCols(Index startCol, Index n = N) 00650 { 00651 return typename NColsBlockXpr<N>::Type(derived(), 0, startCol, rows(), n); 00652 } 00653 00655 template<int N> 00656 inline typename ConstNColsBlockXpr<N>::Type middleCols(Index startCol, Index n = N) const 00657 { 00658 return typename ConstNColsBlockXpr<N>::Type(derived(), 0, startCol, rows(), n); 00659 } 00660 00661 00662 00679 template<int BlockRows, int BlockCols> 00680 inline Block<Derived, BlockRows, BlockCols> block(Index startRow, Index startCol) 00681 { 00682 return Block<Derived, BlockRows, BlockCols>(derived(), startRow, startCol); 00683 } 00684 00686 template<int BlockRows, int BlockCols> 00687 inline const Block<const Derived, BlockRows, BlockCols> block(Index startRow, Index startCol) const 00688 { 00689 return Block<const Derived, BlockRows, BlockCols>(derived(), startRow, startCol); 00690 } 00691 00711 template<int BlockRows, int BlockCols> 00712 inline Block<Derived, BlockRows, BlockCols> block(Index startRow, Index startCol, 00713 Index blockRows, Index blockCols) 00714 { 00715 return Block<Derived, BlockRows, BlockCols>(derived(), startRow, startCol, blockRows, blockCols); 00716 } 00717 00719 template<int BlockRows, int BlockCols> 00720 inline const Block<const Derived, BlockRows, BlockCols> block(Index startRow, Index startCol, 00721 Index blockRows, Index blockCols) const 00722 { 00723 return Block<const Derived, BlockRows, BlockCols>(derived(), startRow, startCol, blockRows, blockCols); 00724 } 00725 00732 inline ColXpr col(Index i) 00733 { 00734 return ColXpr(derived(), i); 00735 } 00736 00738 inline ConstColXpr col(Index i) const 00739 { 00740 return ConstColXpr(derived(), i); 00741 } 00742 00749 inline RowXpr row(Index i) 00750 { 00751 return RowXpr(derived(), i); 00752 } 00753 00755 inline ConstRowXpr row(Index i) const 00756 { 00757 return ConstRowXpr(derived(), i); 00758 } 00759 00776 inline SegmentReturnType segment(Index start, Index n) 00777 { 00778 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 00779 return SegmentReturnType(derived(), start, n); 00780 } 00781 00782 00784 inline ConstSegmentReturnType segment(Index start, Index n) const 00785 { 00786 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 00787 return ConstSegmentReturnType(derived(), start, n); 00788 } 00789 00805 inline SegmentReturnType head(Index n) 00806 { 00807 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 00808 return SegmentReturnType(derived(), 0, n); 00809 } 00810 00812 inline ConstSegmentReturnType head(Index n) const 00813 { 00814 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 00815 return ConstSegmentReturnType(derived(), 0, n); 00816 } 00817 00833 inline SegmentReturnType tail(Index n) 00834 { 00835 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 00836 return SegmentReturnType(derived(), this->size() - n, n); 00837 } 00838 00840 inline ConstSegmentReturnType tail(Index n) const 00841 { 00842 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 00843 return ConstSegmentReturnType(derived(), this->size() - n, n); 00844 } 00845 00862 template<int N> 00863 inline typename FixedSegmentReturnType<N>::Type segment(Index start, Index n = N) 00864 { 00865 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 00866 return typename FixedSegmentReturnType<N>::Type(derived(), start, n); 00867 } 00868 00870 template<int N> 00871 inline typename ConstFixedSegmentReturnType<N>::Type segment(Index start, Index n = N) const 00872 { 00873 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 00874 return typename ConstFixedSegmentReturnType<N>::Type(derived(), start, n); 00875 } 00876 00892 template<int N> 00893 inline typename FixedSegmentReturnType<N>::Type head(Index n = N) 00894 { 00895 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 00896 return typename FixedSegmentReturnType<N>::Type(derived(), 0, n); 00897 } 00898 00900 template<int N> 00901 inline typename ConstFixedSegmentReturnType<N>::Type head(Index n = N) const 00902 { 00903 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 00904 return typename ConstFixedSegmentReturnType<N>::Type(derived(), 0, n); 00905 } 00906 00922 template<int N> 00923 inline typename FixedSegmentReturnType<N>::Type tail(Index n = N) 00924 { 00925 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 00926 return typename FixedSegmentReturnType<N>::Type(derived(), size() - n); 00927 } 00928 00930 template<int N> 00931 inline typename ConstFixedSegmentReturnType<N>::Type tail(Index n = N) const 00932 { 00933 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 00934 return typename ConstFixedSegmentReturnType<N>::Type(derived(), size() - n); 00935 }