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 #ifndef EIGEN_BLOCKMETHODS_H
00012 #define EIGEN_BLOCKMETHODS_H
00013 
00014 #ifndef EIGEN_PARSED_BY_DOXYGEN
00015 
00017 typedef Block<Derived, internal::traits<Derived>::RowsAtCompileTime, 1, !IsRowMajor> ColXpr;
00018 typedef const Block<const Derived, internal::traits<Derived>::RowsAtCompileTime, 1, !IsRowMajor> ConstColXpr;
00020 typedef Block<Derived, 1, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> RowXpr;
00021 typedef const Block<const Derived, 1, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> ConstRowXpr;
00023 typedef Block<Derived, internal::traits<Derived>::RowsAtCompileTime, Dynamic, !IsRowMajor> ColsBlockXpr;
00024 typedef const Block<const Derived, internal::traits<Derived>::RowsAtCompileTime, Dynamic, !IsRowMajor> ConstColsBlockXpr;
00026 typedef Block<Derived, Dynamic, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> RowsBlockXpr;
00027 typedef const Block<const Derived, Dynamic, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> ConstRowsBlockXpr;
00029 template<int N> struct NColsBlockXpr { typedef Block<Derived, internal::traits<Derived>::RowsAtCompileTime, N, !IsRowMajor> Type; };
00030 template<int N> struct ConstNColsBlockXpr { typedef const Block<const Derived, internal::traits<Derived>::RowsAtCompileTime, N, !IsRowMajor> Type; };
00032 template<int N> struct NRowsBlockXpr { typedef Block<Derived, N, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> Type; };
00033 template<int N> struct ConstNRowsBlockXpr { typedef const Block<const Derived, N, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> Type; };
00034 
00035 
00036 #endif // not EIGEN_PARSED_BY_DOXYGEN
00037 
00054 inline Block<Derived> block(Index startRow, Index startCol, Index blockRows, Index blockCols)
00055 {
00056   return Block<Derived>(derived(), startRow, startCol, blockRows, blockCols);
00057 }
00058 
00060 inline const Block<const Derived> block(Index startRow, Index startCol, Index blockRows, Index blockCols) const
00061 {
00062   return Block<const Derived>(derived(), startRow, startCol, blockRows, blockCols);
00063 }
00064 
00065 
00066 
00067 
00078 inline Block<Derived> topRightCorner(Index cRows, Index cCols)
00079 {
00080   return Block<Derived>(derived(), 0, cols() - cCols, cRows, cCols);
00081 }
00082 
00084 inline const Block<const Derived> topRightCorner(Index cRows, Index cCols) const
00085 {
00086   return Block<const Derived>(derived(), 0, cols() - cCols, cRows, cCols);
00087 }
00088 
00098 template<int CRows, int CCols>
00099 inline Block<Derived, CRows, CCols> topRightCorner()
00100 {
00101   return Block<Derived, CRows, CCols>(derived(), 0, cols() - CCols);
00102 }
00103 
00105 template<int CRows, int CCols>
00106 inline const Block<const Derived, CRows, CCols> topRightCorner() const
00107 {
00108   return Block<const Derived, CRows, CCols>(derived(), 0, cols() - CCols);
00109 }
00110 
00111 
00112 
00113 
00124 inline Block<Derived> topLeftCorner(Index cRows, Index cCols)
00125 {
00126   return Block<Derived>(derived(), 0, 0, cRows, cCols);
00127 }
00128 
00130 inline const Block<const Derived> topLeftCorner(Index cRows, Index cCols) const
00131 {
00132   return Block<const Derived>(derived(), 0, 0, cRows, cCols);
00133 }
00134 
00144 template<int CRows, int CCols>
00145 inline Block<Derived, CRows, CCols> topLeftCorner()
00146 {
00147   return Block<Derived, CRows, CCols>(derived(), 0, 0);
00148 }
00149 
00151 template<int CRows, int CCols>
00152 inline const Block<const Derived, CRows, CCols> topLeftCorner() const
00153 {
00154   return Block<const Derived, CRows, CCols>(derived(), 0, 0);
00155 }
00156 
00157 
00158 
00169 inline Block<Derived> bottomRightCorner(Index cRows, Index cCols)
00170 {
00171   return Block<Derived>(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
00172 }
00173 
00175 inline const Block<const Derived> bottomRightCorner(Index cRows, Index cCols) const
00176 {
00177   return Block<const Derived>(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
00178 }
00179 
00189 template<int CRows, int CCols>
00190 inline Block<Derived, CRows, CCols> bottomRightCorner()
00191 {
00192   return Block<Derived, CRows, CCols>(derived(), rows() - CRows, cols() - CCols);
00193 }
00194 
00196 template<int CRows, int CCols>
00197 inline const Block<const Derived, CRows, CCols> bottomRightCorner() const
00198 {
00199   return Block<const Derived, CRows, CCols>(derived(), rows() - CRows, cols() - CCols);
00200 }
00201 
00202 
00203 
00214 inline Block<Derived> bottomLeftCorner(Index cRows, Index cCols)
00215 {
00216   return Block<Derived>(derived(), rows() - cRows, 0, cRows, cCols);
00217 }
00218 
00220 inline const Block<const Derived> bottomLeftCorner(Index cRows, Index cCols) const
00221 {
00222   return Block<const Derived>(derived(), rows() - cRows, 0, cRows, cCols);
00223 }
00224 
00234 template<int CRows, int CCols>
00235 inline Block<Derived, CRows, CCols> bottomLeftCorner()
00236 {
00237   return Block<Derived, CRows, CCols>(derived(), rows() - CRows, 0);
00238 }
00239 
00241 template<int CRows, int CCols>
00242 inline const Block<const Derived, CRows, CCols> bottomLeftCorner() const
00243 {
00244   return Block<const Derived, CRows, CCols>(derived(), rows() - CRows, 0);
00245 }
00246 
00247 
00248 
00258 inline RowsBlockXpr topRows(Index n)
00259 {
00260   return RowsBlockXpr(derived(), 0, 0, n, cols());
00261 }
00262 
00264 inline ConstRowsBlockXpr topRows(Index n) const
00265 {
00266   return ConstRowsBlockXpr(derived(), 0, 0, n, cols());
00267 }
00268 
00278 template<int N>
00279 inline typename NRowsBlockXpr<N>::Type topRows()
00280 {
00281   return typename NRowsBlockXpr<N>::Type(derived(), 0, 0, N, cols());
00282 }
00283 
00285 template<int N>
00286 inline typename ConstNRowsBlockXpr<N>::Type topRows() const
00287 {
00288   return typename ConstNRowsBlockXpr<N>::Type(derived(), 0, 0, N, cols());
00289 }
00290 
00291 
00292 
00302 inline RowsBlockXpr bottomRows(Index n)
00303 {
00304   return RowsBlockXpr(derived(), rows() - n, 0, n, cols());
00305 }
00306 
00308 inline ConstRowsBlockXpr bottomRows(Index n) const
00309 {
00310   return ConstRowsBlockXpr(derived(), rows() - n, 0, n, cols());
00311 }
00312 
00322 template<int N>
00323 inline typename NRowsBlockXpr<N>::Type bottomRows()
00324 {
00325   return typename NRowsBlockXpr<N>::Type(derived(), rows() - N, 0, N, cols());
00326 }
00327 
00329 template<int N>
00330 inline typename ConstNRowsBlockXpr<N>::Type bottomRows() const
00331 {
00332   return typename ConstNRowsBlockXpr<N>::Type(derived(), rows() - N, 0, N, cols());
00333 }
00334 
00335 
00336 
00347 inline RowsBlockXpr middleRows(Index startRow, Index numRows)
00348 {
00349   return RowsBlockXpr(derived(), startRow, 0, numRows, cols());
00350 }
00351 
00353 inline ConstRowsBlockXpr middleRows(Index startRow, Index numRows) const
00354 {
00355   return ConstRowsBlockXpr(derived(), startRow, 0, numRows, cols());
00356 }
00357 
00368 template<int N>
00369 inline typename NRowsBlockXpr<N>::Type middleRows(Index startRow)
00370 {
00371   return typename NRowsBlockXpr<N>::Type(derived(), startRow, 0, N, cols());
00372 }
00373 
00375 template<int N>
00376 inline typename ConstNRowsBlockXpr<N>::Type middleRows(Index startRow) const
00377 {
00378   return typename ConstNRowsBlockXpr<N>::Type(derived(), startRow, 0, N, cols());
00379 }
00380 
00381 
00382 
00392 inline ColsBlockXpr leftCols(Index n)
00393 {
00394   return ColsBlockXpr(derived(), 0, 0, rows(), n);
00395 }
00396 
00398 inline ConstColsBlockXpr leftCols(Index n) const
00399 {
00400   return ConstColsBlockXpr(derived(), 0, 0, rows(), n);
00401 }
00402 
00412 template<int N>
00413 inline typename NColsBlockXpr<N>::Type leftCols()
00414 {
00415   return typename NColsBlockXpr<N>::Type(derived(), 0, 0, rows(), N);
00416 }
00417 
00419 template<int N>
00420 inline typename ConstNColsBlockXpr<N>::Type leftCols() const
00421 {
00422   return typename ConstNColsBlockXpr<N>::Type(derived(), 0, 0, rows(), N);
00423 }
00424 
00425 
00426 
00436 inline ColsBlockXpr rightCols(Index n)
00437 {
00438   return ColsBlockXpr(derived(), 0, cols() - n, rows(), n);
00439 }
00440 
00442 inline ConstColsBlockXpr rightCols(Index n) const
00443 {
00444   return ConstColsBlockXpr(derived(), 0, cols() - n, rows(), n);
00445 }
00446 
00456 template<int N>
00457 inline typename NColsBlockXpr<N>::Type rightCols()
00458 {
00459   return typename NColsBlockXpr<N>::Type(derived(), 0, cols() - N, rows(), N);
00460 }
00461 
00463 template<int N>
00464 inline typename ConstNColsBlockXpr<N>::Type rightCols() const
00465 {
00466   return typename ConstNColsBlockXpr<N>::Type(derived(), 0, cols() - N, rows(), N);
00467 }
00468 
00469 
00470 
00481 inline ColsBlockXpr middleCols(Index startCol, Index numCols)
00482 {
00483   return ColsBlockXpr(derived(), 0, startCol, rows(), numCols);
00484 }
00485 
00487 inline ConstColsBlockXpr middleCols(Index startCol, Index numCols) const
00488 {
00489   return ConstColsBlockXpr(derived(), 0, startCol, rows(), numCols);
00490 }
00491 
00502 template<int N>
00503 inline typename NColsBlockXpr<N>::Type middleCols(Index startCol)
00504 {
00505   return typename NColsBlockXpr<N>::Type(derived(), 0, startCol, rows(), N);
00506 }
00507 
00509 template<int N>
00510 inline typename ConstNColsBlockXpr<N>::Type middleCols(Index startCol) const
00511 {
00512   return typename ConstNColsBlockXpr<N>::Type(derived(), 0, startCol, rows(), N);
00513 }
00514 
00515 
00516 
00533 template<int BlockRows, int BlockCols>
00534 inline Block<Derived, BlockRows, BlockCols> block(Index startRow, Index startCol)
00535 {
00536   return Block<Derived, BlockRows, BlockCols>(derived(), startRow, startCol);
00537 }
00538 
00540 template<int BlockRows, int BlockCols>
00541 inline const Block<const Derived, BlockRows, BlockCols> block(Index startRow, Index startCol) const
00542 {
00543   return Block<const Derived, BlockRows, BlockCols>(derived(), startRow, startCol);
00544 }
00545 
00552 inline ColXpr col(Index i)
00553 {
00554   return ColXpr(derived(), i);
00555 }
00556 
00558 inline ConstColXpr col(Index i) const
00559 {
00560   return ConstColXpr(derived(), i);
00561 }
00562 
00569 inline RowXpr row(Index i)
00570 {
00571   return RowXpr(derived(), i);
00572 }
00573 
00575 inline ConstRowXpr row(Index i) const
00576 {
00577   return ConstRowXpr(derived(), i);
00578 }
00579 
00580 #endif // EIGEN_BLOCKMETHODS_H


win_eigen
Author(s): Daniel Stonier
autogenerated on Wed Sep 16 2015 07:10:21