BlockMethods.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud@inria.fr>
5 // Copyright (C) 2006-2010 Benoit Jacob <jacob.benoit.1@gmail.com>
6 //
7 // This Source Code Form is subject to the terms of the Mozilla
8 // Public License v. 2.0. If a copy of the MPL was not distributed
9 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 
11 
12 #ifndef EIGEN_PARSED_BY_DOXYGEN
13 
15 typedef Block<Derived, internal::traits<Derived>::RowsAtCompileTime, 1, !IsRowMajor> ColXpr;
16 typedef const Block<const Derived, internal::traits<Derived>::RowsAtCompileTime, 1, !IsRowMajor> ConstColXpr;
18 typedef Block<Derived, 1, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> RowXpr;
19 typedef const Block<const Derived, 1, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> ConstRowXpr;
21 typedef Block<Derived, internal::traits<Derived>::RowsAtCompileTime, Dynamic, !IsRowMajor> ColsBlockXpr;
22 typedef const Block<const Derived, internal::traits<Derived>::RowsAtCompileTime, Dynamic, !IsRowMajor> ConstColsBlockXpr;
24 typedef Block<Derived, Dynamic, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> RowsBlockXpr;
25 typedef const Block<const Derived, Dynamic, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> ConstRowsBlockXpr;
27 template<int N> struct NColsBlockXpr { typedef Block<Derived, internal::traits<Derived>::RowsAtCompileTime, N, !IsRowMajor> Type; };
28 template<int N> struct ConstNColsBlockXpr { typedef const Block<const Derived, internal::traits<Derived>::RowsAtCompileTime, N, !IsRowMajor> Type; };
30 template<int N> struct NRowsBlockXpr { typedef Block<Derived, N, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> Type; };
31 template<int N> struct ConstNRowsBlockXpr { typedef const Block<const Derived, N, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor> Type; };
32 
33 typedef VectorBlock<Derived> SegmentReturnType;
34 typedef const VectorBlock<const Derived> ConstSegmentReturnType;
35 template<int Size> struct FixedSegmentReturnType { typedef VectorBlock<Derived, Size> Type; };
36 template<int Size> struct ConstFixedSegmentReturnType { typedef const VectorBlock<const Derived, Size> Type; };
37 
38 #endif // not EIGEN_PARSED_BY_DOXYGEN
39 
56 inline Block<Derived> block(Index startRow, Index startCol, Index blockRows, Index blockCols)
57 {
58  return Block<Derived>(derived(), startRow, startCol, blockRows, blockCols);
59 }
60 
62 inline const Block<const Derived> block(Index startRow, Index startCol, Index blockRows, Index blockCols) const
63 {
64  return Block<const Derived>(derived(), startRow, startCol, blockRows, blockCols);
65 }
66 
67 
68 
69 
80 inline Block<Derived> topRightCorner(Index cRows, Index cCols)
81 {
82  return Block<Derived>(derived(), 0, cols() - cCols, cRows, cCols);
83 }
84 
86 inline const Block<const Derived> topRightCorner(Index cRows, Index cCols) const
87 {
88  return Block<const Derived>(derived(), 0, cols() - cCols, cRows, cCols);
89 }
90 
101 template<int CRows, int CCols>
102 inline Block<Derived, CRows, CCols> topRightCorner()
103 {
104  return Block<Derived, CRows, CCols>(derived(), 0, cols() - CCols);
105 }
106 
108 template<int CRows, int CCols>
109 inline const Block<const Derived, CRows, CCols> topRightCorner() const
110 {
111  return Block<const Derived, CRows, CCols>(derived(), 0, cols() - CCols);
112 }
113 
131 template<int CRows, int CCols>
132 inline Block<Derived, CRows, CCols> topRightCorner(Index cRows, Index cCols)
133 {
134  return Block<Derived, CRows, CCols>(derived(), 0, cols() - cCols, cRows, cCols);
135 }
136 
138 template<int CRows, int CCols>
139 inline const Block<const Derived, CRows, CCols> topRightCorner(Index cRows, Index cCols) const
140 {
141  return Block<const Derived, CRows, CCols>(derived(), 0, cols() - cCols, cRows, cCols);
142 }
143 
144 
145 
156 inline Block<Derived> topLeftCorner(Index cRows, Index cCols)
157 {
158  return Block<Derived>(derived(), 0, 0, cRows, cCols);
159 }
160 
162 inline const Block<const Derived> topLeftCorner(Index cRows, Index cCols) const
163 {
164  return Block<const Derived>(derived(), 0, 0, cRows, cCols);
165 }
166 
176 template<int CRows, int CCols>
177 inline Block<Derived, CRows, CCols> topLeftCorner()
178 {
179  return Block<Derived, CRows, CCols>(derived(), 0, 0);
180 }
181 
183 template<int CRows, int CCols>
184 inline const Block<const Derived, CRows, CCols> topLeftCorner() const
185 {
186  return Block<const Derived, CRows, CCols>(derived(), 0, 0);
187 }
188 
206 template<int CRows, int CCols>
207 inline Block<Derived, CRows, CCols> topLeftCorner(Index cRows, Index cCols)
208 {
209  return Block<Derived, CRows, CCols>(derived(), 0, 0, cRows, cCols);
210 }
211 
213 template<int CRows, int CCols>
214 inline const Block<const Derived, CRows, CCols> topLeftCorner(Index cRows, Index cCols) const
215 {
216  return Block<const Derived, CRows, CCols>(derived(), 0, 0, cRows, cCols);
217 }
218 
219 
220 
231 inline Block<Derived> bottomRightCorner(Index cRows, Index cCols)
232 {
233  return Block<Derived>(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
234 }
235 
237 inline const Block<const Derived> bottomRightCorner(Index cRows, Index cCols) const
238 {
239  return Block<const Derived>(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
240 }
241 
251 template<int CRows, int CCols>
252 inline Block<Derived, CRows, CCols> bottomRightCorner()
253 {
254  return Block<Derived, CRows, CCols>(derived(), rows() - CRows, cols() - CCols);
255 }
256 
258 template<int CRows, int CCols>
259 inline const Block<const Derived, CRows, CCols> bottomRightCorner() const
260 {
261  return Block<const Derived, CRows, CCols>(derived(), rows() - CRows, cols() - CCols);
262 }
263 
281 template<int CRows, int CCols>
282 inline Block<Derived, CRows, CCols> bottomRightCorner(Index cRows, Index cCols)
283 {
284  return Block<Derived, CRows, CCols>(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
285 }
286 
288 template<int CRows, int CCols>
289 inline const Block<const Derived, CRows, CCols> bottomRightCorner(Index cRows, Index cCols) const
290 {
291  return Block<const Derived, CRows, CCols>(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
292 }
293 
294 
295 
306 inline Block<Derived> bottomLeftCorner(Index cRows, Index cCols)
307 {
308  return Block<Derived>(derived(), rows() - cRows, 0, cRows, cCols);
309 }
310 
312 inline const Block<const Derived> bottomLeftCorner(Index cRows, Index cCols) const
313 {
314  return Block<const Derived>(derived(), rows() - cRows, 0, cRows, cCols);
315 }
316 
326 template<int CRows, int CCols>
327 inline Block<Derived, CRows, CCols> bottomLeftCorner()
328 {
329  return Block<Derived, CRows, CCols>(derived(), rows() - CRows, 0);
330 }
331 
333 template<int CRows, int CCols>
334 inline const Block<const Derived, CRows, CCols> bottomLeftCorner() const
335 {
336  return Block<const Derived, CRows, CCols>(derived(), rows() - CRows, 0);
337 }
338 
356 template<int CRows, int CCols>
357 inline Block<Derived, CRows, CCols> bottomLeftCorner(Index cRows, Index cCols)
358 {
359  return Block<Derived, CRows, CCols>(derived(), rows() - cRows, 0, cRows, cCols);
360 }
361 
363 template<int CRows, int CCols>
364 inline const Block<const Derived, CRows, CCols> bottomLeftCorner(Index cRows, Index cCols) const
365 {
366  return Block<const Derived, CRows, CCols>(derived(), rows() - cRows, 0, cRows, cCols);
367 }
368 
369 
370 
380 inline RowsBlockXpr topRows(Index n)
381 {
382  return RowsBlockXpr(derived(), 0, 0, n, cols());
383 }
384 
386 inline ConstRowsBlockXpr topRows(Index n) const
387 {
388  return ConstRowsBlockXpr(derived(), 0, 0, n, cols());
389 }
390 
400 template<int N>
402 {
403  return typename NRowsBlockXpr<N>::Type(derived(), 0, 0, N, cols());
404 }
405 
407 template<int N>
408 inline typename ConstNRowsBlockXpr<N>::Type topRows() const
409 {
410  return typename ConstNRowsBlockXpr<N>::Type(derived(), 0, 0, N, cols());
411 }
412 
413 
414 
424 inline RowsBlockXpr bottomRows(Index n)
425 {
426  return RowsBlockXpr(derived(), rows() - n, 0, n, cols());
427 }
428 
430 inline ConstRowsBlockXpr bottomRows(Index n) const
431 {
432  return ConstRowsBlockXpr(derived(), rows() - n, 0, n, cols());
433 }
434 
444 template<int N>
446 {
447  return typename NRowsBlockXpr<N>::Type(derived(), rows() - N, 0, N, cols());
448 }
449 
451 template<int N>
453 {
454  return typename ConstNRowsBlockXpr<N>::Type(derived(), rows() - N, 0, N, cols());
455 }
456 
457 
458 
469 inline RowsBlockXpr middleRows(Index startRow, Index numRows)
470 {
471  return RowsBlockXpr(derived(), startRow, 0, numRows, cols());
472 }
473 
475 inline ConstRowsBlockXpr middleRows(Index startRow, Index numRows) const
476 {
477  return ConstRowsBlockXpr(derived(), startRow, 0, numRows, cols());
478 }
479 
490 template<int N>
491 inline typename NRowsBlockXpr<N>::Type middleRows(Index startRow)
492 {
493  return typename NRowsBlockXpr<N>::Type(derived(), startRow, 0, N, cols());
494 }
495 
497 template<int N>
498 inline typename ConstNRowsBlockXpr<N>::Type middleRows(Index startRow) const
499 {
500  return typename ConstNRowsBlockXpr<N>::Type(derived(), startRow, 0, N, cols());
501 }
502 
503 
504 
514 inline ColsBlockXpr leftCols(Index n)
515 {
516  return ColsBlockXpr(derived(), 0, 0, rows(), n);
517 }
518 
520 inline ConstColsBlockXpr leftCols(Index n) const
521 {
522  return ConstColsBlockXpr(derived(), 0, 0, rows(), n);
523 }
524 
534 template<int N>
536 {
537  return typename NColsBlockXpr<N>::Type(derived(), 0, 0, rows(), N);
538 }
539 
541 template<int N>
542 inline typename ConstNColsBlockXpr<N>::Type leftCols() const
543 {
544  return typename ConstNColsBlockXpr<N>::Type(derived(), 0, 0, rows(), N);
545 }
546 
547 
548 
558 inline ColsBlockXpr rightCols(Index n)
559 {
560  return ColsBlockXpr(derived(), 0, cols() - n, rows(), n);
561 }
562 
564 inline ConstColsBlockXpr rightCols(Index n) const
565 {
566  return ConstColsBlockXpr(derived(), 0, cols() - n, rows(), n);
567 }
568 
578 template<int N>
580 {
581  return typename NColsBlockXpr<N>::Type(derived(), 0, cols() - N, rows(), N);
582 }
583 
585 template<int N>
586 inline typename ConstNColsBlockXpr<N>::Type rightCols() const
587 {
588  return typename ConstNColsBlockXpr<N>::Type(derived(), 0, cols() - N, rows(), N);
589 }
590 
591 
592 
603 inline ColsBlockXpr middleCols(Index startCol, Index numCols)
604 {
605  return ColsBlockXpr(derived(), 0, startCol, rows(), numCols);
606 }
607 
609 inline ConstColsBlockXpr middleCols(Index startCol, Index numCols) const
610 {
611  return ConstColsBlockXpr(derived(), 0, startCol, rows(), numCols);
612 }
613 
624 template<int N>
625 inline typename NColsBlockXpr<N>::Type middleCols(Index startCol)
626 {
627  return typename NColsBlockXpr<N>::Type(derived(), 0, startCol, rows(), N);
628 }
629 
631 template<int N>
632 inline typename ConstNColsBlockXpr<N>::Type middleCols(Index startCol) const
633 {
634  return typename ConstNColsBlockXpr<N>::Type(derived(), 0, startCol, rows(), N);
635 }
636 
637 
638 
655 template<int BlockRows, int BlockCols>
656 inline Block<Derived, BlockRows, BlockCols> block(Index startRow, Index startCol)
657 {
658  return Block<Derived, BlockRows, BlockCols>(derived(), startRow, startCol);
659 }
660 
662 template<int BlockRows, int BlockCols>
663 inline const Block<const Derived, BlockRows, BlockCols> block(Index startRow, Index startCol) const
664 {
665  return Block<const Derived, BlockRows, BlockCols>(derived(), startRow, startCol);
666 }
667 
687 template<int BlockRows, int BlockCols>
688 inline Block<Derived, BlockRows, BlockCols> block(Index startRow, Index startCol,
689  Index blockRows, Index blockCols)
690 {
691  return Block<Derived, BlockRows, BlockCols>(derived(), startRow, startCol, blockRows, blockCols);
692 }
693 
695 template<int BlockRows, int BlockCols>
696 inline const Block<const Derived, BlockRows, BlockCols> block(Index startRow, Index startCol,
697  Index blockRows, Index blockCols) const
698 {
699  return Block<const Derived, BlockRows, BlockCols>(derived(), startRow, startCol, blockRows, blockCols);
700 }
701 
708 inline ColXpr col(Index i)
709 {
710  return ColXpr(derived(), i);
711 }
712 
714 inline ConstColXpr col(Index i) const
715 {
716  return ConstColXpr(derived(), i);
717 }
718 
725 inline RowXpr row(Index i)
726 {
727  return RowXpr(derived(), i);
728 }
729 
731 inline ConstRowXpr row(Index i) const
732 {
733  return ConstRowXpr(derived(), i);
734 }
735 
752 inline SegmentReturnType segment(Index start, Index vecSize)
753 {
755  return SegmentReturnType(derived(), start, vecSize);
756 }
757 
758 
760 inline ConstSegmentReturnType segment(Index start, Index vecSize) const
761 {
763  return ConstSegmentReturnType(derived(), start, vecSize);
764 }
765 
781 inline SegmentReturnType head(Index vecSize)
782 {
784  return SegmentReturnType(derived(), 0, vecSize);
785 }
786 
789  head(Index vecSize) const
790 {
792  return ConstSegmentReturnType(derived(), 0, vecSize);
793 }
794 
810 inline SegmentReturnType tail(Index vecSize)
811 {
813  return SegmentReturnType(derived(), this->size() - vecSize, vecSize);
814 }
815 
817 inline ConstSegmentReturnType tail(Index vecSize) const
818 {
820  return ConstSegmentReturnType(derived(), this->size() - vecSize, vecSize);
821 }
822 
836 template<int Size>
837 inline typename FixedSegmentReturnType<Size>::Type segment(Index start)
838 {
840  return typename FixedSegmentReturnType<Size>::Type(derived(), start);
841 }
842 
844 template<int Size>
845 inline typename ConstFixedSegmentReturnType<Size>::Type segment(Index start) const
846 {
848  return typename ConstFixedSegmentReturnType<Size>::Type(derived(), start);
849 }
850 
862 template<int Size>
864 {
866  return typename FixedSegmentReturnType<Size>::Type(derived(), 0);
867 }
868 
870 template<int Size>
872 {
874  return typename ConstFixedSegmentReturnType<Size>::Type(derived(), 0);
875 }
876 
888 template<int Size>
890 {
892  return typename FixedSegmentReturnType<Size>::Type(derived(), size() - Size);
893 }
894 
896 template<int Size>
898 {
900  return typename ConstFixedSegmentReturnType<Size>::Type(derived(), size() - Size);
901 }
Block< Derived, 1, internal::traits< Derived >::ColsAtCompileTime, IsRowMajor > RowXpr
Definition: BlockMethods.h:18
#define N
Block< Derived > bottomRightCorner(Index cRows, Index cCols)
Definition: BlockMethods.h:231
VectorBlock< Derived > SegmentReturnType
Definition: BlockMethods.h:33
Block< Derived, internal::traits< Derived >::RowsAtCompileTime, Dynamic,!IsRowMajor > ColsBlockXpr
Definition: BlockMethods.h:21
const Block< const Derived, internal::traits< Derived >::RowsAtCompileTime, 1,!IsRowMajor > ConstColXpr
Definition: BlockMethods.h:16
ColsBlockXpr leftCols(Index n)
Definition: BlockMethods.h:514
const Block< const Derived, internal::traits< Derived >::RowsAtCompileTime, N,!IsRowMajor > Type
Definition: BlockMethods.h:28
Block< Derived, internal::traits< Derived >::RowsAtCompileTime, 1,!IsRowMajor > ColXpr
Definition: BlockMethods.h:15
SegmentReturnType segment(Index start, Index vecSize)
Definition: BlockMethods.h:752
Block< Derived > block(Index startRow, Index startCol, Index blockRows, Index blockCols)
Definition: BlockMethods.h:56
const Block< const Derived, Dynamic, internal::traits< Derived >::ColsAtCompileTime, IsRowMajor > ConstRowsBlockXpr
Definition: BlockMethods.h:25
Block< Derived > topLeftCorner(Index cRows, Index cCols)
Definition: BlockMethods.h:156
RowsBlockXpr bottomRows(Index n)
Definition: BlockMethods.h:424
Block< Derived, Dynamic, internal::traits< Derived >::ColsAtCompileTime, IsRowMajor > RowsBlockXpr
Definition: BlockMethods.h:24
ColsBlockXpr middleCols(Index startCol, Index numCols)
Definition: BlockMethods.h:603
Block< Derived, internal::traits< Derived >::RowsAtCompileTime, N,!IsRowMajor > Type
Definition: BlockMethods.h:27
Block< Derived, N, internal::traits< Derived >::ColsAtCompileTime, IsRowMajor > Type
Definition: BlockMethods.h:30
SegmentReturnType tail(Index vecSize)
Definition: BlockMethods.h:810
ColsBlockXpr rightCols(Index n)
Definition: BlockMethods.h:558
const Block< const Derived, 1, internal::traits< Derived >::ColsAtCompileTime, IsRowMajor > ConstRowXpr
Definition: BlockMethods.h:19
const VectorBlock< const Derived > ConstSegmentReturnType
Definition: BlockMethods.h:34
Block< Derived > bottomLeftCorner(Index cRows, Index cCols)
Definition: BlockMethods.h:306
RowsBlockXpr middleRows(Index startRow, Index numRows)
Definition: BlockMethods.h:469
SegmentReturnType head(Index vecSize)
Definition: BlockMethods.h:781
const VectorBlock< const Derived, Size > Type
Definition: BlockMethods.h:36
RowXpr row(Index i)
Definition: BlockMethods.h:725
VectorBlock< Derived, Size > Type
Definition: BlockMethods.h:35
const Block< const Derived, internal::traits< Derived >::RowsAtCompileTime, Dynamic,!IsRowMajor > ConstColsBlockXpr
Definition: BlockMethods.h:22
RowsBlockXpr topRows(Index n)
Definition: BlockMethods.h:380
Block< Derived > topRightCorner(Index cRows, Index cCols)
Definition: BlockMethods.h:80
ColXpr col(Index i)
Definition: BlockMethods.h:708
#define EIGEN_STATIC_ASSERT_VECTOR_ONLY(TYPE)
Definition: StaticAssert.h:126
const Block< const Derived, N, internal::traits< Derived >::ColsAtCompileTime, IsRowMajor > Type
Definition: BlockMethods.h:31


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:34:29