Add support for NVCC5: most of the Core and part of LU are callable from CUDA code.

Still a lot to do.
This commit is contained in:
Gael Guennebaud
2013-02-07 19:06:14 +01:00
parent e4ec63aee7
commit 5adcc6c7b4
36 changed files with 550 additions and 137 deletions

View File

@@ -7,6 +7,7 @@
*
* \sa abs2()
*/
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const CwiseUnaryOp<internal::scalar_abs_op<Scalar>, const Derived>
abs() const
{
@@ -20,6 +21,7 @@ abs() const
*
* \sa abs(), square()
*/
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const CwiseUnaryOp<internal::scalar_abs2_op<Scalar>, const Derived>
abs2() const
{
@@ -33,6 +35,7 @@ abs2() const
*
* \sa pow(), log(), sin(), cos()
*/
EIGEN_DEVICE_FUNC
inline const CwiseUnaryOp<internal::scalar_exp_op<Scalar>, const Derived>
exp() const
{
@@ -46,6 +49,7 @@ exp() const
*
* \sa exp()
*/
EIGEN_DEVICE_FUNC
inline const CwiseUnaryOp<internal::scalar_log_op<Scalar>, const Derived>
log() const
{
@@ -59,6 +63,7 @@ log() const
*
* \sa pow(), square()
*/
EIGEN_DEVICE_FUNC
inline const CwiseUnaryOp<internal::scalar_sqrt_op<Scalar>, const Derived>
sqrt() const
{
@@ -72,6 +77,7 @@ sqrt() const
*
* \sa sin(), acos()
*/
EIGEN_DEVICE_FUNC
inline const CwiseUnaryOp<internal::scalar_cos_op<Scalar>, const Derived>
cos() const
{
@@ -86,6 +92,7 @@ cos() const
*
* \sa cos(), asin()
*/
EIGEN_DEVICE_FUNC
inline const CwiseUnaryOp<internal::scalar_sin_op<Scalar>, const Derived>
sin() const
{
@@ -99,6 +106,7 @@ sin() const
*
* \sa cos(), asin()
*/
EIGEN_DEVICE_FUNC
inline const CwiseUnaryOp<internal::scalar_acos_op<Scalar>, const Derived>
acos() const
{
@@ -112,6 +120,7 @@ acos() const
*
* \sa sin(), acos()
*/
EIGEN_DEVICE_FUNC
inline const CwiseUnaryOp<internal::scalar_asin_op<Scalar>, const Derived>
asin() const
{
@@ -125,6 +134,7 @@ asin() const
*
* \sa cos(), sin()
*/
EIGEN_DEVICE_FUNC
inline const CwiseUnaryOp<internal::scalar_tan_op<Scalar>, Derived>
tan() const
{
@@ -139,6 +149,7 @@ tan() const
*
* \sa exp(), log()
*/
EIGEN_DEVICE_FUNC
inline const CwiseUnaryOp<internal::scalar_pow_op<Scalar>, const Derived>
pow(const Scalar& exponent) const
{
@@ -154,6 +165,7 @@ pow(const Scalar& exponent) const
*
* \sa operator/(), operator*()
*/
EIGEN_DEVICE_FUNC
inline const CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, const Derived>
inverse() const
{
@@ -167,6 +179,7 @@ inverse() const
*
* \sa operator/(), operator*(), abs2()
*/
EIGEN_DEVICE_FUNC
inline const CwiseUnaryOp<internal::scalar_square_op<Scalar>, const Derived>
square() const
{
@@ -180,6 +193,7 @@ square() const
*
* \sa square(), pow()
*/
EIGEN_DEVICE_FUNC
inline const CwiseUnaryOp<internal::scalar_cube_op<Scalar>, const Derived>
cube() const
{

View File

@@ -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)

View File

@@ -38,6 +38,7 @@ EIGEN_MAKE_CWISE_BINARY_OP(operator+,internal::scalar_sum_op)
* \sa class CwiseBinaryOp, operator+(), operator-(), cwiseProduct()
*/
template<typename CustomBinaryOp, typename OtherDerived>
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const CwiseBinaryOp<CustomBinaryOp, const Derived, const OtherDerived>
binaryExpr(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other, const CustomBinaryOp& func = CustomBinaryOp()) const
{

View File

@@ -40,11 +40,13 @@ typedef CwiseUnaryView<internal::scalar_imag_ref_op<Scalar>, Derived> NonConstIm
/** \returns an expression of the opposite of \c *this
*/
EIGEN_DEVICE_FUNC
inline const CwiseUnaryOp<internal::scalar_opposite_op<typename internal::traits<Derived>::Scalar>, const Derived>
operator-() const { return derived(); }
/** \returns an expression of \c *this scaled by the scalar factor \a scalar */
EIGEN_DEVICE_FUNC
inline const ScalarMultipleReturnType
operator*(const Scalar& scalar) const
{
@@ -57,6 +59,7 @@ const ScalarMultipleReturnType operator*(const RealScalar& scalar) const;
#endif
/** \returns an expression of \c *this divided by the scalar value \a scalar */
EIGEN_DEVICE_FUNC
inline const CwiseUnaryOp<internal::scalar_quotient1_op<typename internal::traits<Derived>::Scalar>, const Derived>
operator/(const Scalar& scalar) const
{
@@ -65,6 +68,7 @@ operator/(const Scalar& scalar) const
}
/** Overloaded for efficient real matrix times complex scalar value */
EIGEN_DEVICE_FUNC
inline const CwiseUnaryOp<internal::scalar_multiple2_op<Scalar,std::complex<Scalar> >, const Derived>
operator*(const std::complex<Scalar>& scalar) const
{
@@ -72,10 +76,12 @@ operator*(const std::complex<Scalar>& scalar) const
(*static_cast<const Derived*>(this), internal::scalar_multiple2_op<Scalar,std::complex<Scalar> >(scalar));
}
EIGEN_DEVICE_FUNC
inline friend const ScalarMultipleReturnType
operator*(const Scalar& scalar, const StorageBaseType& matrix)
{ return matrix*scalar; }
EIGEN_DEVICE_FUNC
inline friend const CwiseUnaryOp<internal::scalar_multiple2_op<Scalar,std::complex<Scalar> >, const Derived>
operator*(const std::complex<Scalar>& scalar, const StorageBaseType& matrix)
{ return matrix*scalar; }
@@ -88,6 +94,7 @@ operator*(const std::complex<Scalar>& scalar, const StorageBaseType& matrix)
* \sa class CwiseUnaryOp
*/
template<typename NewType>
EIGEN_DEVICE_FUNC
typename internal::cast_return_type<Derived,const CwiseUnaryOp<internal::scalar_cast_op<typename internal::traits<Derived>::Scalar, NewType>, const Derived> >::type
cast() const
{
@@ -97,6 +104,7 @@ cast() const
/** \returns an expression of the complex conjugate of \c *this.
*
* \sa adjoint() */
EIGEN_DEVICE_FUNC
inline ConjugateReturnType
conjugate() const
{
@@ -106,12 +114,14 @@ conjugate() const
/** \returns a read-only expression of the real part of \c *this.
*
* \sa imag() */
EIGEN_DEVICE_FUNC
inline RealReturnType
real() const { return derived(); }
/** \returns an read-only expression of the imaginary part of \c *this.
*
* \sa real() */
EIGEN_DEVICE_FUNC
inline const ImagReturnType
imag() const { return derived(); }
@@ -135,6 +145,7 @@ imag() const { return derived(); }
* \sa class CwiseUnaryOp, class CwiseBinaryOp
*/
template<typename CustomUnaryOp>
EIGEN_DEVICE_FUNC
inline const CwiseUnaryOp<CustomUnaryOp, const Derived>
unaryExpr(const CustomUnaryOp& func = CustomUnaryOp()) const
{
@@ -153,6 +164,7 @@ unaryExpr(const CustomUnaryOp& func = CustomUnaryOp()) const
* \sa class CwiseUnaryOp, class CwiseBinaryOp
*/
template<typename CustomViewOp>
EIGEN_DEVICE_FUNC
inline const CwiseUnaryView<CustomViewOp, const Derived>
unaryViewExpr(const CustomViewOp& func = CustomViewOp()) const
{
@@ -162,11 +174,13 @@ unaryViewExpr(const CustomViewOp& func = CustomViewOp()) const
/** \returns a non const expression of the real part of \c *this.
*
* \sa imag() */
EIGEN_DEVICE_FUNC
inline NonConstRealReturnType
real() { return derived(); }
/** \returns a non const expression of the imaginary part of \c *this.
*
* \sa real() */
EIGEN_DEVICE_FUNC
inline NonConstImagReturnType
imag() { return derived(); }

View File

@@ -18,6 +18,7 @@
* \sa class CwiseBinaryOp, cwiseAbs2
*/
template<typename OtherDerived>
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const EIGEN_CWISE_PRODUCT_RETURN_TYPE(Derived,OtherDerived)
cwiseProduct(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
{
@@ -37,6 +38,7 @@ cwiseProduct(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
* \sa cwiseNotEqual(), isApprox(), isMuchSmallerThan()
*/
template<typename OtherDerived>
EIGEN_DEVICE_FUNC
inline const CwiseBinaryOp<std::equal_to<Scalar>, const Derived, const OtherDerived>
cwiseEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
{
@@ -56,6 +58,7 @@ cwiseEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
* \sa cwiseEqual(), isApprox(), isMuchSmallerThan()
*/
template<typename OtherDerived>
EIGEN_DEVICE_FUNC
inline const CwiseBinaryOp<std::not_equal_to<Scalar>, const Derived, const OtherDerived>
cwiseNotEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
{
@@ -70,6 +73,7 @@ cwiseNotEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
* \sa class CwiseBinaryOp, max()
*/
template<typename OtherDerived>
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_min_op<Scalar>, const Derived, const OtherDerived>
cwiseMin(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
{
@@ -80,6 +84,7 @@ cwiseMin(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
*
* \sa class CwiseBinaryOp, min()
*/
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_min_op<Scalar>, const Derived, const ConstantReturnType>
cwiseMin(const Scalar &other) const
{
@@ -94,6 +99,7 @@ cwiseMin(const Scalar &other) const
* \sa class CwiseBinaryOp, min()
*/
template<typename OtherDerived>
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_max_op<Scalar>, const Derived, const OtherDerived>
cwiseMax(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
{
@@ -104,6 +110,7 @@ cwiseMax(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
*
* \sa class CwiseBinaryOp, min()
*/
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_max_op<Scalar>, const Derived, const ConstantReturnType>
cwiseMax(const Scalar &other) const
{
@@ -119,6 +126,7 @@ cwiseMax(const Scalar &other) const
* \sa class CwiseBinaryOp, cwiseProduct(), cwiseInverse()
*/
template<typename OtherDerived>
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, const Derived, const OtherDerived>
cwiseQuotient(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
{

View File

@@ -17,6 +17,7 @@
*
* \sa cwiseAbs2()
*/
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const CwiseUnaryOp<internal::scalar_abs_op<Scalar>, const Derived>
cwiseAbs() const { return derived(); }
@@ -27,6 +28,7 @@ cwiseAbs() const { return derived(); }
*
* \sa cwiseAbs()
*/
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const CwiseUnaryOp<internal::scalar_abs2_op<Scalar>, const Derived>
cwiseAbs2() const { return derived(); }
@@ -37,6 +39,7 @@ cwiseAbs2() const { return derived(); }
*
* \sa cwisePow(), cwiseSquare()
*/
EIGEN_DEVICE_FUNC
inline const CwiseUnaryOp<internal::scalar_sqrt_op<Scalar>, const Derived>
cwiseSqrt() const { return derived(); }
@@ -47,6 +50,7 @@ cwiseSqrt() const { return derived(); }
*
* \sa cwiseProduct()
*/
EIGEN_DEVICE_FUNC
inline const CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, const Derived>
cwiseInverse() const { return derived(); }
@@ -59,6 +63,7 @@ cwiseInverse() const { return derived(); }
*
* \sa cwiseEqual(const MatrixBase<OtherDerived> &) const
*/
EIGEN_DEVICE_FUNC
inline const CwiseUnaryOp<std::binder1st<std::equal_to<Scalar> >, const Derived>
cwiseEqual(const Scalar& s) const
{