Eigen  5.0.1
 
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_STRONG_INLINE typename FixedBlockXpr<CRows, CCols>::Type bottomLeftCorner(Index cRows, Index cCols) {
569 return typename FixedBlockXpr<CRows, CCols>::Type(derived(), rows() - cRows, 0, cRows, cCols);
570}
571
573template <int CRows, int CCols>
574EIGEN_STRONG_INLINE const typename ConstFixedBlockXpr<CRows, CCols>::Type bottomLeftCorner(Index cRows,
575 Index cCols) const {
576 return typename ConstFixedBlockXpr<CRows, CCols>::Type(derived(), rows() - cRows, 0, cRows, cCols);
577}
578
591EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(row - major)
595template <typename NRowsType>
596EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
597#ifndef EIGEN_PARSED_BY_DOXYGEN
598 typename NRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type
599#else
600 typename NRowsBlockXpr<...>::Type
601#endif
602 topRows(NRowsType n) {
603 return typename NRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type(
604 derived(), 0, 0, internal::get_runtime_value(n), cols());
605}
606
608template <typename NRowsType>
609EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
610#ifndef EIGEN_PARSED_BY_DOXYGEN
611 const typename ConstNRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type
612#else
613 const typename ConstNRowsBlockXpr<...>::Type
614#endif
615 topRows(NRowsType n) const {
616 return typename ConstNRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type(
617 derived(), 0, 0, internal::get_runtime_value(n), cols());
618}
619
631EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(row - major)
635template <int N>
636EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename NRowsBlockXpr<N>::Type topRows(Index n = N) {
637 return typename NRowsBlockXpr<N>::Type(derived(), 0, 0, n, cols());
638}
639
641template <int N>
642EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename ConstNRowsBlockXpr<N>::Type topRows(Index n = N) const {
643 return typename ConstNRowsBlockXpr<N>::Type(derived(), 0, 0, n, cols());
644}
645
658EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(row - major)
662template <typename NRowsType>
663EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
664#ifndef EIGEN_PARSED_BY_DOXYGEN
665 typename NRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type
666#else
667 typename NRowsBlockXpr<...>::Type
668#endif
669 bottomRows(NRowsType n) {
670 return typename NRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type(
671 derived(), rows() - internal::get_runtime_value(n), 0, internal::get_runtime_value(n), cols());
672}
673
675template <typename NRowsType>
676EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
677#ifndef EIGEN_PARSED_BY_DOXYGEN
678 const typename ConstNRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type
679#else
680 const typename ConstNRowsBlockXpr<...>::Type
681#endif
682 bottomRows(NRowsType n) const {
683 return typename ConstNRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type(
684 derived(), rows() - internal::get_runtime_value(n), 0, internal::get_runtime_value(n), cols());
685}
686
698EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(row - major)
702template <int N>
703EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename NRowsBlockXpr<N>::Type bottomRows(Index n = N) {
704 return typename NRowsBlockXpr<N>::Type(derived(), rows() - n, 0, n, cols());
705}
706
708template <int N>
709EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename ConstNRowsBlockXpr<N>::Type bottomRows(Index n = N) const {
710 return typename ConstNRowsBlockXpr<N>::Type(derived(), rows() - n, 0, n, cols());
711}
712
726EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(row - major)
730template <typename NRowsType>
731EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
732#ifndef EIGEN_PARSED_BY_DOXYGEN
733 typename NRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type
734#else
735 typename NRowsBlockXpr<...>::Type
736#endif
737 middleRows(Index startRow, NRowsType n) {
738 return typename NRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type(
739 derived(), startRow, 0, internal::get_runtime_value(n), cols());
740}
741
743template <typename NRowsType>
744EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
745#ifndef EIGEN_PARSED_BY_DOXYGEN
746 const typename ConstNRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type
747#else
748 const typename ConstNRowsBlockXpr<...>::Type
749#endif
750 middleRows(Index startRow, NRowsType n) const {
751 return typename ConstNRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type(
752 derived(), startRow, 0, internal::get_runtime_value(n), cols());
753}
754
767EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(row - major)
771template <int N>
772EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename NRowsBlockXpr<N>::Type middleRows(Index startRow,
773 Index n = N) {
774 return typename NRowsBlockXpr<N>::Type(derived(), startRow, 0, n, cols());
775}
776
778template <int N>
779EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename ConstNRowsBlockXpr<N>::Type middleRows(Index startRow,
780 Index n = N) const {
781 return typename ConstNRowsBlockXpr<N>::Type(derived(), startRow, 0, n, cols());
782}
783
796EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(column - major)
800template <typename NColsType>
801EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
802#ifndef EIGEN_PARSED_BY_DOXYGEN
803 typename NColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type
804#else
805 typename NColsBlockXpr<...>::Type
806#endif
807 leftCols(NColsType n) {
808 return typename NColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type(derived(), 0, 0, rows(),
809 internal::get_runtime_value(n));
810}
811
813template <typename NColsType>
814EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
815#ifndef EIGEN_PARSED_BY_DOXYGEN
816 const typename ConstNColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type
817#else
818 const typename ConstNColsBlockXpr<...>::Type
819#endif
820 leftCols(NColsType n) const {
821 return typename ConstNColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type(derived(), 0, 0, rows(),
822 internal::get_runtime_value(n));
823}
824
836EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(column - major)
840template <int N>
841EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename NColsBlockXpr<N>::Type leftCols(Index n = N) {
842 return typename NColsBlockXpr<N>::Type(derived(), 0, 0, rows(), n);
843}
844
846template <int N>
847EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename ConstNColsBlockXpr<N>::Type leftCols(Index n = N) const {
848 return typename ConstNColsBlockXpr<N>::Type(derived(), 0, 0, rows(), n);
849}
850
863EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(column - major)
867template <typename NColsType>
868EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
869#ifndef EIGEN_PARSED_BY_DOXYGEN
870 typename NColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type
871#else
872 typename NColsBlockXpr<...>::Type
873#endif
874 rightCols(NColsType n) {
875 return typename NColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type(
876 derived(), 0, cols() - internal::get_runtime_value(n), rows(), internal::get_runtime_value(n));
877}
878
880template <typename NColsType>
881EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
882#ifndef EIGEN_PARSED_BY_DOXYGEN
883 const typename ConstNColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type
884#else
885 const typename ConstNColsBlockXpr<...>::Type
886#endif
887 rightCols(NColsType n) const {
888 return typename ConstNColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type(
889 derived(), 0, cols() - internal::get_runtime_value(n), rows(), internal::get_runtime_value(n));
890}
891
903EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(column - major)
907template <int N>
908EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename NColsBlockXpr<N>::Type rightCols(Index n = N) {
909 return typename NColsBlockXpr<N>::Type(derived(), 0, cols() - n, rows(), n);
910}
911
913template <int N>
914EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename ConstNColsBlockXpr<N>::Type rightCols(Index n = N) const {
915 return typename ConstNColsBlockXpr<N>::Type(derived(), 0, cols() - n, rows(), n);
916}
917
931EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(column - major)
935template <typename NColsType>
936EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
937#ifndef EIGEN_PARSED_BY_DOXYGEN
938 typename NColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type
939#else
940 typename NColsBlockXpr<...>::Type
941#endif
942 middleCols(Index startCol, NColsType numCols) {
943 return typename NColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type(
944 derived(), 0, startCol, rows(), internal::get_runtime_value(numCols));
945}
946
948template <typename NColsType>
949EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
950#ifndef EIGEN_PARSED_BY_DOXYGEN
951 const typename ConstNColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type
952#else
953 const typename ConstNColsBlockXpr<...>::Type
954#endif
955 middleCols(Index startCol, NColsType numCols) const {
956 return typename ConstNColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type(
957 derived(), 0, startCol, rows(), internal::get_runtime_value(numCols));
958}
959
972EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(column - major)
976template <int N>
977EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename NColsBlockXpr<N>::Type middleCols(Index startCol,
978 Index n = N) {
979 return typename NColsBlockXpr<N>::Type(derived(), 0, startCol, rows(), n);
980}
981
983template <int N>
984EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename ConstNColsBlockXpr<N>::Type middleCols(Index startCol,
985 Index n = N) const {
986 return typename ConstNColsBlockXpr<N>::Type(derived(), 0, startCol, rows(), n);
987}
988
1009EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
1013template <int NRows, int NCols>
1014EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename FixedBlockXpr<NRows, NCols>::Type block(Index startRow,
1015 Index startCol) {
1016 return typename FixedBlockXpr<NRows, NCols>::Type(derived(), startRow, startCol);
1017}
1018
1020template <int NRows, int NCols>
1021EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const typename ConstFixedBlockXpr<NRows, NCols>::Type block(
1022 Index startRow, Index startCol) const {
1023 return typename ConstFixedBlockXpr<NRows, NCols>::Type(derived(), startRow, startCol);
1024}
1025
1053EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
1057template <int NRows, int NCols>
1058EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename FixedBlockXpr<NRows, NCols>::Type block(Index startRow,
1059 Index startCol,
1060 Index blockRows,
1061 Index blockCols) {
1062 return typename FixedBlockXpr<NRows, NCols>::Type(derived(), startRow, startCol, blockRows, blockCols);
1063}
1064
1066template <int NRows, int NCols>
1067EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const typename ConstFixedBlockXpr<NRows, NCols>::Type block(
1068 Index startRow, Index startCol, Index blockRows, Index blockCols) const {
1069 return typename ConstFixedBlockXpr<NRows, NCols>::Type(derived(), startRow, startCol, blockRows, blockCols);
1070}
1071
1077EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(column - major)
1080EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE ColXpr col(Index i) { return ColXpr(derived(), i); }
1081
1083EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE ConstColXpr col(Index i) const { return ConstColXpr(derived(), i); }
1084
1090EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(row - major)
1093EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE RowXpr row(Index i) { return RowXpr(derived(), i); }
1094
1096EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE ConstRowXpr row(Index i) const { return ConstRowXpr(derived(), i); }
1097
1119template <typename NType>
1120EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
1121#ifndef EIGEN_PARSED_BY_DOXYGEN
1122 typename FixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type
1123#else
1124 typename FixedSegmentReturnType<...>::Type
1125#endif
1126 segment(Index start, NType n) {
1127 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
1128 return typename FixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type(derived(), start,
1129 internal::get_runtime_value(n));
1130}
1131
1133template <typename NType>
1134EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
1135#ifndef EIGEN_PARSED_BY_DOXYGEN
1136 const typename ConstFixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type
1137#else
1138 const typename ConstFixedSegmentReturnType<...>::Type
1139#endif
1140 segment(Index start, NType n) const {
1141 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
1142 return typename ConstFixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type(
1143 derived(), start, internal::get_runtime_value(n));
1144}
1145
1166template <typename NType>
1167EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
1168#ifndef EIGEN_PARSED_BY_DOXYGEN
1169 typename FixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type
1170#else
1171 typename FixedSegmentReturnType<...>::Type
1172#endif
1173 head(NType n) {
1174 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
1175 return typename FixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type(derived(), 0,
1176 internal::get_runtime_value(n));
1177}
1178
1180template <typename NType>
1181EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
1182#ifndef EIGEN_PARSED_BY_DOXYGEN
1183 const typename ConstFixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type
1184#else
1185 const typename ConstFixedSegmentReturnType<...>::Type
1186#endif
1187 head(NType n) const {
1188 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
1189 return typename ConstFixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type(
1190 derived(), 0, internal::get_runtime_value(n));
1191}
1192
1213template <typename NType>
1214EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
1215#ifndef EIGEN_PARSED_BY_DOXYGEN
1216 typename FixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type
1217#else
1218 typename FixedSegmentReturnType<...>::Type
1219#endif
1220 tail(NType n) {
1221 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
1222 return typename FixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type(
1223 derived(), this->size() - internal::get_runtime_value(n), internal::get_runtime_value(n));
1224}
1225
1227template <typename NType>
1228EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
1229#ifndef EIGEN_PARSED_BY_DOXYGEN
1230 const typename ConstFixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type
1231#else
1232 const typename ConstFixedSegmentReturnType<...>::Type
1233#endif
1234 tail(NType n) const {
1235 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
1236 return typename ConstFixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type(
1237 derived(), this->size() - internal::get_runtime_value(n), internal::get_runtime_value(n));
1238}
1239
1256template <int N>
1257EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename FixedSegmentReturnType<N>::Type segment(Index start,
1258 Index n = N) {
1259 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
1260 return typename FixedSegmentReturnType<N>::Type(derived(), start, n);
1261}
1262
1264template <int N>
1265EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename ConstFixedSegmentReturnType<N>::Type segment(
1266 Index start, Index n = N) const {
1267 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
1268 return typename ConstFixedSegmentReturnType<N>::Type(derived(), start, n);
1269}
1270
1286template <int N>
1287EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename FixedSegmentReturnType<N>::Type head(Index n = N) {
1288 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
1289 return typename FixedSegmentReturnType<N>::Type(derived(), 0, n);
1290}
1291
1293template <int N>
1294EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename ConstFixedSegmentReturnType<N>::Type head(Index n = N) const {
1295 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
1296 return typename ConstFixedSegmentReturnType<N>::Type(derived(), 0, n);
1297}
1298
1314template <int N>
1315EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename FixedSegmentReturnType<N>::Type tail(Index n = N) {
1316 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
1317 return typename FixedSegmentReturnType<N>::Type(derived(), size() - n, n);
1318}
1319
1321template <int N>
1322EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE typename ConstFixedSegmentReturnType<N>::Type tail(Index n = N) const {
1323 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
1324 return typename ConstFixedSegmentReturnType<N>::Type(derived(), size() - n, n);
1325}
1326
1330EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE InnerVectorReturnType innerVector(Index outer) {
1331 return InnerVectorReturnType(derived(), outer);
1332}
1333
1337EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const ConstInnerVectorReturnType innerVector(Index outer) const {
1338 return ConstInnerVectorReturnType(derived(), outer);
1339}
1340
1344EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE InnerVectorsReturnType innerVectors(Index outerStart, Index outerSize) {
1345 return InnerVectorsReturnType(derived(), IsRowMajor ? outerStart : 0, IsRowMajor ? 0 : outerStart,
1346 IsRowMajor ? outerSize : rows(), IsRowMajor ? cols() : outerSize);
1347}
1348
1352EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const ConstInnerVectorsReturnType innerVectors(Index outerStart,
1353 Index outerSize) const {
1354 return ConstInnerVectorsReturnType(derived(), IsRowMajor ? outerStart : 0, IsRowMajor ? 0 : outerStart,
1355 IsRowMajor ? outerSize : rows(), IsRowMajor ? cols() : outerSize);
1356}
1357
1361template <DirectionType Direction>
1362EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE std::conditional_t<Direction == Vertical, ColXpr, RowXpr> subVector(
1363 Index i) {
1364 return std::conditional_t<Direction == Vertical, ColXpr, RowXpr>(derived(), i);
1365}
1366
1368template <DirectionType Direction>
1369EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE std::conditional_t<Direction == Vertical, ConstColXpr, ConstRowXpr>
1370subVector(Index i) const {
1371 return std::conditional_t<Direction == Vertical, ConstColXpr, ConstRowXpr>(derived(), i);
1372}
1373
1377template <DirectionType Direction>
1378EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index subVectors() const {
1379 return (Direction == Vertical) ? cols() : rows();
1380}