aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/plugins/BlockMethods.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2013-02-07 19:06:14 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2013-02-07 19:06:14 +0100
commit5adcc6c7b48b7a213af91bc123a02ab87751228e (patch)
tree5e0ee840a8fb9acbbb48c5c48f1bffe0ca3cfe2a /Eigen/src/plugins/BlockMethods.h
parente4ec63aee7233f5b934abc0b1d9ceada79a844ee (diff)
Add support for NVCC5: most of the Core and part of LU are callable from CUDA code.
Still a lot to do.
Diffstat (limited to 'Eigen/src/plugins/BlockMethods.h')
-rw-r--r--Eigen/src/plugins/BlockMethods.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/Eigen/src/plugins/BlockMethods.h b/Eigen/src/plugins/BlockMethods.h
index 19a491cf7..5ef373a81 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);
@@ -98,6 +102,7 @@ inline const Block<const Derived> topRightCorner(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> topRightCorner()
{
return Block<Derived, CRows, CCols>(derived(), 0, cols() - CCols);
@@ -105,6 +110,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);
@@ -123,12 +129,14 @@ inline const Block<const Derived, CRows, CCols> topRightCorner() const
*
* \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);
@@ -144,6 +152,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);
@@ -151,6 +160,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);
@@ -168,12 +178,14 @@ inline const Block<const Derived, CRows, CCols> topLeftCorner() const
*
* \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);
@@ -189,6 +201,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);
@@ -196,6 +209,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);
@@ -213,12 +227,14 @@ inline const Block<const Derived, CRows, CCols> bottomRightCorner() const
*
* \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);
@@ -234,6 +250,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);
@@ -241,6 +258,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);
@@ -257,12 +275,14 @@ inline const Block<const Derived, CRows, CCols> bottomLeftCorner() const
*
* \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());
@@ -278,6 +298,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());
@@ -285,6 +306,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());
@@ -301,12 +323,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());
@@ -322,6 +346,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());
@@ -329,6 +354,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());
@@ -346,12 +372,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());
@@ -368,6 +396,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());
@@ -375,6 +404,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());
@@ -391,12 +421,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);
@@ -412,6 +444,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);
@@ -419,6 +452,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);
@@ -435,12 +469,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);
@@ -456,6 +492,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);
@@ -463,6 +500,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);
@@ -480,12 +518,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);
@@ -502,6 +542,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);
@@ -509,6 +550,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);
@@ -533,6 +575,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);
@@ -540,6 +583,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);
@@ -551,12 +595,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);
@@ -568,12 +614,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);
@@ -595,6 +643,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)
@@ -603,6 +652,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)
@@ -624,6 +674,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)
@@ -631,6 +682,7 @@ inline SegmentReturnType head(Index vecSize)
}
/** This is the const version of head(Index).*/
+EIGEN_DEVICE_FUNC
inline ConstSegmentReturnType
head(Index vecSize) const
{
@@ -653,6 +705,7 @@ inline ConstSegmentReturnType
*
* \sa class Block, block(Index,Index)
*/
+EIGEN_DEVICE_FUNC
inline SegmentReturnType tail(Index vecSize)
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
@@ -660,6 +713,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)
@@ -680,6 +734,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)
@@ -688,6 +743,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)
@@ -706,6 +762,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)
@@ -714,6 +771,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)
@@ -732,6 +790,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)
@@ -740,6 +799,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)