aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/LU
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/LU
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/LU')
-rw-r--r--Eigen/src/LU/FullPivLU.h2
-rw-r--r--Eigen/src/LU/Inverse.h23
-rw-r--r--Eigen/src/LU/PartialPivLU.h5
3 files changed, 27 insertions, 3 deletions
diff --git a/Eigen/src/LU/FullPivLU.h b/Eigen/src/LU/FullPivLU.h
index 14a9c402d..bcd30be00 100644
--- a/Eigen/src/LU/FullPivLU.h
+++ b/Eigen/src/LU/FullPivLU.h
@@ -727,12 +727,14 @@ struct solve_retval<FullPivLU<_MatrixType>, Rhs>
*
* \sa class FullPivLU
*/
+#ifndef __CUDACC__
template<typename Derived>
inline const FullPivLU<typename MatrixBase<Derived>::PlainObject>
MatrixBase<Derived>::fullPivLu() const
{
return FullPivLU<PlainObject>(eval());
}
+#endif
} // end namespace Eigen
diff --git a/Eigen/src/LU/Inverse.h b/Eigen/src/LU/Inverse.h
index a5ae83bf4..57f9f686c 100644
--- a/Eigen/src/LU/Inverse.h
+++ b/Eigen/src/LU/Inverse.h
@@ -21,6 +21,7 @@ namespace internal {
template<typename MatrixType, typename ResultType, int Size = MatrixType::RowsAtCompileTime>
struct compute_inverse
{
+ EIGEN_DEVICE_FUNC
static inline void run(const MatrixType& matrix, ResultType& result)
{
result = matrix.partialPivLu().inverse();
@@ -37,6 +38,7 @@ struct compute_inverse_and_det_with_check { /* nothing! general case not support
template<typename MatrixType, typename ResultType>
struct compute_inverse<MatrixType, ResultType, 1>
{
+ EIGEN_DEVICE_FUNC
static inline void run(const MatrixType& matrix, ResultType& result)
{
typedef typename MatrixType::Scalar Scalar;
@@ -47,6 +49,7 @@ struct compute_inverse<MatrixType, ResultType, 1>
template<typename MatrixType, typename ResultType>
struct compute_inverse_and_det_with_check<MatrixType, ResultType, 1>
{
+ EIGEN_DEVICE_FUNC
static inline void run(
const MatrixType& matrix,
const typename MatrixType::RealScalar& absDeterminantThreshold,
@@ -67,6 +70,7 @@ struct compute_inverse_and_det_with_check<MatrixType, ResultType, 1>
****************************/
template<typename MatrixType, typename ResultType>
+EIGEN_DEVICE_FUNC
inline void compute_inverse_size2_helper(
const MatrixType& matrix, const typename ResultType::Scalar& invdet,
ResultType& result)
@@ -80,6 +84,7 @@ inline void compute_inverse_size2_helper(
template<typename MatrixType, typename ResultType>
struct compute_inverse<MatrixType, ResultType, 2>
{
+ EIGEN_DEVICE_FUNC
static inline void run(const MatrixType& matrix, ResultType& result)
{
typedef typename ResultType::Scalar Scalar;
@@ -91,6 +96,7 @@ struct compute_inverse<MatrixType, ResultType, 2>
template<typename MatrixType, typename ResultType>
struct compute_inverse_and_det_with_check<MatrixType, ResultType, 2>
{
+ EIGEN_DEVICE_FUNC
static inline void run(
const MatrixType& matrix,
const typename MatrixType::RealScalar& absDeterminantThreshold,
@@ -114,6 +120,7 @@ struct compute_inverse_and_det_with_check<MatrixType, ResultType, 2>
****************************/
template<typename MatrixType, int i, int j>
+EIGEN_DEVICE_FUNC
inline typename MatrixType::Scalar cofactor_3x3(const MatrixType& m)
{
enum {
@@ -127,6 +134,7 @@ inline typename MatrixType::Scalar cofactor_3x3(const MatrixType& m)
}
template<typename MatrixType, typename ResultType>
+EIGEN_DEVICE_FUNC
inline void compute_inverse_size3_helper(
const MatrixType& matrix,
const typename ResultType::Scalar& invdet,
@@ -145,6 +153,7 @@ inline void compute_inverse_size3_helper(
template<typename MatrixType, typename ResultType>
struct compute_inverse<MatrixType, ResultType, 3>
{
+ EIGEN_DEVICE_FUNC
static inline void run(const MatrixType& matrix, ResultType& result)
{
typedef typename ResultType::Scalar Scalar;
@@ -161,6 +170,7 @@ struct compute_inverse<MatrixType, ResultType, 3>
template<typename MatrixType, typename ResultType>
struct compute_inverse_and_det_with_check<MatrixType, ResultType, 3>
{
+ EIGEN_DEVICE_FUNC
static inline void run(
const MatrixType& matrix,
const typename MatrixType::RealScalar& absDeterminantThreshold,
@@ -188,6 +198,7 @@ struct compute_inverse_and_det_with_check<MatrixType, ResultType, 3>
****************************/
template<typename Derived>
+EIGEN_DEVICE_FUNC
inline const typename Derived::Scalar general_det3_helper
(const MatrixBase<Derived>& matrix, int i1, int i2, int i3, int j1, int j2, int j3)
{
@@ -196,6 +207,7 @@ inline const typename Derived::Scalar general_det3_helper
}
template<typename MatrixType, int i, int j>
+EIGEN_DEVICE_FUNC
inline typename MatrixType::Scalar cofactor_4x4(const MatrixType& matrix)
{
enum {
@@ -214,6 +226,7 @@ inline typename MatrixType::Scalar cofactor_4x4(const MatrixType& matrix)
template<int Arch, typename Scalar, typename MatrixType, typename ResultType>
struct compute_inverse_size4
{
+ EIGEN_DEVICE_FUNC
static void run(const MatrixType& matrix, ResultType& result)
{
result.coeffRef(0,0) = cofactor_4x4<MatrixType,0,0>(matrix);
@@ -246,6 +259,7 @@ struct compute_inverse<MatrixType, ResultType, 4>
template<typename MatrixType, typename ResultType>
struct compute_inverse_and_det_with_check<MatrixType, ResultType, 4>
{
+ EIGEN_DEVICE_FUNC
static inline void run(
const MatrixType& matrix,
const typename MatrixType::RealScalar& absDeterminantThreshold,
@@ -279,14 +293,17 @@ struct inverse_impl : public ReturnByValue<inverse_impl<MatrixType> >
typedef typename remove_all<MatrixTypeNested>::type MatrixTypeNestedCleaned;
MatrixTypeNested m_matrix;
+ EIGEN_DEVICE_FUNC
inverse_impl(const MatrixType& matrix)
: m_matrix(matrix)
{}
- inline Index rows() const { return m_matrix.rows(); }
- inline Index cols() const { return m_matrix.cols(); }
+ EIGEN_DEVICE_FUNC inline Index rows() const { return m_matrix.rows(); }
+ EIGEN_DEVICE_FUNC inline Index cols() const { return m_matrix.cols(); }
- template<typename Dest> inline void evalTo(Dest& dst) const
+ template<typename Dest>
+ EIGEN_DEVICE_FUNC
+ inline void evalTo(Dest& dst) const
{
const int Size = EIGEN_PLAIN_ENUM_MIN(MatrixType::ColsAtCompileTime,Dest::ColsAtCompileTime);
EIGEN_ONLY_USED_FOR_DEBUG(Size);
diff --git a/Eigen/src/LU/PartialPivLU.h b/Eigen/src/LU/PartialPivLU.h
index c9ff9dd5a..9cf1d61d8 100644
--- a/Eigen/src/LU/PartialPivLU.h
+++ b/Eigen/src/LU/PartialPivLU.h
@@ -469,12 +469,14 @@ struct solve_retval<PartialPivLU<_MatrixType>, Rhs>
*
* \sa class PartialPivLU
*/
+#ifndef __CUDACC__
template<typename Derived>
inline const PartialPivLU<typename MatrixBase<Derived>::PlainObject>
MatrixBase<Derived>::partialPivLu() const
{
return PartialPivLU<PlainObject>(eval());
}
+#endif
#if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS
/** \lu_module
@@ -485,6 +487,7 @@ MatrixBase<Derived>::partialPivLu() const
*
* \sa class PartialPivLU
*/
+#ifndef __CUDACC__
template<typename Derived>
inline const PartialPivLU<typename MatrixBase<Derived>::PlainObject>
MatrixBase<Derived>::lu() const
@@ -493,6 +496,8 @@ MatrixBase<Derived>::lu() const
}
#endif
+#endif
+
} // end namespace Eigen
#endif // EIGEN_PARTIALLU_H