mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-03-07 18:27:40 +08:00
Clean some previous changes and more cuda fixes
This commit is contained in:
parent
7cecd39a84
commit
f5aa640862
@ -491,10 +491,10 @@ template<typename Derived> class DenseBase
|
|||||||
typedef VectorwiseOp<Derived, Vertical> ColwiseReturnType;
|
typedef VectorwiseOp<Derived, Vertical> ColwiseReturnType;
|
||||||
typedef const VectorwiseOp<const Derived, Vertical> ConstColwiseReturnType;
|
typedef const VectorwiseOp<const Derived, Vertical> ConstColwiseReturnType;
|
||||||
|
|
||||||
ConstRowwiseReturnType rowwise() const;
|
EIGEN_DEVICE_FUNC ConstRowwiseReturnType rowwise() const;
|
||||||
RowwiseReturnType rowwise();
|
EIGEN_DEVICE_FUNC RowwiseReturnType rowwise();
|
||||||
ConstColwiseReturnType colwise() const;
|
EIGEN_DEVICE_FUNC ConstColwiseReturnType colwise() const;
|
||||||
ColwiseReturnType colwise();
|
EIGEN_DEVICE_FUNC ColwiseReturnType colwise();
|
||||||
|
|
||||||
typedef CwiseNullaryOp<internal::scalar_random_op<Scalar>,PlainObject> RandomReturnType;
|
typedef CwiseNullaryOp<internal::scalar_random_op<Scalar>,PlainObject> RandomReturnType;
|
||||||
static const RandomReturnType Random(Index rows, Index cols);
|
static const RandomReturnType Random(Index rows, Index cols);
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
} \
|
} \
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
namespace Eigen
|
namespace Eigen
|
||||||
{
|
{
|
||||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(real,scalar_real_op)
|
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(round,scalar_round_op)
|
||||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(floor,scalar_floor_op)
|
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(floor,scalar_floor_op)
|
||||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(ceil,scalar_ceil_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(isnan,scalar_isnan_op)
|
||||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isinf,scalar_isinf_op)
|
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isinf,scalar_isinf_op)
|
||||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isfinite,scalar_isfinite_op)
|
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isfinite,scalar_isfinite_op)
|
||||||
#endif
|
|
||||||
|
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline const Eigen::CwiseUnaryOp<Eigen::internal::scalar_pow_op<typename Derived::Scalar>, const Derived>
|
inline const Eigen::CwiseUnaryOp<Eigen::internal::scalar_pow_op<typename Derived::Scalar>, const Derived>
|
||||||
|
@ -794,7 +794,6 @@ bool (isfinite)(const T& x)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __CUDACC__
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
bool (isfinite)(const std::complex<T>& x)
|
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));
|
return (numext::isinf(numext::real(x)) || numext::isinf(numext::imag(x))) && (!numext::isnan(x));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
|
@ -312,7 +312,7 @@ template<typename Derived> class MatrixBase
|
|||||||
template<bool Enable> inline const Derived& forceAlignedAccessIf() const { return derived(); }
|
template<bool Enable> inline const Derived& forceAlignedAccessIf() const { return derived(); }
|
||||||
template<bool Enable> inline Derived& forceAlignedAccessIf() { 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;
|
template<int p> EIGEN_DEVICE_FUNC RealScalar lpNorm() const;
|
||||||
|
|
||||||
|
@ -644,7 +644,6 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
|
|||||||
* \sa rowwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting
|
* \sa rowwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_DEVICE_FUNC
|
|
||||||
inline const typename DenseBase<Derived>::ConstColwiseReturnType
|
inline const typename DenseBase<Derived>::ConstColwiseReturnType
|
||||||
DenseBase<Derived>::colwise() const
|
DenseBase<Derived>::colwise() const
|
||||||
{
|
{
|
||||||
@ -656,7 +655,6 @@ DenseBase<Derived>::colwise() const
|
|||||||
* \sa rowwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting
|
* \sa rowwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_DEVICE_FUNC
|
|
||||||
inline typename DenseBase<Derived>::ColwiseReturnType
|
inline typename DenseBase<Derived>::ColwiseReturnType
|
||||||
DenseBase<Derived>::colwise()
|
DenseBase<Derived>::colwise()
|
||||||
{
|
{
|
||||||
@ -671,7 +669,6 @@ DenseBase<Derived>::colwise()
|
|||||||
* \sa colwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting
|
* \sa colwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_DEVICE_FUNC
|
|
||||||
inline const typename DenseBase<Derived>::ConstRowwiseReturnType
|
inline const typename DenseBase<Derived>::ConstRowwiseReturnType
|
||||||
DenseBase<Derived>::rowwise() const
|
DenseBase<Derived>::rowwise() const
|
||||||
{
|
{
|
||||||
@ -683,7 +680,6 @@ DenseBase<Derived>::rowwise() const
|
|||||||
* \sa colwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting
|
* \sa colwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_DEVICE_FUNC
|
|
||||||
inline typename DenseBase<Derived>::RowwiseReturnType
|
inline typename DenseBase<Derived>::RowwiseReturnType
|
||||||
DenseBase<Derived>::rowwise()
|
DenseBase<Derived>::rowwise()
|
||||||
{
|
{
|
||||||
|
@ -22,6 +22,7 @@ struct visitor_impl
|
|||||||
row = (UnrollCount-1) % Derived::RowsAtCompileTime
|
row = (UnrollCount-1) % Derived::RowsAtCompileTime
|
||||||
};
|
};
|
||||||
|
|
||||||
|
EIGEN_DEVICE_FUNC
|
||||||
static inline void run(const Derived &mat, Visitor& visitor)
|
static inline void run(const Derived &mat, Visitor& visitor)
|
||||||
{
|
{
|
||||||
visitor_impl<Visitor, Derived, UnrollCount-1>::run(mat, visitor);
|
visitor_impl<Visitor, Derived, UnrollCount-1>::run(mat, visitor);
|
||||||
@ -32,6 +33,7 @@ struct visitor_impl
|
|||||||
template<typename Visitor, typename Derived>
|
template<typename Visitor, typename Derived>
|
||||||
struct visitor_impl<Visitor, Derived, 1>
|
struct visitor_impl<Visitor, Derived, 1>
|
||||||
{
|
{
|
||||||
|
EIGEN_DEVICE_FUNC
|
||||||
static inline void run(const Derived &mat, Visitor& visitor)
|
static inline void run(const Derived &mat, Visitor& visitor)
|
||||||
{
|
{
|
||||||
return visitor.init(mat.coeff(0, 0), 0, 0);
|
return visitor.init(mat.coeff(0, 0), 0, 0);
|
||||||
@ -41,6 +43,7 @@ struct visitor_impl<Visitor, Derived, 1>
|
|||||||
template<typename Visitor, typename Derived>
|
template<typename Visitor, typename Derived>
|
||||||
struct visitor_impl<Visitor, Derived, Dynamic>
|
struct visitor_impl<Visitor, Derived, Dynamic>
|
||||||
{
|
{
|
||||||
|
EIGEN_DEVICE_FUNC
|
||||||
static inline void run(const Derived& mat, Visitor& visitor)
|
static inline void run(const Derived& mat, Visitor& visitor)
|
||||||
{
|
{
|
||||||
visitor.init(mat.coeff(0,0), 0, 0);
|
visitor.init(mat.coeff(0,0), 0, 0);
|
||||||
@ -57,6 +60,7 @@ template<typename XprType>
|
|||||||
class visitor_evaluator
|
class visitor_evaluator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
EIGEN_DEVICE_FUNC
|
||||||
explicit visitor_evaluator(const XprType &xpr) : m_evaluator(xpr), m_xpr(xpr) {}
|
explicit visitor_evaluator(const XprType &xpr) : m_evaluator(xpr), m_xpr(xpr) {}
|
||||||
|
|
||||||
typedef typename XprType::Scalar Scalar;
|
typedef typename XprType::Scalar Scalar;
|
||||||
@ -67,11 +71,11 @@ public:
|
|||||||
CoeffReadCost = internal::evaluator<XprType>::CoeffReadCost
|
CoeffReadCost = internal::evaluator<XprType>::CoeffReadCost
|
||||||
};
|
};
|
||||||
|
|
||||||
Index rows() const { return m_xpr.rows(); }
|
EIGEN_DEVICE_FUNC Index rows() const { return m_xpr.rows(); }
|
||||||
Index cols() const { return m_xpr.cols(); }
|
EIGEN_DEVICE_FUNC Index cols() const { return m_xpr.cols(); }
|
||||||
Index size() const { return m_xpr.size(); }
|
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); }
|
{ return m_evaluator.coeff(row, col); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -654,7 +654,7 @@ template<typename SolverType> struct direct_selfadjoint_eigenvalues<SolverType,3
|
|||||||
Index k(0), l(2);
|
Index k(0), l(2);
|
||||||
if(d0 > d1)
|
if(d0 > d1)
|
||||||
{
|
{
|
||||||
std::swap(k,l);
|
numext::swap(k,l);
|
||||||
d0 = d1;
|
d0 = d1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,14 +53,17 @@ struct redux {
|
|||||||
void operator()(int i, const typename T::Scalar* in, typename T::Scalar* out) const
|
void operator()(int i, const typename T::Scalar* in, typename T::Scalar* out) const
|
||||||
{
|
{
|
||||||
using namespace Eigen;
|
using namespace Eigen;
|
||||||
int N = 6;
|
int N = 10;
|
||||||
T x1(in+i);
|
T x1(in+i);
|
||||||
out[i*N+0] = x1.minCoeff();
|
out[i*N+0] = x1.minCoeff();
|
||||||
out[i*N+1] = x1.maxCoeff();
|
out[i*N+1] = x1.maxCoeff();
|
||||||
out[i*N+2] = x1.sum();
|
out[i*N+2] = x1.sum();
|
||||||
out[i*N+3] = x1.prod();
|
out[i*N+3] = x1.prod();
|
||||||
// out[i*N+4] = x1.colwise().sum().maxCoeff();
|
out[i*N+4] = x1.matrix().squaredNorm();
|
||||||
// out[i*N+5] = x1.rowwise().maxCoeff().sum();
|
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();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user