diff options
Diffstat (limited to 'Eigen/src/plugins/BlockMethods.h')
-rw-r--r-- | Eigen/src/plugins/BlockMethods.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/Eigen/src/plugins/BlockMethods.h b/Eigen/src/plugins/BlockMethods.h index 6911bedef..3bc345211 100644 --- a/Eigen/src/plugins/BlockMethods.h +++ b/Eigen/src/plugins/BlockMethods.h @@ -53,12 +53,14 @@ template<int Size> struct ConstFixedSegmentReturnType { typedef const VectorBloc * * \sa class Block, block(Index,Index) */ +EIGEN_DEVICE_FUNC inline Block<Derived> block(Index startRow, Index startCol, Index blockRows, Index blockCols) { return Block<Derived>(derived(), startRow, startCol, blockRows, blockCols); } /** This is the const version of block(Index,Index,Index,Index). */ +EIGEN_DEVICE_FUNC inline const Block<const Derived> block(Index startRow, Index startCol, Index blockRows, Index blockCols) const { return Block<const Derived>(derived(), startRow, startCol, blockRows, blockCols); @@ -77,12 +79,14 @@ inline const Block<const Derived> block(Index startRow, Index startCol, Index bl * * \sa class Block, block(Index,Index,Index,Index) */ +EIGEN_DEVICE_FUNC inline Block<Derived> topRightCorner(Index cRows, Index cCols) { return Block<Derived>(derived(), 0, cols() - cCols, cRows, cCols); } /** This is the const version of topRightCorner(Index, Index).*/ +EIGEN_DEVICE_FUNC inline const Block<const Derived> topRightCorner(Index cRows, Index cCols) const { return Block<const Derived>(derived(), 0, cols() - cCols, cRows, cCols); @@ -99,6 +103,7 @@ inline const Block<const Derived> topRightCorner(Index cRows, Index cCols) const * \sa class Block, block<int,int>(Index,Index) */ template<int CRows, int CCols> +EIGEN_DEVICE_FUNC inline Block<Derived, CRows, CCols> topRightCorner() { return Block<Derived, CRows, CCols>(derived(), 0, cols() - CCols); @@ -106,6 +111,7 @@ inline Block<Derived, CRows, CCols> topRightCorner() /** This is the const version of topRightCorner<int, int>().*/ template<int CRows, int CCols> +EIGEN_DEVICE_FUNC inline const Block<const Derived, CRows, CCols> topRightCorner() const { return Block<const Derived, CRows, CCols>(derived(), 0, cols() - CCols); @@ -153,12 +159,14 @@ inline const Block<const Derived, CRows, CCols> topRightCorner(Index cRows, Inde * * \sa class Block, block(Index,Index,Index,Index) */ +EIGEN_DEVICE_FUNC inline Block<Derived> topLeftCorner(Index cRows, Index cCols) { return Block<Derived>(derived(), 0, 0, cRows, cCols); } /** This is the const version of topLeftCorner(Index, Index).*/ +EIGEN_DEVICE_FUNC inline const Block<const Derived> topLeftCorner(Index cRows, Index cCols) const { return Block<const Derived>(derived(), 0, 0, cRows, cCols); @@ -174,6 +182,7 @@ inline const Block<const Derived> topLeftCorner(Index cRows, Index cCols) const * \sa class Block, block(Index,Index,Index,Index) */ template<int CRows, int CCols> +EIGEN_DEVICE_FUNC inline Block<Derived, CRows, CCols> topLeftCorner() { return Block<Derived, CRows, CCols>(derived(), 0, 0); @@ -181,6 +190,7 @@ inline Block<Derived, CRows, CCols> topLeftCorner() /** This is the const version of topLeftCorner<int, int>().*/ template<int CRows, int CCols> +EIGEN_DEVICE_FUNC inline const Block<const Derived, CRows, CCols> topLeftCorner() const { return Block<const Derived, CRows, CCols>(derived(), 0, 0); @@ -228,12 +238,14 @@ inline const Block<const Derived, CRows, CCols> topLeftCorner(Index cRows, Index * * \sa class Block, block(Index,Index,Index,Index) */ +EIGEN_DEVICE_FUNC inline Block<Derived> bottomRightCorner(Index cRows, Index cCols) { return Block<Derived>(derived(), rows() - cRows, cols() - cCols, cRows, cCols); } /** This is the const version of bottomRightCorner(Index, Index).*/ +EIGEN_DEVICE_FUNC inline const Block<const Derived> bottomRightCorner(Index cRows, Index cCols) const { return Block<const Derived>(derived(), rows() - cRows, cols() - cCols, cRows, cCols); @@ -249,6 +261,7 @@ inline const Block<const Derived> bottomRightCorner(Index cRows, Index cCols) co * \sa class Block, block(Index,Index,Index,Index) */ template<int CRows, int CCols> +EIGEN_DEVICE_FUNC inline Block<Derived, CRows, CCols> bottomRightCorner() { return Block<Derived, CRows, CCols>(derived(), rows() - CRows, cols() - CCols); @@ -256,6 +269,7 @@ inline Block<Derived, CRows, CCols> bottomRightCorner() /** This is the const version of bottomRightCorner<int, int>().*/ template<int CRows, int CCols> +EIGEN_DEVICE_FUNC inline const Block<const Derived, CRows, CCols> bottomRightCorner() const { return Block<const Derived, CRows, CCols>(derived(), rows() - CRows, cols() - CCols); @@ -303,12 +317,14 @@ inline const Block<const Derived, CRows, CCols> bottomRightCorner(Index cRows, I * * \sa class Block, block(Index,Index,Index,Index) */ +EIGEN_DEVICE_FUNC inline Block<Derived> bottomLeftCorner(Index cRows, Index cCols) { return Block<Derived>(derived(), rows() - cRows, 0, cRows, cCols); } /** This is the const version of bottomLeftCorner(Index, Index).*/ +EIGEN_DEVICE_FUNC inline const Block<const Derived> bottomLeftCorner(Index cRows, Index cCols) const { return Block<const Derived>(derived(), rows() - cRows, 0, cRows, cCols); @@ -324,6 +340,7 @@ inline const Block<const Derived> bottomLeftCorner(Index cRows, Index cCols) con * \sa class Block, block(Index,Index,Index,Index) */ template<int CRows, int CCols> +EIGEN_DEVICE_FUNC inline Block<Derived, CRows, CCols> bottomLeftCorner() { return Block<Derived, CRows, CCols>(derived(), rows() - CRows, 0); @@ -331,6 +348,7 @@ inline Block<Derived, CRows, CCols> bottomLeftCorner() /** This is the const version of bottomLeftCorner<int, int>().*/ template<int CRows, int CCols> +EIGEN_DEVICE_FUNC inline const Block<const Derived, CRows, CCols> bottomLeftCorner() const { return Block<const Derived, CRows, CCols>(derived(), rows() - CRows, 0); @@ -377,12 +395,14 @@ inline const Block<const Derived, CRows, CCols> bottomLeftCorner(Index cRows, In * * \sa class Block, block(Index,Index,Index,Index) */ +EIGEN_DEVICE_FUNC inline RowsBlockXpr topRows(Index n) { return RowsBlockXpr(derived(), 0, 0, n, cols()); } /** This is the const version of topRows(Index).*/ +EIGEN_DEVICE_FUNC inline ConstRowsBlockXpr topRows(Index n) const { return ConstRowsBlockXpr(derived(), 0, 0, n, cols()); @@ -398,6 +418,7 @@ inline ConstRowsBlockXpr topRows(Index n) const * \sa class Block, block(Index,Index,Index,Index) */ template<int N> +EIGEN_DEVICE_FUNC inline typename NRowsBlockXpr<N>::Type topRows() { return typename NRowsBlockXpr<N>::Type(derived(), 0, 0, N, cols()); @@ -405,6 +426,7 @@ inline typename NRowsBlockXpr<N>::Type topRows() /** This is the const version of topRows<int>().*/ template<int N> +EIGEN_DEVICE_FUNC inline typename ConstNRowsBlockXpr<N>::Type topRows() const { return typename ConstNRowsBlockXpr<N>::Type(derived(), 0, 0, N, cols()); @@ -421,12 +443,14 @@ inline typename ConstNRowsBlockXpr<N>::Type topRows() const * * \sa class Block, block(Index,Index,Index,Index) */ +EIGEN_DEVICE_FUNC inline RowsBlockXpr bottomRows(Index n) { return RowsBlockXpr(derived(), rows() - n, 0, n, cols()); } /** This is the const version of bottomRows(Index).*/ +EIGEN_DEVICE_FUNC inline ConstRowsBlockXpr bottomRows(Index n) const { return ConstRowsBlockXpr(derived(), rows() - n, 0, n, cols()); @@ -442,6 +466,7 @@ inline ConstRowsBlockXpr bottomRows(Index n) const * \sa class Block, block(Index,Index,Index,Index) */ template<int N> +EIGEN_DEVICE_FUNC inline typename NRowsBlockXpr<N>::Type bottomRows() { return typename NRowsBlockXpr<N>::Type(derived(), rows() - N, 0, N, cols()); @@ -449,6 +474,7 @@ inline typename NRowsBlockXpr<N>::Type bottomRows() /** This is the const version of bottomRows<int>().*/ template<int N> +EIGEN_DEVICE_FUNC inline typename ConstNRowsBlockXpr<N>::Type bottomRows() const { return typename ConstNRowsBlockXpr<N>::Type(derived(), rows() - N, 0, N, cols()); @@ -466,12 +492,14 @@ inline typename ConstNRowsBlockXpr<N>::Type bottomRows() const * * \sa class Block, block(Index,Index,Index,Index) */ +EIGEN_DEVICE_FUNC inline RowsBlockXpr middleRows(Index startRow, Index numRows) { return RowsBlockXpr(derived(), startRow, 0, numRows, cols()); } /** This is the const version of middleRows(Index,Index).*/ +EIGEN_DEVICE_FUNC inline ConstRowsBlockXpr middleRows(Index startRow, Index numRows) const { return ConstRowsBlockXpr(derived(), startRow, 0, numRows, cols()); @@ -488,6 +516,7 @@ inline ConstRowsBlockXpr middleRows(Index startRow, Index numRows) const * \sa class Block, block(Index,Index,Index,Index) */ template<int N> +EIGEN_DEVICE_FUNC inline typename NRowsBlockXpr<N>::Type middleRows(Index startRow) { return typename NRowsBlockXpr<N>::Type(derived(), startRow, 0, N, cols()); @@ -495,6 +524,7 @@ inline typename NRowsBlockXpr<N>::Type middleRows(Index startRow) /** This is the const version of middleRows<int>().*/ template<int N> +EIGEN_DEVICE_FUNC inline typename ConstNRowsBlockXpr<N>::Type middleRows(Index startRow) const { return typename ConstNRowsBlockXpr<N>::Type(derived(), startRow, 0, N, cols()); @@ -511,12 +541,14 @@ inline typename ConstNRowsBlockXpr<N>::Type middleRows(Index startRow) const * * \sa class Block, block(Index,Index,Index,Index) */ +EIGEN_DEVICE_FUNC inline ColsBlockXpr leftCols(Index n) { return ColsBlockXpr(derived(), 0, 0, rows(), n); } /** This is the const version of leftCols(Index).*/ +EIGEN_DEVICE_FUNC inline ConstColsBlockXpr leftCols(Index n) const { return ConstColsBlockXpr(derived(), 0, 0, rows(), n); @@ -532,6 +564,7 @@ inline ConstColsBlockXpr leftCols(Index n) const * \sa class Block, block(Index,Index,Index,Index) */ template<int N> +EIGEN_DEVICE_FUNC inline typename NColsBlockXpr<N>::Type leftCols() { return typename NColsBlockXpr<N>::Type(derived(), 0, 0, rows(), N); @@ -539,6 +572,7 @@ inline typename NColsBlockXpr<N>::Type leftCols() /** This is the const version of leftCols<int>().*/ template<int N> +EIGEN_DEVICE_FUNC inline typename ConstNColsBlockXpr<N>::Type leftCols() const { return typename ConstNColsBlockXpr<N>::Type(derived(), 0, 0, rows(), N); @@ -555,12 +589,14 @@ inline typename ConstNColsBlockXpr<N>::Type leftCols() const * * \sa class Block, block(Index,Index,Index,Index) */ +EIGEN_DEVICE_FUNC inline ColsBlockXpr rightCols(Index n) { return ColsBlockXpr(derived(), 0, cols() - n, rows(), n); } /** This is the const version of rightCols(Index).*/ +EIGEN_DEVICE_FUNC inline ConstColsBlockXpr rightCols(Index n) const { return ConstColsBlockXpr(derived(), 0, cols() - n, rows(), n); @@ -576,6 +612,7 @@ inline ConstColsBlockXpr rightCols(Index n) const * \sa class Block, block(Index,Index,Index,Index) */ template<int N> +EIGEN_DEVICE_FUNC inline typename NColsBlockXpr<N>::Type rightCols() { return typename NColsBlockXpr<N>::Type(derived(), 0, cols() - N, rows(), N); @@ -583,6 +620,7 @@ inline typename NColsBlockXpr<N>::Type rightCols() /** This is the const version of rightCols<int>().*/ template<int N> +EIGEN_DEVICE_FUNC inline typename ConstNColsBlockXpr<N>::Type rightCols() const { return typename ConstNColsBlockXpr<N>::Type(derived(), 0, cols() - N, rows(), N); @@ -600,12 +638,14 @@ inline typename ConstNColsBlockXpr<N>::Type rightCols() const * * \sa class Block, block(Index,Index,Index,Index) */ +EIGEN_DEVICE_FUNC inline ColsBlockXpr middleCols(Index startCol, Index numCols) { return ColsBlockXpr(derived(), 0, startCol, rows(), numCols); } /** This is the const version of middleCols(Index,Index).*/ +EIGEN_DEVICE_FUNC inline ConstColsBlockXpr middleCols(Index startCol, Index numCols) const { return ConstColsBlockXpr(derived(), 0, startCol, rows(), numCols); @@ -622,6 +662,7 @@ inline ConstColsBlockXpr middleCols(Index startCol, Index numCols) const * \sa class Block, block(Index,Index,Index,Index) */ template<int N> +EIGEN_DEVICE_FUNC inline typename NColsBlockXpr<N>::Type middleCols(Index startCol) { return typename NColsBlockXpr<N>::Type(derived(), 0, startCol, rows(), N); @@ -629,6 +670,7 @@ inline typename NColsBlockXpr<N>::Type middleCols(Index startCol) /** This is the const version of middleCols<int>().*/ template<int N> +EIGEN_DEVICE_FUNC inline typename ConstNColsBlockXpr<N>::Type middleCols(Index startCol) const { return typename ConstNColsBlockXpr<N>::Type(derived(), 0, startCol, rows(), N); @@ -653,6 +695,7 @@ inline typename ConstNColsBlockXpr<N>::Type middleCols(Index startCol) const * \sa class Block, block(Index,Index,Index,Index) */ template<int BlockRows, int BlockCols> +EIGEN_DEVICE_FUNC inline Block<Derived, BlockRows, BlockCols> block(Index startRow, Index startCol) { return Block<Derived, BlockRows, BlockCols>(derived(), startRow, startCol); @@ -660,6 +703,7 @@ inline Block<Derived, BlockRows, BlockCols> block(Index startRow, Index startCol /** This is the const version of block<>(Index, Index). */ template<int BlockRows, int BlockCols> +EIGEN_DEVICE_FUNC inline const Block<const Derived, BlockRows, BlockCols> block(Index startRow, Index startCol) const { return Block<const Derived, BlockRows, BlockCols>(derived(), startRow, startCol); @@ -705,12 +749,14 @@ inline const Block<const Derived, BlockRows, BlockCols> block(Index startRow, In * Output: \verbinclude MatrixBase_col.out * * \sa row(), class Block */ +EIGEN_DEVICE_FUNC inline ColXpr col(Index i) { return ColXpr(derived(), i); } /** This is the const version of col(). */ +EIGEN_DEVICE_FUNC inline ConstColXpr col(Index i) const { return ConstColXpr(derived(), i); @@ -722,12 +768,14 @@ inline ConstColXpr col(Index i) const * Output: \verbinclude MatrixBase_row.out * * \sa col(), class Block */ +EIGEN_DEVICE_FUNC inline RowXpr row(Index i) { return RowXpr(derived(), i); } /** This is the const version of row(). */ +EIGEN_DEVICE_FUNC inline ConstRowXpr row(Index i) const { return ConstRowXpr(derived(), i); @@ -749,6 +797,7 @@ inline ConstRowXpr row(Index i) const * * \sa class Block, segment(Index) */ +EIGEN_DEVICE_FUNC inline SegmentReturnType segment(Index start, Index vecSize) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) @@ -757,6 +806,7 @@ inline SegmentReturnType segment(Index start, Index vecSize) /** This is the const version of segment(Index,Index).*/ +EIGEN_DEVICE_FUNC inline ConstSegmentReturnType segment(Index start, Index vecSize) const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) @@ -778,6 +828,7 @@ inline ConstSegmentReturnType segment(Index start, Index vecSize) const * * \sa class Block, block(Index,Index) */ +EIGEN_DEVICE_FUNC inline SegmentReturnType head(Index vecSize) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) @@ -785,6 +836,7 @@ inline SegmentReturnType head(Index vecSize) } /** This is the const version of head(Index).*/ +EIGEN_DEVICE_FUNC inline ConstSegmentReturnType head(Index vecSize) const { @@ -807,6 +859,7 @@ inline ConstSegmentReturnType * * \sa class Block, block(Index,Index) */ +EIGEN_DEVICE_FUNC inline SegmentReturnType tail(Index vecSize) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) @@ -814,6 +867,7 @@ inline SegmentReturnType tail(Index vecSize) } /** This is the const version of tail(Index).*/ +EIGEN_DEVICE_FUNC inline ConstSegmentReturnType tail(Index vecSize) const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) @@ -834,6 +888,7 @@ inline ConstSegmentReturnType tail(Index vecSize) const * \sa class Block */ template<int Size> +EIGEN_DEVICE_FUNC inline typename FixedSegmentReturnType<Size>::Type segment(Index start) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) @@ -842,6 +897,7 @@ inline typename FixedSegmentReturnType<Size>::Type segment(Index start) /** This is the const version of segment<int>(Index).*/ template<int Size> +EIGEN_DEVICE_FUNC inline typename ConstFixedSegmentReturnType<Size>::Type segment(Index start) const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) @@ -860,6 +916,7 @@ inline typename ConstFixedSegmentReturnType<Size>::Type segment(Index start) con * \sa class Block */ template<int Size> +EIGEN_DEVICE_FUNC inline typename FixedSegmentReturnType<Size>::Type head() { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) @@ -868,6 +925,7 @@ inline typename FixedSegmentReturnType<Size>::Type head() /** This is the const version of head<int>().*/ template<int Size> +EIGEN_DEVICE_FUNC inline typename ConstFixedSegmentReturnType<Size>::Type head() const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) @@ -886,6 +944,7 @@ inline typename ConstFixedSegmentReturnType<Size>::Type head() const * \sa class Block */ template<int Size> +EIGEN_DEVICE_FUNC inline typename FixedSegmentReturnType<Size>::Type tail() { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) @@ -894,6 +953,7 @@ inline typename FixedSegmentReturnType<Size>::Type tail() /** This is the const version of tail<int>.*/ template<int Size> +EIGEN_DEVICE_FUNC inline typename ConstFixedSegmentReturnType<Size>::Type tail() const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) |