Eigen  5.0.1-dev+master
 
Loading...
Searching...
No Matches
BlockMethods.inc
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// SPDX-License-Identifier: MPL-2.0
11
12#ifndef EIGEN_PARSED_BY_DOXYGEN
13
15using ColXpr = Block<Derived, internal::traits<Derived>::RowsAtCompileTime, 1, !IsRowMajor>;
16using ConstColXpr = const Block<const Derived, internal::traits<Derived>::RowsAtCompileTime, 1, !IsRowMajor>;
18using RowXpr = Block<Derived, 1, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor>;
19using ConstRowXpr = const Block<const Derived, 1, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor>;
21using ColsBlockXpr = Block<Derived, internal::traits<Derived>::RowsAtCompileTime, Dynamic, !IsRowMajor>;
22using ConstColsBlockXpr =
23 const Block<const Derived, internal::traits<Derived>::RowsAtCompileTime, Dynamic, !IsRowMajor>;
25using RowsBlockXpr = Block<Derived, Dynamic, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor>;
26using ConstRowsBlockXpr = const Block<const Derived, Dynamic, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor>;
28template <int N>
29struct NColsBlockXpr {
30 using Type = Block<Derived, internal::traits<Derived>::RowsAtCompileTime, N, !IsRowMajor>;
31};
32template <int N>
33struct ConstNColsBlockXpr {
34 using Type = const Block<const Derived, internal::traits<Derived>::RowsAtCompileTime, N, !IsRowMajor>;
35};
37template <int N>
38struct NRowsBlockXpr {
39 using Type = Block<Derived, N, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor>;
40};
41template <int N>
42struct ConstNRowsBlockXpr {
43 using Type = const Block<const Derived, N, internal::traits<Derived>::ColsAtCompileTime, IsRowMajor>;
44};
46using BlockXpr = Block<Derived>;
47using ConstBlockXpr = const Block<const Derived>;
49template <int Rows, int Cols>
50struct FixedBlockXpr {
51 using Type = Block<Derived, Rows, Cols>;
52};
53template <int Rows, int Cols>
54struct ConstFixedBlockXpr {
55 using Type = Block<const Derived, Rows, Cols>;
56};
57
58using SegmentReturnType = VectorBlock<Derived>;
59using ConstSegmentReturnType = const VectorBlock<const Derived>;
60template <int Size>
61struct FixedSegmentReturnType {
62 using Type = VectorBlock<Derived, Size>;
63};
64template <int Size>
65struct ConstFixedSegmentReturnType {
66 using Type = const VectorBlock<const Derived, Size>;
67};
68
70using InnerVectorReturnType = std::conditional_t<IsRowMajor, RowXpr, ColXpr>;
71using ConstInnerVectorReturnType = std::conditional_t<IsRowMajor, ConstRowXpr, ConstColXpr>;
72
74using InnerVectorsReturnType = std::conditional_t<IsRowMajor, RowsBlockXpr, ColsBlockXpr>;
75using ConstInnerVectorsReturnType = std::conditional_t<IsRowMajor, ConstRowsBlockXpr, ConstColsBlockXpr>;
76
77#endif // not EIGEN_PARSED_BY_DOXYGEN
78
110EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
114template <typename NRowsType, typename NColsType>
115EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
116#ifndef EIGEN_PARSED_BY_DOXYGEN
117 typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,
118 internal::get_fixed_value<NColsType>::value>::Type
119#else
120 typename FixedBlockXpr<..., ...>::Type
121#endif
122 block(Index startRow, Index startCol, NRowsType blockRows, NColsType blockCols) {
123 return
124 typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,
125 internal::get_fixed_value<NColsType>::value>::Type(derived(), startRow, startCol,
126 internal::get_runtime_value(blockRows),
127 internal::get_runtime_value(blockCols));
128}
129
131template <typename NRowsType, typename NColsType>
132EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
133#ifndef EIGEN_PARSED_BY_DOXYGEN
134 const typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,
135 internal::get_fixed_value<NColsType>::value>::Type
136#else
137 const typename ConstFixedBlockXpr<..., ...>::Type
138#endif
139 block(Index startRow, Index startCol, NRowsType blockRows, NColsType blockCols) const {
140 return typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,
141 internal::get_fixed_value<NColsType>::value>::Type(derived(), startRow, startCol,
142 internal::get_runtime_value(
143 blockRows),
144 internal::get_runtime_value(
145 blockCols));
146}
147
162EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
166template <typename NRowsType, typename NColsType>
167EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
168#ifndef EIGEN_PARSED_BY_DOXYGEN
169 typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,
170 internal::get_fixed_value<NColsType>::value>::Type
171#else
172 typename FixedBlockXpr<..., ...>::Type
173#endif
174 topRightCorner(NRowsType cRows, NColsType cCols) {
175 return typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,
176 internal::get_fixed_value<NColsType>::value>::Type(derived(), 0,
177 cols() - internal::get_runtime_value(
178 cCols),
179 internal::get_runtime_value(cRows),
180 internal::get_runtime_value(cCols));
181}
182
184template <typename NRowsType, typename NColsType>
185EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
186#ifndef EIGEN_PARSED_BY_DOXYGEN
187 const typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,
188 internal::get_fixed_value<NColsType>::value>::Type
189#else
190 const typename ConstFixedBlockXpr<..., ...>::Type
191#endif
192 topRightCorner(NRowsType cRows, NColsType cCols) const {
193 return
194 typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,
195 internal::get_fixed_value<NColsType>::value>::Type(derived(), 0,
196 cols() -
197 internal::get_runtime_value(
198 cCols),
199 internal::get_runtime_value(cRows),
200 internal::get_runtime_value(
201 cCols));
202}
203
212EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
216template <int CRows, int CCols>
217EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename FixedBlockXpr<CRows, CCols>::Type topRightCorner() {
218 return typename FixedBlockXpr<CRows, CCols>::Type(derived(), 0, cols() - CCols);
219}
220
222template <int CRows, int CCols>
223EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const typename ConstFixedBlockXpr<CRows, CCols>::Type topRightCorner()
224 const {
225 return typename ConstFixedBlockXpr<CRows, CCols>::Type(derived(), 0, cols() - CCols);
226}
227
243EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
247template <int CRows, int CCols>
248EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename FixedBlockXpr<CRows, CCols>::Type topRightCorner(Index cRows,
249 Index cCols) {
250 return typename FixedBlockXpr<CRows, CCols>::Type(derived(), 0, cols() - cCols, cRows, cCols);
251}
252
254template <int CRows, int CCols>
255EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const typename ConstFixedBlockXpr<CRows, CCols>::Type topRightCorner(
256 Index cRows, Index cCols) const {
257 return typename ConstFixedBlockXpr<CRows, CCols>::Type(derived(), 0, cols() - cCols, cRows, cCols);
258}
259
274EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
278template <typename NRowsType, typename NColsType>
279EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
280#ifndef EIGEN_PARSED_BY_DOXYGEN
281 typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,
282 internal::get_fixed_value<NColsType>::value>::Type
283#else
284 typename FixedBlockXpr<..., ...>::Type
285#endif
286 topLeftCorner(NRowsType cRows, NColsType cCols) {
287 return typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,
288 internal::get_fixed_value<NColsType>::value>::Type(derived(), 0, 0,
289 internal::get_runtime_value(cRows),
290 internal::get_runtime_value(cCols));
291}
292
294template <typename NRowsType, typename NColsType>
295EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
296#ifndef EIGEN_PARSED_BY_DOXYGEN
297 const typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,
298 internal::get_fixed_value<NColsType>::value>::Type
299#else
300 const typename ConstFixedBlockXpr<..., ...>::Type
301#endif
302 topLeftCorner(NRowsType cRows, NColsType cCols) const {
303 return
304 typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,
305 internal::get_fixed_value<NColsType>::value>::Type(derived(), 0, 0,
306 internal::get_runtime_value(cRows),
307 internal::get_runtime_value(
308 cCols));
309}
310
318EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
322template <int CRows, int CCols>
323EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename FixedBlockXpr<CRows, CCols>::Type topLeftCorner() {
324 return typename FixedBlockXpr<CRows, CCols>::Type(derived(), 0, 0);
325}
326
328template <int CRows, int CCols>
329EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const typename ConstFixedBlockXpr<CRows, CCols>::Type topLeftCorner()
330 const {
331 return typename ConstFixedBlockXpr<CRows, CCols>::Type(derived(), 0, 0);
332}
333
349EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
353template <int CRows, int CCols>
354EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename FixedBlockXpr<CRows, CCols>::Type topLeftCorner(Index cRows,
355 Index cCols) {
356 return typename FixedBlockXpr<CRows, CCols>::Type(derived(), 0, 0, cRows, cCols);
357}
358
360template <int CRows, int CCols>
361EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const typename ConstFixedBlockXpr<CRows, CCols>::Type topLeftCorner(
362 Index cRows, Index cCols) const {
363 return typename ConstFixedBlockXpr<CRows, CCols>::Type(derived(), 0, 0, cRows, cCols);
364}
365
380EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
384template <typename NRowsType, typename NColsType>
385EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
386#ifndef EIGEN_PARSED_BY_DOXYGEN
387 typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,
388 internal::get_fixed_value<NColsType>::value>::Type
389#else
390 typename FixedBlockXpr<..., ...>::Type
391#endif
392 bottomRightCorner(NRowsType cRows, NColsType cCols) {
393 return
394 typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value, internal::get_fixed_value<NColsType>::value>::
395 Type(derived(), rows() - internal::get_runtime_value(cRows), cols() - internal::get_runtime_value(cCols),
396 internal::get_runtime_value(cRows), internal::get_runtime_value(cCols));
397}
398
400template <typename NRowsType, typename NColsType>
401EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
402#ifndef EIGEN_PARSED_BY_DOXYGEN
403 const typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,
404 internal::get_fixed_value<NColsType>::value>::Type
405#else
406 const typename ConstFixedBlockXpr<..., ...>::Type
407#endif
408 bottomRightCorner(NRowsType cRows, NColsType cCols) const {
409 return typename ConstFixedBlockXpr<
410 internal::get_fixed_value<NRowsType>::value,
411 internal::get_fixed_value<NColsType>::value>::Type(derived(), rows() - internal::get_runtime_value(cRows),
412 cols() - internal::get_runtime_value(cCols),
413 internal::get_runtime_value(cRows),
414 internal::get_runtime_value(cCols));
415}
416
424EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
428template <int CRows, int CCols>
429EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename FixedBlockXpr<CRows, CCols>::Type bottomRightCorner() {
430 return typename FixedBlockXpr<CRows, CCols>::Type(derived(), rows() - CRows, cols() - CCols);
431}
432
434template <int CRows, int CCols>
435EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const typename ConstFixedBlockXpr<CRows, CCols>::Type
436bottomRightCorner() const {
437 return typename ConstFixedBlockXpr<CRows, CCols>::Type(derived(), rows() - CRows, cols() - CCols);
438}
439
455EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
459template <int CRows, int CCols>
460EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename FixedBlockXpr<CRows, CCols>::Type bottomRightCorner(
461 Index cRows, Index cCols) {
462 return typename FixedBlockXpr<CRows, CCols>::Type(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
463}
464
466template <int CRows, int CCols>
467EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const typename ConstFixedBlockXpr<CRows, CCols>::Type bottomRightCorner(
468 Index cRows, Index cCols) const {
469 return typename ConstFixedBlockXpr<CRows, CCols>::Type(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
470}
471
486EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
490template <typename NRowsType, typename NColsType>
491EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
492#ifndef EIGEN_PARSED_BY_DOXYGEN
493 typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,
494 internal::get_fixed_value<NColsType>::value>::Type
495#else
496 typename FixedBlockXpr<..., ...>::Type
497#endif
498 bottomLeftCorner(NRowsType cRows, NColsType cCols) {
499 return
500 typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,
501 internal::get_fixed_value<NColsType>::value>::Type(derived(),
502 rows() -
503 internal::get_runtime_value(cRows),
504 0, internal::get_runtime_value(cRows),
505 internal::get_runtime_value(cCols));
506}
507
509template <typename NRowsType, typename NColsType>
510EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
511#ifndef EIGEN_PARSED_BY_DOXYGEN
512 typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,
513 internal::get_fixed_value<NColsType>::value>::Type
514#else
515 typename ConstFixedBlockXpr<..., ...>::Type
516#endif
517 bottomLeftCorner(NRowsType cRows, NColsType cCols) const {
518 return typename ConstFixedBlockXpr<
519 internal::get_fixed_value<NRowsType>::value,
520 internal::get_fixed_value<NColsType>::value>::Type(derived(), rows() - internal::get_runtime_value(cRows), 0,
521 internal::get_runtime_value(cRows),
522 internal::get_runtime_value(cCols));
523}
524
532EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
536template <int CRows, int CCols>
537EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename FixedBlockXpr<CRows, CCols>::Type bottomLeftCorner() {
538 return typename FixedBlockXpr<CRows, CCols>::Type(derived(), rows() - CRows, 0);
539}
540
542template <int CRows, int CCols>
543EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const typename ConstFixedBlockXpr<CRows, CCols>::Type bottomLeftCorner()
544 const {
545 return typename ConstFixedBlockXpr<CRows, CCols>::Type(derived(), rows() - CRows, 0);
546}
547
563EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
567template <int CRows, int CCols>
568EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename FixedBlockXpr<CRows, CCols>::Type bottomLeftCorner(
569 Index cRows, Index cCols) {
570 return typename FixedBlockXpr<CRows, CCols>::Type(derived(), rows() - cRows, 0, cRows, cCols);
571}
572
574template <int CRows, int CCols>
575EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const typename ConstFixedBlockXpr<CRows, CCols>::Type bottomLeftCorner(
576 Index cRows, Index cCols) const {
577 return typename ConstFixedBlockXpr<CRows, CCols>::Type(derived(), rows() - cRows, 0, cRows, cCols);
578}
579
592EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(row - major)
596template <typename NRowsType>
597EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
598#ifndef EIGEN_PARSED_BY_DOXYGEN
599 typename NRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type
600#else
601 typename NRowsBlockXpr<...>::Type
602#endif
603 topRows(NRowsType n) {
604 return typename NRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type(
605 derived(), 0, 0, internal::get_runtime_value(n), cols());
606}
607
609template <typename NRowsType>
610EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
611#ifndef EIGEN_PARSED_BY_DOXYGEN
612 const typename ConstNRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type
613#else
614 const typename ConstNRowsBlockXpr<...>::Type
615#endif
616 topRows(NRowsType n) const {
617 return typename ConstNRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type(
618 derived(), 0, 0, internal::get_runtime_value(n), cols());
619}
620
632EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(row - major)
636template <int N>
637EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename NRowsBlockXpr<N>::Type topRows(Index n = N) {
638 return typename NRowsBlockXpr<N>::Type(derived(), 0, 0, n, cols());
639}
640
642template <int N>
643EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename ConstNRowsBlockXpr<N>::Type topRows(Index n = N) const {
644 return typename ConstNRowsBlockXpr<N>::Type(derived(), 0, 0, n, cols());
645}
646
659EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(row - major)
663template <typename NRowsType>
664EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
665#ifndef EIGEN_PARSED_BY_DOXYGEN
666 typename NRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type
667#else
668 typename NRowsBlockXpr<...>::Type
669#endif
670 bottomRows(NRowsType n) {
671 return typename NRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type(
672 derived(), rows() - internal::get_runtime_value(n), 0, internal::get_runtime_value(n), cols());
673}
674
676template <typename NRowsType>
677EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
678#ifndef EIGEN_PARSED_BY_DOXYGEN
679 const typename ConstNRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type
680#else
681 const typename ConstNRowsBlockXpr<...>::Type
682#endif
683 bottomRows(NRowsType n) const {
684 return typename ConstNRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type(
685 derived(), rows() - internal::get_runtime_value(n), 0, internal::get_runtime_value(n), cols());
686}
687
699EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(row - major)
703template <int N>
704EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename NRowsBlockXpr<N>::Type bottomRows(Index n = N) {
705 return typename NRowsBlockXpr<N>::Type(derived(), rows() - n, 0, n, cols());
706}
707
709template <int N>
710EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename ConstNRowsBlockXpr<N>::Type bottomRows(Index n = N) const {
711 return typename ConstNRowsBlockXpr<N>::Type(derived(), rows() - n, 0, n, cols());
712}
713
727EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(row - major)
731template <typename NRowsType>
732EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
733#ifndef EIGEN_PARSED_BY_DOXYGEN
734 typename NRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type
735#else
736 typename NRowsBlockXpr<...>::Type
737#endif
738 middleRows(Index startRow, NRowsType n) {
739 return typename NRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type(
740 derived(), startRow, 0, internal::get_runtime_value(n), cols());
741}
742
744template <typename NRowsType>
745EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
746#ifndef EIGEN_PARSED_BY_DOXYGEN
747 const typename ConstNRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type
748#else
749 const typename ConstNRowsBlockXpr<...>::Type
750#endif
751 middleRows(Index startRow, NRowsType n) const {
752 return typename ConstNRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type(
753 derived(), startRow, 0, internal::get_runtime_value(n), cols());
754}
755
768EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(row - major)
772template <int N>
773EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename NRowsBlockXpr<N>::Type middleRows(Index startRow,
774 Index n = N) {
775 return typename NRowsBlockXpr<N>::Type(derived(), startRow, 0, n, cols());
776}
777
779template <int N>
780EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename ConstNRowsBlockXpr<N>::Type middleRows(Index startRow,
781 Index n = N) const {
782 return typename ConstNRowsBlockXpr<N>::Type(derived(), startRow, 0, n, cols());
783}
784
797EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(column - major)
801template <typename NColsType>
802EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
803#ifndef EIGEN_PARSED_BY_DOXYGEN
804 typename NColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type
805#else
806 typename NColsBlockXpr<...>::Type
807#endif
808 leftCols(NColsType n) {
809 return typename NColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type(derived(), 0, 0, rows(),
810 internal::get_runtime_value(n));
811}
812
814template <typename NColsType>
815EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
816#ifndef EIGEN_PARSED_BY_DOXYGEN
817 const typename ConstNColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type
818#else
819 const typename ConstNColsBlockXpr<...>::Type
820#endif
821 leftCols(NColsType n) const {
822 return typename ConstNColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type(derived(), 0, 0, rows(),
823 internal::get_runtime_value(n));
824}
825
837EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(column - major)
841template <int N>
842EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename NColsBlockXpr<N>::Type leftCols(Index n = N) {
843 return typename NColsBlockXpr<N>::Type(derived(), 0, 0, rows(), n);
844}
845
847template <int N>
848EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename ConstNColsBlockXpr<N>::Type leftCols(Index n = N) const {
849 return typename ConstNColsBlockXpr<N>::Type(derived(), 0, 0, rows(), n);
850}
851
864EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(column - major)
868template <typename NColsType>
869EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
870#ifndef EIGEN_PARSED_BY_DOXYGEN
871 typename NColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type
872#else
873 typename NColsBlockXpr<...>::Type
874#endif
875 rightCols(NColsType n) {
876 return typename NColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type(
877 derived(), 0, cols() - internal::get_runtime_value(n), rows(), internal::get_runtime_value(n));
878}
879
881template <typename NColsType>
882EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
883#ifndef EIGEN_PARSED_BY_DOXYGEN
884 const typename ConstNColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type
885#else
886 const typename ConstNColsBlockXpr<...>::Type
887#endif
888 rightCols(NColsType n) const {
889 return typename ConstNColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type(
890 derived(), 0, cols() - internal::get_runtime_value(n), rows(), internal::get_runtime_value(n));
891}
892
904EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(column - major)
908template <int N>
909EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename NColsBlockXpr<N>::Type rightCols(Index n = N) {
910 return typename NColsBlockXpr<N>::Type(derived(), 0, cols() - n, rows(), n);
911}
912
914template <int N>
915EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename ConstNColsBlockXpr<N>::Type rightCols(Index n = N) const {
916 return typename ConstNColsBlockXpr<N>::Type(derived(), 0, cols() - n, rows(), n);
917}
918
932EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(column - major)
936template <typename NColsType>
937EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
938#ifndef EIGEN_PARSED_BY_DOXYGEN
939 typename NColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type
940#else
941 typename NColsBlockXpr<...>::Type
942#endif
943 middleCols(Index startCol, NColsType numCols) {
944 return typename NColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type(
945 derived(), 0, startCol, rows(), internal::get_runtime_value(numCols));
946}
947
949template <typename NColsType>
950EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
951#ifndef EIGEN_PARSED_BY_DOXYGEN
952 const typename ConstNColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type
953#else
954 const typename ConstNColsBlockXpr<...>::Type
955#endif
956 middleCols(Index startCol, NColsType numCols) const {
957 return typename ConstNColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type(
958 derived(), 0, startCol, rows(), internal::get_runtime_value(numCols));
959}
960
973EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(column - major)
977template <int N>
978EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename NColsBlockXpr<N>::Type middleCols(Index startCol,
979 Index n = N) {
980 return typename NColsBlockXpr<N>::Type(derived(), 0, startCol, rows(), n);
981}
982
984template <int N>
985EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename ConstNColsBlockXpr<N>::Type middleCols(Index startCol,
986 Index n = N) const {
987 return typename ConstNColsBlockXpr<N>::Type(derived(), 0, startCol, rows(), n);
988}
989
1010EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
1014template <int NRows, int NCols>
1015EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename FixedBlockXpr<NRows, NCols>::Type block(Index startRow,
1016 Index startCol) {
1017 return typename FixedBlockXpr<NRows, NCols>::Type(derived(), startRow, startCol);
1018}
1019
1021template <int NRows, int NCols>
1022EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const typename ConstFixedBlockXpr<NRows, NCols>::Type block(
1023 Index startRow, Index startCol) const {
1024 return typename ConstFixedBlockXpr<NRows, NCols>::Type(derived(), startRow, startCol);
1025}
1026
1054EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
1058template <int NRows, int NCols>
1059EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename FixedBlockXpr<NRows, NCols>::Type block(Index startRow,
1060 Index startCol,
1061 Index blockRows,
1062 Index blockCols) {
1063 return typename FixedBlockXpr<NRows, NCols>::Type(derived(), startRow, startCol, blockRows, blockCols);
1064}
1065
1067template <int NRows, int NCols>
1068EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const typename ConstFixedBlockXpr<NRows, NCols>::Type block(
1069 Index startRow, Index startCol, Index blockRows, Index blockCols) const {
1070 return typename ConstFixedBlockXpr<NRows, NCols>::Type(derived(), startRow, startCol, blockRows, blockCols);
1071}
1072
1078EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(column - major)
1081EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE ColXpr col(Index i) { return ColXpr(derived(), i); }
1082
1084EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE ConstColXpr col(Index i) const { return ConstColXpr(derived(), i); }
1085
1091EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(row - major)
1094EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE RowXpr row(Index i) { return RowXpr(derived(), i); }
1095
1097EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE ConstRowXpr row(Index i) const { return ConstRowXpr(derived(), i); }
1098
1120template <typename NType>
1121EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
1122#ifndef EIGEN_PARSED_BY_DOXYGEN
1123 typename FixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type
1124#else
1125 typename FixedSegmentReturnType<...>::Type
1126#endif
1127 segment(Index start, NType n) {
1128 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
1129 return typename FixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type(derived(), start,
1130 internal::get_runtime_value(n));
1131}
1132
1134template <typename NType>
1135EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
1136#ifndef EIGEN_PARSED_BY_DOXYGEN
1137 const typename ConstFixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type
1138#else
1139 const typename ConstFixedSegmentReturnType<...>::Type
1140#endif
1141 segment(Index start, NType n) const {
1142 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
1143 return typename ConstFixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type(
1144 derived(), start, internal::get_runtime_value(n));
1145}
1146
1167template <typename NType>
1168EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
1169#ifndef EIGEN_PARSED_BY_DOXYGEN
1170 typename FixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type
1171#else
1172 typename FixedSegmentReturnType<...>::Type
1173#endif
1174 head(NType n) {
1175 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
1176 return typename FixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type(derived(), 0,
1177 internal::get_runtime_value(n));
1178}
1179
1181template <typename NType>
1182EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
1183#ifndef EIGEN_PARSED_BY_DOXYGEN
1184 const typename ConstFixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type
1185#else
1186 const typename ConstFixedSegmentReturnType<...>::Type
1187#endif
1188 head(NType n) const {
1189 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
1190 return typename ConstFixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type(
1191 derived(), 0, internal::get_runtime_value(n));
1192}
1193
1214template <typename NType>
1215EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
1216#ifndef EIGEN_PARSED_BY_DOXYGEN
1217 typename FixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type
1218#else
1219 typename FixedSegmentReturnType<...>::Type
1220#endif
1221 tail(NType n) {
1222 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
1223 return typename FixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type(
1224 derived(), this->size() - internal::get_runtime_value(n), internal::get_runtime_value(n));
1225}
1226
1228template <typename NType>
1229EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
1230#ifndef EIGEN_PARSED_BY_DOXYGEN
1231 const typename ConstFixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type
1232#else
1233 const typename ConstFixedSegmentReturnType<...>::Type
1234#endif
1235 tail(NType n) const {
1236 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
1237 return typename ConstFixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type(
1238 derived(), this->size() - internal::get_runtime_value(n), internal::get_runtime_value(n));
1239}
1240
1257template <int N>
1258EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename FixedSegmentReturnType<N>::Type segment(Index start,
1259 Index n = N) {
1260 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
1261 return typename FixedSegmentReturnType<N>::Type(derived(), start, n);
1262}
1263
1265template <int N>
1266EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename ConstFixedSegmentReturnType<N>::Type segment(
1267 Index start, Index n = N) const {
1268 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
1269 return typename ConstFixedSegmentReturnType<N>::Type(derived(), start, n);
1270}
1271
1287template <int N>
1288EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename FixedSegmentReturnType<N>::Type head(Index n = N) {
1289 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
1290 return typename FixedSegmentReturnType<N>::Type(derived(), 0, n);
1291}
1292
1294template <int N>
1295EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename ConstFixedSegmentReturnType<N>::Type head(Index n = N) const {
1296 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
1297 return typename ConstFixedSegmentReturnType<N>::Type(derived(), 0, n);
1298}
1299
1315template <int N>
1316EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename FixedSegmentReturnType<N>::Type tail(Index n = N) {
1317 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
1318 return typename FixedSegmentReturnType<N>::Type(derived(), size() - n, n);
1319}
1320
1322template <int N>
1323EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename ConstFixedSegmentReturnType<N>::Type tail(Index n = N) const {
1324 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
1325 return typename ConstFixedSegmentReturnType<N>::Type(derived(), size() - n, n);
1326}
1327
1331EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE InnerVectorReturnType innerVector(Index outer) {
1332 return InnerVectorReturnType(derived(), outer);
1333}
1334
1338EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const ConstInnerVectorReturnType innerVector(Index outer) const {
1339 return ConstInnerVectorReturnType(derived(), outer);
1340}
1341
1345EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE InnerVectorsReturnType innerVectors(Index outerStart, Index outerSize) {
1346 return InnerVectorsReturnType(derived(), IsRowMajor ? outerStart : 0, IsRowMajor ? 0 : outerStart,
1347 IsRowMajor ? outerSize : rows(), IsRowMajor ? cols() : outerSize);
1348}
1349
1353EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const ConstInnerVectorsReturnType innerVectors(Index outerStart,
1354 Index outerSize) const {
1355 return ConstInnerVectorsReturnType(derived(), IsRowMajor ? outerStart : 0, IsRowMajor ? 0 : outerStart,
1356 IsRowMajor ? outerSize : rows(), IsRowMajor ? cols() : outerSize);
1357}
1358
1362template <DirectionType Direction>
1363EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE std::conditional_t<Direction == Vertical, ColXpr, RowXpr> subVector(
1364 Index i) {
1365 return std::conditional_t<Direction == Vertical, ColXpr, RowXpr>(derived(), i);
1366}
1367
1369template <DirectionType Direction>
1370EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE std::conditional_t<Direction == Vertical, ConstColXpr, ConstRowXpr>
1371subVector(Index i) const {
1372 return std::conditional_t<Direction == Vertical, ConstColXpr, ConstRowXpr>(derived(), i);
1373}
1374
1378template <DirectionType Direction>
1379EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index subVectors() const {
1380 return (Direction == Vertical) ? cols() : rows();
1381}