11 #ifndef EIGEN_BLOCKMETHODS_H
12 #define EIGEN_BLOCKMETHODS_H
14 #ifndef EIGEN_PARSED_BY_DOXYGEN
17 typedef Block<Derived, internal::traits<Derived>::RowsAtCompileTime, 1, !IsRowMajor> ColXpr;
18 typedef const Block<const Derived, internal::traits<Derived>::RowsAtCompileTime, 1, !IsRowMajor> ConstColXpr;
20 typedef Block<Derived, 1, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> RowXpr;
21 typedef const Block<const Derived, 1, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> ConstRowXpr;
23 typedef Block<Derived, internal::traits<Derived>::RowsAtCompileTime,
Dynamic, !IsRowMajor> ColsBlockXpr;
24 typedef const Block<const Derived, internal::traits<Derived>::RowsAtCompileTime,
Dynamic, !IsRowMajor> ConstColsBlockXpr;
26 typedef Block<Derived, Dynamic, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> RowsBlockXpr;
27 typedef const Block<const Derived, Dynamic, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> ConstRowsBlockXpr;
29 template<
int N>
struct NColsBlockXpr {
typedef Block<Derived, internal::traits<Derived>::RowsAtCompileTime, N, !IsRowMajor> Type; };
30 template<
int N>
struct ConstNColsBlockXpr {
typedef const Block<const Derived, internal::traits<Derived>::RowsAtCompileTime, N, !IsRowMajor> Type; };
32 template<
int N>
struct NRowsBlockXpr {
typedef Block<Derived, N, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> Type; };
33 template<
int N>
struct ConstNRowsBlockXpr {
typedef const Block<const Derived, N, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> Type; };
36 #endif // not EIGEN_PARSED_BY_DOXYGEN
54 inline Block<Derived> block(Index startRow, Index startCol, Index blockRows, Index blockCols)
56 return Block<Derived>(derived(), startRow, startCol, blockRows, blockCols);
60 inline const Block<const Derived> block(Index startRow, Index startCol, Index blockRows, Index blockCols)
const
62 return Block<const Derived>(derived(), startRow, startCol, blockRows, blockCols);
78 inline Block<Derived> topRightCorner(Index cRows, Index cCols)
80 return Block<Derived>(derived(), 0, cols() - cCols, cRows, cCols);
84 inline const Block<const Derived> topRightCorner(Index cRows, Index cCols)
const
86 return Block<const Derived>(derived(), 0, cols() - cCols, cRows, cCols);
98 template<
int CRows,
int CCols>
99 inline Block<Derived, CRows, CCols> topRightCorner()
101 return Block<Derived, CRows, CCols>(derived(), 0, cols() - CCols);
105 template<
int CRows,
int CCols>
106 inline const Block<const Derived, CRows, CCols> topRightCorner()
const
108 return Block<const Derived, CRows, CCols>(derived(), 0, cols() - CCols);
124 inline Block<Derived> topLeftCorner(Index cRows, Index cCols)
126 return Block<Derived>(derived(), 0, 0, cRows, cCols);
130 inline const Block<const Derived> topLeftCorner(Index cRows, Index cCols)
const
132 return Block<const Derived>(derived(), 0, 0, cRows, cCols);
144 template<
int CRows,
int CCols>
145 inline Block<Derived, CRows, CCols> topLeftCorner()
147 return Block<Derived, CRows, CCols>(derived(), 0, 0);
151 template<
int CRows,
int CCols>
152 inline const Block<const Derived, CRows, CCols> topLeftCorner()
const
154 return Block<const Derived, CRows, CCols>(derived(), 0, 0);
169 inline Block<Derived> bottomRightCorner(Index cRows, Index cCols)
171 return Block<Derived>(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
175 inline const Block<const Derived> bottomRightCorner(Index cRows, Index cCols)
const
177 return Block<const Derived>(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
189 template<
int CRows,
int CCols>
190 inline Block<Derived, CRows, CCols> bottomRightCorner()
192 return Block<Derived, CRows, CCols>(derived(), rows() - CRows, cols() - CCols);
196 template<
int CRows,
int CCols>
197 inline const Block<const Derived, CRows, CCols> bottomRightCorner()
const
199 return Block<const Derived, CRows, CCols>(derived(), rows() - CRows, cols() - CCols);
214 inline Block<Derived> bottomLeftCorner(Index cRows, Index cCols)
216 return Block<Derived>(derived(), rows() - cRows, 0, cRows, cCols);
220 inline const Block<const Derived> bottomLeftCorner(Index cRows, Index cCols)
const
222 return Block<const Derived>(derived(), rows() - cRows, 0, cRows, cCols);
234 template<
int CRows,
int CCols>
235 inline Block<Derived, CRows, CCols> bottomLeftCorner()
237 return Block<Derived, CRows, CCols>(derived(), rows() - CRows, 0);
241 template<
int CRows,
int CCols>
242 inline const Block<const Derived, CRows, CCols> bottomLeftCorner()
const
244 return Block<const Derived, CRows, CCols>(derived(), rows() - CRows, 0);
258 inline RowsBlockXpr topRows(Index n)
260 return RowsBlockXpr(derived(), 0, 0, n, cols());
264 inline ConstRowsBlockXpr topRows(Index n)
const
266 return ConstRowsBlockXpr(derived(), 0, 0, n, cols());
279 inline typename NRowsBlockXpr<N>::Type topRows()
281 return typename NRowsBlockXpr<N>::Type(derived(), 0, 0, N, cols());
286 inline typename ConstNRowsBlockXpr<N>::Type topRows()
const
288 return typename ConstNRowsBlockXpr<N>::Type(derived(), 0, 0, N, cols());
302 inline RowsBlockXpr bottomRows(Index n)
304 return RowsBlockXpr(derived(), rows() - n, 0, n, cols());
308 inline ConstRowsBlockXpr bottomRows(Index n)
const
310 return ConstRowsBlockXpr(derived(), rows() - n, 0, n, cols());
323 inline typename NRowsBlockXpr<N>::Type bottomRows()
325 return typename NRowsBlockXpr<N>::Type(derived(), rows() - N, 0, N, cols());
330 inline typename ConstNRowsBlockXpr<N>::Type bottomRows()
const
332 return typename ConstNRowsBlockXpr<N>::Type(derived(), rows() - N, 0, N, cols());
347 inline RowsBlockXpr middleRows(Index startRow, Index numRows)
349 return RowsBlockXpr(derived(), startRow, 0, numRows, cols());
353 inline ConstRowsBlockXpr middleRows(Index startRow, Index numRows)
const
355 return ConstRowsBlockXpr(derived(), startRow, 0, numRows, cols());
369 inline typename NRowsBlockXpr<N>::Type middleRows(Index startRow)
371 return typename NRowsBlockXpr<N>::Type(derived(), startRow, 0, N, cols());
376 inline typename ConstNRowsBlockXpr<N>::Type middleRows(Index startRow)
const
378 return typename ConstNRowsBlockXpr<N>::Type(derived(), startRow, 0, N, cols());
392 inline ColsBlockXpr leftCols(Index n)
394 return ColsBlockXpr(derived(), 0, 0, rows(), n);
398 inline ConstColsBlockXpr leftCols(Index n)
const
400 return ConstColsBlockXpr(derived(), 0, 0, rows(), n);
413 inline typename NColsBlockXpr<N>::Type leftCols()
415 return typename NColsBlockXpr<N>::Type(derived(), 0, 0, rows(), N);
420 inline typename ConstNColsBlockXpr<N>::Type leftCols()
const
422 return typename ConstNColsBlockXpr<N>::Type(derived(), 0, 0, rows(), N);
436 inline ColsBlockXpr rightCols(Index n)
438 return ColsBlockXpr(derived(), 0, cols() - n, rows(), n);
442 inline ConstColsBlockXpr rightCols(Index n)
const
444 return ConstColsBlockXpr(derived(), 0, cols() - n, rows(), n);
457 inline typename NColsBlockXpr<N>::Type rightCols()
459 return typename NColsBlockXpr<N>::Type(derived(), 0, cols() - N, rows(), N);
464 inline typename ConstNColsBlockXpr<N>::Type rightCols()
const
466 return typename ConstNColsBlockXpr<N>::Type(derived(), 0, cols() - N, rows(), N);
481 inline ColsBlockXpr middleCols(Index startCol, Index numCols)
483 return ColsBlockXpr(derived(), 0, startCol, rows(), numCols);
487 inline ConstColsBlockXpr middleCols(Index startCol, Index numCols)
const
489 return ConstColsBlockXpr(derived(), 0, startCol, rows(), numCols);
503 inline typename NColsBlockXpr<N>::Type middleCols(Index startCol)
505 return typename NColsBlockXpr<N>::Type(derived(), 0, startCol, rows(), N);
510 inline typename ConstNColsBlockXpr<N>::Type middleCols(Index startCol)
const
512 return typename ConstNColsBlockXpr<N>::Type(derived(), 0, startCol, rows(), N);
533 template<
int BlockRows,
int BlockCols>
534 inline Block<Derived, BlockRows, BlockCols> block(Index startRow, Index startCol)
536 return Block<Derived, BlockRows, BlockCols>(derived(), startRow, startCol);
540 template<
int BlockRows,
int BlockCols>
541 inline const Block<const Derived, BlockRows, BlockCols> block(Index startRow, Index startCol)
const
543 return Block<const Derived, BlockRows, BlockCols>(derived(), startRow, startCol);
552 inline ColXpr col(Index i)
554 return ColXpr(derived(), i);
558 inline ConstColXpr col(Index i)
const
560 return ConstColXpr(derived(), i);
569 inline RowXpr row(Index i)
571 return RowXpr(derived(), i);
575 inline ConstRowXpr row(Index i)
const
577 return ConstRowXpr(derived(), i);
580 #endif // EIGEN_BLOCKMETHODS_H