Clean some previous changes and more cuda fixes

This commit is contained in:
Gael Guennebaud 2015-07-15 10:57:55 +02:00
parent 7cecd39a84
commit f5aa640862
8 changed files with 20 additions and 22 deletions

View File

@ -491,10 +491,10 @@ template<typename Derived> class DenseBase
typedef VectorwiseOp<Derived, Vertical> ColwiseReturnType;
typedef const VectorwiseOp<const Derived, Vertical> ConstColwiseReturnType;
ConstRowwiseReturnType rowwise() const;
RowwiseReturnType rowwise();
ConstColwiseReturnType colwise() const;
ColwiseReturnType colwise();
EIGEN_DEVICE_FUNC ConstRowwiseReturnType rowwise() const;
EIGEN_DEVICE_FUNC RowwiseReturnType rowwise();
EIGEN_DEVICE_FUNC ConstColwiseReturnType colwise() const;
EIGEN_DEVICE_FUNC ColwiseReturnType colwise();
typedef CwiseNullaryOp<internal::scalar_random_op<Scalar>,PlainObject> RandomReturnType;
static const RandomReturnType Random(Index rows, Index cols);

View File

@ -34,7 +34,6 @@
} \
};
namespace Eigen
{
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(real,scalar_real_op)
@ -62,11 +61,9 @@ namespace Eigen
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(round,scalar_round_op)
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(floor,scalar_floor_op)
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(ceil,scalar_ceil_op)
#ifndef __CUDACC__
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isnan,scalar_isnan_op)
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isinf,scalar_isinf_op)
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isfinite,scalar_isfinite_op)
#endif
template<typename Derived>
inline const Eigen::CwiseUnaryOp<Eigen::internal::scalar_pow_op<typename Derived::Scalar>, const Derived>

View File

@ -794,7 +794,6 @@ bool (isfinite)(const T& x)
#endif
}
#ifndef __CUDACC__
template<typename T>
bool (isfinite)(const std::complex<T>& x)
{
@ -812,7 +811,6 @@ bool (isinf)(const std::complex<T>& x)
{
return (numext::isinf(numext::real(x)) || numext::isinf(numext::imag(x))) && (!numext::isnan(x));
}
#endif
template<typename T>
EIGEN_DEVICE_FUNC

View File

@ -312,7 +312,7 @@ template<typename Derived> class MatrixBase
template<bool Enable> inline const Derived& forceAlignedAccessIf() const { return derived(); }
template<bool Enable> inline Derived& forceAlignedAccessIf() { return derived(); }
Scalar trace() const;
EIGEN_DEVICE_FUNC Scalar trace() const;
template<int p> EIGEN_DEVICE_FUNC RealScalar lpNorm() const;

View File

@ -644,7 +644,6 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
* \sa rowwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting
*/
template<typename Derived>
EIGEN_DEVICE_FUNC
inline const typename DenseBase<Derived>::ConstColwiseReturnType
DenseBase<Derived>::colwise() const
{
@ -656,7 +655,6 @@ DenseBase<Derived>::colwise() const
* \sa rowwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting
*/
template<typename Derived>
EIGEN_DEVICE_FUNC
inline typename DenseBase<Derived>::ColwiseReturnType
DenseBase<Derived>::colwise()
{
@ -671,7 +669,6 @@ DenseBase<Derived>::colwise()
* \sa colwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting
*/
template<typename Derived>
EIGEN_DEVICE_FUNC
inline const typename DenseBase<Derived>::ConstRowwiseReturnType
DenseBase<Derived>::rowwise() const
{
@ -683,7 +680,6 @@ DenseBase<Derived>::rowwise() const
* \sa colwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting
*/
template<typename Derived>
EIGEN_DEVICE_FUNC
inline typename DenseBase<Derived>::RowwiseReturnType
DenseBase<Derived>::rowwise()
{

View File

@ -22,6 +22,7 @@ struct visitor_impl
row = (UnrollCount-1) % Derived::RowsAtCompileTime
};
EIGEN_DEVICE_FUNC
static inline void run(const Derived &mat, Visitor& visitor)
{
visitor_impl<Visitor, Derived, UnrollCount-1>::run(mat, visitor);
@ -32,6 +33,7 @@ struct visitor_impl
template<typename Visitor, typename Derived>
struct visitor_impl<Visitor, Derived, 1>
{
EIGEN_DEVICE_FUNC
static inline void run(const Derived &mat, Visitor& visitor)
{
return visitor.init(mat.coeff(0, 0), 0, 0);
@ -41,6 +43,7 @@ struct visitor_impl<Visitor, Derived, 1>
template<typename Visitor, typename Derived>
struct visitor_impl<Visitor, Derived, Dynamic>
{
EIGEN_DEVICE_FUNC
static inline void run(const Derived& mat, Visitor& visitor)
{
visitor.init(mat.coeff(0,0), 0, 0);
@ -57,6 +60,7 @@ template<typename XprType>
class visitor_evaluator
{
public:
EIGEN_DEVICE_FUNC
explicit visitor_evaluator(const XprType &xpr) : m_evaluator(xpr), m_xpr(xpr) {}
typedef typename XprType::Scalar Scalar;
@ -67,11 +71,11 @@ public:
CoeffReadCost = internal::evaluator<XprType>::CoeffReadCost
};
Index rows() const { return m_xpr.rows(); }
Index cols() const { return m_xpr.cols(); }
Index size() const { return m_xpr.size(); }
EIGEN_DEVICE_FUNC Index rows() const { return m_xpr.rows(); }
EIGEN_DEVICE_FUNC Index cols() const { return m_xpr.cols(); }
EIGEN_DEVICE_FUNC Index size() const { return m_xpr.size(); }
CoeffReturnType coeff(Index row, Index col) const
EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index row, Index col) const
{ return m_evaluator.coeff(row, col); }
protected:

View File

@ -654,7 +654,7 @@ template<typename SolverType> struct direct_selfadjoint_eigenvalues<SolverType,3
Index k(0), l(2);
if(d0 > d1)
{
std::swap(k,l);
numext::swap(k,l);
d0 = d1;
}

View File

@ -53,14 +53,17 @@ struct redux {
void operator()(int i, const typename T::Scalar* in, typename T::Scalar* out) const
{
using namespace Eigen;
int N = 6;
int N = 10;
T x1(in+i);
out[i*N+0] = x1.minCoeff();
out[i*N+1] = x1.maxCoeff();
out[i*N+2] = x1.sum();
out[i*N+3] = x1.prod();
// out[i*N+4] = x1.colwise().sum().maxCoeff();
// out[i*N+5] = x1.rowwise().maxCoeff().sum();
out[i*N+4] = x1.matrix().squaredNorm();
out[i*N+5] = x1.matrix().norm();
out[i*N+6] = x1.colwise().sum().maxCoeff();
out[i*N+7] = x1.rowwise().maxCoeff().sum();
out[i*N+8] = x1.matrix().colwise().squaredNorm().sum();
}
};