mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-20 22:52:51 +08:00
Merged eigen/eigen into default
This commit is contained in:
commit
f8a622ef3c
@ -258,7 +258,6 @@ template<typename _MatrixType, int _UpLo> class LDLT
|
|||||||
|
|
||||||
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||||
template<typename RhsType, typename DstType>
|
template<typename RhsType, typename DstType>
|
||||||
EIGEN_DEVICE_FUNC
|
|
||||||
void _solve_impl(const RhsType &rhs, DstType &dst) const;
|
void _solve_impl(const RhsType &rhs, DstType &dst) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -200,7 +200,6 @@ template<typename _MatrixType, int _UpLo> class LLT
|
|||||||
|
|
||||||
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||||
template<typename RhsType, typename DstType>
|
template<typename RhsType, typename DstType>
|
||||||
EIGEN_DEVICE_FUNC
|
|
||||||
void _solve_impl(const RhsType &rhs, DstType &dst) const;
|
void _solve_impl(const RhsType &rhs, DstType &dst) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ template<typename Derived> class ArrayBase
|
|||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
EIGEN_STRONG_INLINE Derived &
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived &
|
||||||
ArrayBase<Derived>::operator-=(const ArrayBase<OtherDerived> &other)
|
ArrayBase<Derived>::operator-=(const ArrayBase<OtherDerived> &other)
|
||||||
{
|
{
|
||||||
call_assignment(derived(), other.derived(), internal::sub_assign_op<Scalar,typename OtherDerived::Scalar>());
|
call_assignment(derived(), other.derived(), internal::sub_assign_op<Scalar,typename OtherDerived::Scalar>());
|
||||||
@ -188,7 +188,7 @@ ArrayBase<Derived>::operator-=(const ArrayBase<OtherDerived> &other)
|
|||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
EIGEN_STRONG_INLINE Derived &
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived &
|
||||||
ArrayBase<Derived>::operator+=(const ArrayBase<OtherDerived>& other)
|
ArrayBase<Derived>::operator+=(const ArrayBase<OtherDerived>& other)
|
||||||
{
|
{
|
||||||
call_assignment(derived(), other.derived(), internal::add_assign_op<Scalar,typename OtherDerived::Scalar>());
|
call_assignment(derived(), other.derived(), internal::add_assign_op<Scalar,typename OtherDerived::Scalar>());
|
||||||
@ -201,7 +201,7 @@ ArrayBase<Derived>::operator+=(const ArrayBase<OtherDerived>& other)
|
|||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
EIGEN_STRONG_INLINE Derived &
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived &
|
||||||
ArrayBase<Derived>::operator*=(const ArrayBase<OtherDerived>& other)
|
ArrayBase<Derived>::operator*=(const ArrayBase<OtherDerived>& other)
|
||||||
{
|
{
|
||||||
call_assignment(derived(), other.derived(), internal::mul_assign_op<Scalar,typename OtherDerived::Scalar>());
|
call_assignment(derived(), other.derived(), internal::mul_assign_op<Scalar,typename OtherDerived::Scalar>());
|
||||||
@ -214,7 +214,7 @@ ArrayBase<Derived>::operator*=(const ArrayBase<OtherDerived>& other)
|
|||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
EIGEN_STRONG_INLINE Derived &
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived &
|
||||||
ArrayBase<Derived>::operator/=(const ArrayBase<OtherDerived>& other)
|
ArrayBase<Derived>::operator/=(const ArrayBase<OtherDerived>& other)
|
||||||
{
|
{
|
||||||
call_assignment(derived(), other.derived(), internal::div_assign_op<Scalar,typename OtherDerived::Scalar>());
|
call_assignment(derived(), other.derived(), internal::div_assign_op<Scalar,typename OtherDerived::Scalar>());
|
||||||
|
@ -16,7 +16,7 @@ namespace Eigen {
|
|||||||
|
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
EIGEN_STRONG_INLINE Derived& DenseBase<Derived>
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>
|
||||||
::lazyAssign(const DenseBase<OtherDerived>& other)
|
::lazyAssign(const DenseBase<OtherDerived>& other)
|
||||||
{
|
{
|
||||||
enum{
|
enum{
|
||||||
|
@ -76,7 +76,7 @@ struct any_unroller<Derived, Dynamic, Rows>
|
|||||||
* \sa any(), Cwise::operator<()
|
* \sa any(), Cwise::operator<()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline bool DenseBase<Derived>::all() const
|
EIGEN_DEVICE_FUNC inline bool DenseBase<Derived>::all() const
|
||||||
{
|
{
|
||||||
typedef internal::evaluator<Derived> Evaluator;
|
typedef internal::evaluator<Derived> Evaluator;
|
||||||
enum {
|
enum {
|
||||||
@ -100,7 +100,7 @@ inline bool DenseBase<Derived>::all() const
|
|||||||
* \sa all()
|
* \sa all()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline bool DenseBase<Derived>::any() const
|
EIGEN_DEVICE_FUNC inline bool DenseBase<Derived>::any() const
|
||||||
{
|
{
|
||||||
typedef internal::evaluator<Derived> Evaluator;
|
typedef internal::evaluator<Derived> Evaluator;
|
||||||
enum {
|
enum {
|
||||||
@ -124,7 +124,7 @@ inline bool DenseBase<Derived>::any() const
|
|||||||
* \sa all(), any()
|
* \sa all(), any()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline Eigen::Index DenseBase<Derived>::count() const
|
EIGEN_DEVICE_FUNC inline Eigen::Index DenseBase<Derived>::count() const
|
||||||
{
|
{
|
||||||
return derived().template cast<bool>().template cast<Index>().sum();
|
return derived().template cast<bool>().template cast<Index>().sum();
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ struct CommaInitializer
|
|||||||
* \sa CommaInitializer::finished(), class CommaInitializer
|
* \sa CommaInitializer::finished(), class CommaInitializer
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline CommaInitializer<Derived> DenseBase<Derived>::operator<< (const Scalar& s)
|
EIGEN_DEVICE_FUNC inline CommaInitializer<Derived> DenseBase<Derived>::operator<< (const Scalar& s)
|
||||||
{
|
{
|
||||||
return CommaInitializer<Derived>(*static_cast<Derived*>(this), s);
|
return CommaInitializer<Derived>(*static_cast<Derived*>(this), s);
|
||||||
}
|
}
|
||||||
@ -149,7 +149,7 @@ inline CommaInitializer<Derived> DenseBase<Derived>::operator<< (const Scalar& s
|
|||||||
/** \sa operator<<(const Scalar&) */
|
/** \sa operator<<(const Scalar&) */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
inline CommaInitializer<Derived>
|
EIGEN_DEVICE_FUNC inline CommaInitializer<Derived>
|
||||||
DenseBase<Derived>::operator<<(const DenseBase<OtherDerived>& other)
|
DenseBase<Derived>::operator<<(const DenseBase<OtherDerived>& other)
|
||||||
{
|
{
|
||||||
return CommaInitializer<Derived>(*static_cast<Derived *>(this), other);
|
return CommaInitializer<Derived>(*static_cast<Derived *>(this), other);
|
||||||
|
@ -134,19 +134,19 @@ private:
|
|||||||
// this helper permits to completely eliminate m_outerStride if it is known at compiletime.
|
// this helper permits to completely eliminate m_outerStride if it is known at compiletime.
|
||||||
template<typename Scalar,int OuterStride> class plainobjectbase_evaluator_data {
|
template<typename Scalar,int OuterStride> class plainobjectbase_evaluator_data {
|
||||||
public:
|
public:
|
||||||
plainobjectbase_evaluator_data(const Scalar* ptr, Index outerStride) : data(ptr)
|
EIGEN_DEVICE_FUNC plainobjectbase_evaluator_data(const Scalar* ptr, Index outerStride) : data(ptr)
|
||||||
{
|
{
|
||||||
EIGEN_ONLY_USED_FOR_DEBUG(outerStride);
|
EIGEN_ONLY_USED_FOR_DEBUG(outerStride);
|
||||||
eigen_internal_assert(outerStride==OuterStride);
|
eigen_internal_assert(outerStride==OuterStride);
|
||||||
}
|
}
|
||||||
Index outerStride() const { return OuterStride; }
|
EIGEN_DEVICE_FUNC Index outerStride() const { return OuterStride; }
|
||||||
const Scalar *data;
|
const Scalar *data;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Scalar> class plainobjectbase_evaluator_data<Scalar,Dynamic> {
|
template<typename Scalar> class plainobjectbase_evaluator_data<Scalar,Dynamic> {
|
||||||
public:
|
public:
|
||||||
plainobjectbase_evaluator_data(const Scalar* ptr, Index outerStride) : data(ptr), m_outerStride(outerStride) {}
|
EIGEN_DEVICE_FUNC plainobjectbase_evaluator_data(const Scalar* ptr, Index outerStride) : data(ptr), m_outerStride(outerStride) {}
|
||||||
Index outerStride() const { return m_outerStride; }
|
EIGEN_DEVICE_FUNC Index outerStride() const { return m_outerStride; }
|
||||||
const Scalar *data;
|
const Scalar *data;
|
||||||
protected:
|
protected:
|
||||||
Index m_outerStride;
|
Index m_outerStride;
|
||||||
|
@ -158,7 +158,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
EIGEN_STRONG_INLINE Derived &
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived &
|
||||||
MatrixBase<Derived>::operator-=(const MatrixBase<OtherDerived> &other)
|
MatrixBase<Derived>::operator-=(const MatrixBase<OtherDerived> &other)
|
||||||
{
|
{
|
||||||
call_assignment(derived(), other.derived(), internal::sub_assign_op<Scalar,typename OtherDerived::Scalar>());
|
call_assignment(derived(), other.derived(), internal::sub_assign_op<Scalar,typename OtherDerived::Scalar>());
|
||||||
@ -171,7 +171,7 @@ MatrixBase<Derived>::operator-=(const MatrixBase<OtherDerived> &other)
|
|||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
EIGEN_STRONG_INLINE Derived &
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived &
|
||||||
MatrixBase<Derived>::operator+=(const MatrixBase<OtherDerived>& other)
|
MatrixBase<Derived>::operator+=(const MatrixBase<OtherDerived>& other)
|
||||||
{
|
{
|
||||||
call_assignment(derived(), other.derived(), internal::add_assign_op<Scalar,typename OtherDerived::Scalar>());
|
call_assignment(derived(), other.derived(), internal::add_assign_op<Scalar,typename OtherDerived::Scalar>());
|
||||||
@ -181,4 +181,3 @@ MatrixBase<Derived>::operator+=(const MatrixBase<OtherDerived>& other)
|
|||||||
} // end namespace Eigen
|
} // end namespace Eigen
|
||||||
|
|
||||||
#endif // EIGEN_CWISE_BINARY_OP_H
|
#endif // EIGEN_CWISE_BINARY_OP_H
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ class CwiseNullaryOp : public internal::dense_xpr_base< CwiseNullaryOp<NullaryOp
|
|||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename CustomNullaryOp>
|
template<typename CustomNullaryOp>
|
||||||
EIGEN_STRONG_INLINE const CwiseNullaryOp<CustomNullaryOp, typename DenseBase<Derived>::PlainObject>
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseNullaryOp<CustomNullaryOp, typename DenseBase<Derived>::PlainObject>
|
||||||
DenseBase<Derived>::NullaryExpr(Index rows, Index cols, const CustomNullaryOp& func)
|
DenseBase<Derived>::NullaryExpr(Index rows, Index cols, const CustomNullaryOp& func)
|
||||||
{
|
{
|
||||||
return CwiseNullaryOp<CustomNullaryOp, PlainObject>(rows, cols, func);
|
return CwiseNullaryOp<CustomNullaryOp, PlainObject>(rows, cols, func);
|
||||||
@ -131,7 +131,7 @@ DenseBase<Derived>::NullaryExpr(Index rows, Index cols, const CustomNullaryOp& f
|
|||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename CustomNullaryOp>
|
template<typename CustomNullaryOp>
|
||||||
EIGEN_STRONG_INLINE const CwiseNullaryOp<CustomNullaryOp, typename DenseBase<Derived>::PlainObject>
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseNullaryOp<CustomNullaryOp, typename DenseBase<Derived>::PlainObject>
|
||||||
DenseBase<Derived>::NullaryExpr(Index size, const CustomNullaryOp& func)
|
DenseBase<Derived>::NullaryExpr(Index size, const CustomNullaryOp& func)
|
||||||
{
|
{
|
||||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
||||||
@ -150,7 +150,7 @@ DenseBase<Derived>::NullaryExpr(Index size, const CustomNullaryOp& func)
|
|||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename CustomNullaryOp>
|
template<typename CustomNullaryOp>
|
||||||
EIGEN_STRONG_INLINE const CwiseNullaryOp<CustomNullaryOp, typename DenseBase<Derived>::PlainObject>
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseNullaryOp<CustomNullaryOp, typename DenseBase<Derived>::PlainObject>
|
||||||
DenseBase<Derived>::NullaryExpr(const CustomNullaryOp& func)
|
DenseBase<Derived>::NullaryExpr(const CustomNullaryOp& func)
|
||||||
{
|
{
|
||||||
return CwiseNullaryOp<CustomNullaryOp, PlainObject>(RowsAtCompileTime, ColsAtCompileTime, func);
|
return CwiseNullaryOp<CustomNullaryOp, PlainObject>(RowsAtCompileTime, ColsAtCompileTime, func);
|
||||||
@ -170,7 +170,7 @@ DenseBase<Derived>::NullaryExpr(const CustomNullaryOp& func)
|
|||||||
* \sa class CwiseNullaryOp
|
* \sa class CwiseNullaryOp
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
|
||||||
DenseBase<Derived>::Constant(Index rows, Index cols, const Scalar& value)
|
DenseBase<Derived>::Constant(Index rows, Index cols, const Scalar& value)
|
||||||
{
|
{
|
||||||
return DenseBase<Derived>::NullaryExpr(rows, cols, internal::scalar_constant_op<Scalar>(value));
|
return DenseBase<Derived>::NullaryExpr(rows, cols, internal::scalar_constant_op<Scalar>(value));
|
||||||
@ -192,7 +192,7 @@ DenseBase<Derived>::Constant(Index rows, Index cols, const Scalar& value)
|
|||||||
* \sa class CwiseNullaryOp
|
* \sa class CwiseNullaryOp
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
|
||||||
DenseBase<Derived>::Constant(Index size, const Scalar& value)
|
DenseBase<Derived>::Constant(Index size, const Scalar& value)
|
||||||
{
|
{
|
||||||
return DenseBase<Derived>::NullaryExpr(size, internal::scalar_constant_op<Scalar>(value));
|
return DenseBase<Derived>::NullaryExpr(size, internal::scalar_constant_op<Scalar>(value));
|
||||||
@ -208,7 +208,7 @@ DenseBase<Derived>::Constant(Index size, const Scalar& value)
|
|||||||
* \sa class CwiseNullaryOp
|
* \sa class CwiseNullaryOp
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
|
||||||
DenseBase<Derived>::Constant(const Scalar& value)
|
DenseBase<Derived>::Constant(const Scalar& value)
|
||||||
{
|
{
|
||||||
EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
|
EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
|
||||||
@ -220,7 +220,7 @@ DenseBase<Derived>::Constant(const Scalar& value)
|
|||||||
* \sa LinSpaced(Index,Scalar,Scalar), setLinSpaced(Index,const Scalar&,const Scalar&)
|
* \sa LinSpaced(Index,Scalar,Scalar), setLinSpaced(Index,const Scalar&,const Scalar&)
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessLinSpacedReturnType
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessLinSpacedReturnType
|
||||||
DenseBase<Derived>::LinSpaced(Sequential_t, Index size, const Scalar& low, const Scalar& high)
|
DenseBase<Derived>::LinSpaced(Sequential_t, Index size, const Scalar& low, const Scalar& high)
|
||||||
{
|
{
|
||||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
||||||
@ -232,7 +232,7 @@ DenseBase<Derived>::LinSpaced(Sequential_t, Index size, const Scalar& low, const
|
|||||||
* \sa LinSpaced(Scalar,Scalar)
|
* \sa LinSpaced(Scalar,Scalar)
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessLinSpacedReturnType
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessLinSpacedReturnType
|
||||||
DenseBase<Derived>::LinSpaced(Sequential_t, const Scalar& low, const Scalar& high)
|
DenseBase<Derived>::LinSpaced(Sequential_t, const Scalar& low, const Scalar& high)
|
||||||
{
|
{
|
||||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
||||||
@ -264,7 +264,7 @@ DenseBase<Derived>::LinSpaced(Sequential_t, const Scalar& low, const Scalar& hig
|
|||||||
* \sa setLinSpaced(Index,const Scalar&,const Scalar&), CwiseNullaryOp
|
* \sa setLinSpaced(Index,const Scalar&,const Scalar&), CwiseNullaryOp
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessLinSpacedReturnType
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessLinSpacedReturnType
|
||||||
DenseBase<Derived>::LinSpaced(Index size, const Scalar& low, const Scalar& high)
|
DenseBase<Derived>::LinSpaced(Index size, const Scalar& low, const Scalar& high)
|
||||||
{
|
{
|
||||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
||||||
@ -276,7 +276,7 @@ DenseBase<Derived>::LinSpaced(Index size, const Scalar& low, const Scalar& high)
|
|||||||
* Special version for fixed size types which does not require the size parameter.
|
* Special version for fixed size types which does not require the size parameter.
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessLinSpacedReturnType
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessLinSpacedReturnType
|
||||||
DenseBase<Derived>::LinSpaced(const Scalar& low, const Scalar& high)
|
DenseBase<Derived>::LinSpaced(const Scalar& low, const Scalar& high)
|
||||||
{
|
{
|
||||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
||||||
@ -286,7 +286,7 @@ DenseBase<Derived>::LinSpaced(const Scalar& low, const Scalar& high)
|
|||||||
|
|
||||||
/** \returns true if all coefficients in this matrix are approximately equal to \a val, to within precision \a prec */
|
/** \returns true if all coefficients in this matrix are approximately equal to \a val, to within precision \a prec */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
bool DenseBase<Derived>::isApproxToConstant
|
EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isApproxToConstant
|
||||||
(const Scalar& val, const RealScalar& prec) const
|
(const Scalar& val, const RealScalar& prec) const
|
||||||
{
|
{
|
||||||
typename internal::nested_eval<Derived,1>::type self(derived());
|
typename internal::nested_eval<Derived,1>::type self(derived());
|
||||||
@ -301,7 +301,7 @@ bool DenseBase<Derived>::isApproxToConstant
|
|||||||
*
|
*
|
||||||
* \returns true if all coefficients in this matrix are approximately equal to \a value, to within precision \a prec */
|
* \returns true if all coefficients in this matrix are approximately equal to \a value, to within precision \a prec */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
bool DenseBase<Derived>::isConstant
|
EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isConstant
|
||||||
(const Scalar& val, const RealScalar& prec) const
|
(const Scalar& val, const RealScalar& prec) const
|
||||||
{
|
{
|
||||||
return isApproxToConstant(val, prec);
|
return isApproxToConstant(val, prec);
|
||||||
@ -312,7 +312,7 @@ bool DenseBase<Derived>::isConstant
|
|||||||
* \sa setConstant(), Constant(), class CwiseNullaryOp
|
* \sa setConstant(), Constant(), class CwiseNullaryOp
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE void DenseBase<Derived>::fill(const Scalar& val)
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void DenseBase<Derived>::fill(const Scalar& val)
|
||||||
{
|
{
|
||||||
setConstant(val);
|
setConstant(val);
|
||||||
}
|
}
|
||||||
@ -322,7 +322,7 @@ EIGEN_STRONG_INLINE void DenseBase<Derived>::fill(const Scalar& val)
|
|||||||
* \sa fill(), setConstant(Index,const Scalar&), setConstant(Index,Index,const Scalar&), setZero(), setOnes(), Constant(), class CwiseNullaryOp, setZero(), setOnes()
|
* \sa fill(), setConstant(Index,const Scalar&), setConstant(Index,Index,const Scalar&), setZero(), setOnes(), Constant(), class CwiseNullaryOp, setZero(), setOnes()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setConstant(const Scalar& val)
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setConstant(const Scalar& val)
|
||||||
{
|
{
|
||||||
return derived() = Constant(rows(), cols(), val);
|
return derived() = Constant(rows(), cols(), val);
|
||||||
}
|
}
|
||||||
@ -337,7 +337,7 @@ EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setConstant(const Scalar& val)
|
|||||||
* \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&)
|
* \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&)
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE Derived&
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
|
||||||
PlainObjectBase<Derived>::setConstant(Index size, const Scalar& val)
|
PlainObjectBase<Derived>::setConstant(Index size, const Scalar& val)
|
||||||
{
|
{
|
||||||
resize(size);
|
resize(size);
|
||||||
@ -356,7 +356,7 @@ PlainObjectBase<Derived>::setConstant(Index size, const Scalar& val)
|
|||||||
* \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&)
|
* \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&)
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE Derived&
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
|
||||||
PlainObjectBase<Derived>::setConstant(Index rows, Index cols, const Scalar& val)
|
PlainObjectBase<Derived>::setConstant(Index rows, Index cols, const Scalar& val)
|
||||||
{
|
{
|
||||||
resize(rows, cols);
|
resize(rows, cols);
|
||||||
@ -380,7 +380,7 @@ PlainObjectBase<Derived>::setConstant(Index rows, Index cols, const Scalar& val)
|
|||||||
* \sa LinSpaced(Index,const Scalar&,const Scalar&), CwiseNullaryOp
|
* \sa LinSpaced(Index,const Scalar&,const Scalar&), CwiseNullaryOp
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setLinSpaced(Index newSize, const Scalar& low, const Scalar& high)
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setLinSpaced(Index newSize, const Scalar& low, const Scalar& high)
|
||||||
{
|
{
|
||||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
||||||
return derived() = Derived::NullaryExpr(newSize, internal::linspaced_op<Scalar,PacketScalar>(low,high,newSize));
|
return derived() = Derived::NullaryExpr(newSize, internal::linspaced_op<Scalar,PacketScalar>(low,high,newSize));
|
||||||
@ -400,7 +400,7 @@ EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setLinSpaced(Index newSize, con
|
|||||||
* \sa LinSpaced(Index,const Scalar&,const Scalar&), setLinSpaced(Index, const Scalar&, const Scalar&), CwiseNullaryOp
|
* \sa LinSpaced(Index,const Scalar&,const Scalar&), setLinSpaced(Index, const Scalar&, const Scalar&), CwiseNullaryOp
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setLinSpaced(const Scalar& low, const Scalar& high)
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setLinSpaced(const Scalar& low, const Scalar& high)
|
||||||
{
|
{
|
||||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
||||||
return setLinSpaced(size(), low, high);
|
return setLinSpaced(size(), low, high);
|
||||||
@ -423,7 +423,7 @@ EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setLinSpaced(const Scalar& low,
|
|||||||
* \sa Zero(), Zero(Index)
|
* \sa Zero(), Zero(Index)
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
|
||||||
DenseBase<Derived>::Zero(Index rows, Index cols)
|
DenseBase<Derived>::Zero(Index rows, Index cols)
|
||||||
{
|
{
|
||||||
return Constant(rows, cols, Scalar(0));
|
return Constant(rows, cols, Scalar(0));
|
||||||
@ -446,7 +446,7 @@ DenseBase<Derived>::Zero(Index rows, Index cols)
|
|||||||
* \sa Zero(), Zero(Index,Index)
|
* \sa Zero(), Zero(Index,Index)
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
|
||||||
DenseBase<Derived>::Zero(Index size)
|
DenseBase<Derived>::Zero(Index size)
|
||||||
{
|
{
|
||||||
return Constant(size, Scalar(0));
|
return Constant(size, Scalar(0));
|
||||||
@ -463,7 +463,7 @@ DenseBase<Derived>::Zero(Index size)
|
|||||||
* \sa Zero(Index), Zero(Index,Index)
|
* \sa Zero(Index), Zero(Index,Index)
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
|
||||||
DenseBase<Derived>::Zero()
|
DenseBase<Derived>::Zero()
|
||||||
{
|
{
|
||||||
return Constant(Scalar(0));
|
return Constant(Scalar(0));
|
||||||
@ -478,7 +478,7 @@ DenseBase<Derived>::Zero()
|
|||||||
* \sa class CwiseNullaryOp, Zero()
|
* \sa class CwiseNullaryOp, Zero()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
bool DenseBase<Derived>::isZero(const RealScalar& prec) const
|
EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isZero(const RealScalar& prec) const
|
||||||
{
|
{
|
||||||
typename internal::nested_eval<Derived,1>::type self(derived());
|
typename internal::nested_eval<Derived,1>::type self(derived());
|
||||||
for(Index j = 0; j < cols(); ++j)
|
for(Index j = 0; j < cols(); ++j)
|
||||||
@ -496,7 +496,7 @@ bool DenseBase<Derived>::isZero(const RealScalar& prec) const
|
|||||||
* \sa class CwiseNullaryOp, Zero()
|
* \sa class CwiseNullaryOp, Zero()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setZero()
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setZero()
|
||||||
{
|
{
|
||||||
return setConstant(Scalar(0));
|
return setConstant(Scalar(0));
|
||||||
}
|
}
|
||||||
@ -511,7 +511,7 @@ EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setZero()
|
|||||||
* \sa DenseBase::setZero(), setZero(Index,Index), class CwiseNullaryOp, DenseBase::Zero()
|
* \sa DenseBase::setZero(), setZero(Index,Index), class CwiseNullaryOp, DenseBase::Zero()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE Derived&
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
|
||||||
PlainObjectBase<Derived>::setZero(Index newSize)
|
PlainObjectBase<Derived>::setZero(Index newSize)
|
||||||
{
|
{
|
||||||
resize(newSize);
|
resize(newSize);
|
||||||
@ -529,7 +529,7 @@ PlainObjectBase<Derived>::setZero(Index newSize)
|
|||||||
* \sa DenseBase::setZero(), setZero(Index), class CwiseNullaryOp, DenseBase::Zero()
|
* \sa DenseBase::setZero(), setZero(Index), class CwiseNullaryOp, DenseBase::Zero()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE Derived&
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
|
||||||
PlainObjectBase<Derived>::setZero(Index rows, Index cols)
|
PlainObjectBase<Derived>::setZero(Index rows, Index cols)
|
||||||
{
|
{
|
||||||
resize(rows, cols);
|
resize(rows, cols);
|
||||||
@ -553,7 +553,7 @@ PlainObjectBase<Derived>::setZero(Index rows, Index cols)
|
|||||||
* \sa Ones(), Ones(Index), isOnes(), class Ones
|
* \sa Ones(), Ones(Index), isOnes(), class Ones
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
|
||||||
DenseBase<Derived>::Ones(Index rows, Index cols)
|
DenseBase<Derived>::Ones(Index rows, Index cols)
|
||||||
{
|
{
|
||||||
return Constant(rows, cols, Scalar(1));
|
return Constant(rows, cols, Scalar(1));
|
||||||
@ -576,7 +576,7 @@ DenseBase<Derived>::Ones(Index rows, Index cols)
|
|||||||
* \sa Ones(), Ones(Index,Index), isOnes(), class Ones
|
* \sa Ones(), Ones(Index,Index), isOnes(), class Ones
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
|
||||||
DenseBase<Derived>::Ones(Index newSize)
|
DenseBase<Derived>::Ones(Index newSize)
|
||||||
{
|
{
|
||||||
return Constant(newSize, Scalar(1));
|
return Constant(newSize, Scalar(1));
|
||||||
@ -593,7 +593,7 @@ DenseBase<Derived>::Ones(Index newSize)
|
|||||||
* \sa Ones(Index), Ones(Index,Index), isOnes(), class Ones
|
* \sa Ones(Index), Ones(Index,Index), isOnes(), class Ones
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
|
||||||
DenseBase<Derived>::Ones()
|
DenseBase<Derived>::Ones()
|
||||||
{
|
{
|
||||||
return Constant(Scalar(1));
|
return Constant(Scalar(1));
|
||||||
@ -608,7 +608,7 @@ DenseBase<Derived>::Ones()
|
|||||||
* \sa class CwiseNullaryOp, Ones()
|
* \sa class CwiseNullaryOp, Ones()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
bool DenseBase<Derived>::isOnes
|
EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isOnes
|
||||||
(const RealScalar& prec) const
|
(const RealScalar& prec) const
|
||||||
{
|
{
|
||||||
return isApproxToConstant(Scalar(1), prec);
|
return isApproxToConstant(Scalar(1), prec);
|
||||||
@ -622,7 +622,7 @@ bool DenseBase<Derived>::isOnes
|
|||||||
* \sa class CwiseNullaryOp, Ones()
|
* \sa class CwiseNullaryOp, Ones()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setOnes()
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setOnes()
|
||||||
{
|
{
|
||||||
return setConstant(Scalar(1));
|
return setConstant(Scalar(1));
|
||||||
}
|
}
|
||||||
@ -637,7 +637,7 @@ EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setOnes()
|
|||||||
* \sa MatrixBase::setOnes(), setOnes(Index,Index), class CwiseNullaryOp, MatrixBase::Ones()
|
* \sa MatrixBase::setOnes(), setOnes(Index,Index), class CwiseNullaryOp, MatrixBase::Ones()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE Derived&
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
|
||||||
PlainObjectBase<Derived>::setOnes(Index newSize)
|
PlainObjectBase<Derived>::setOnes(Index newSize)
|
||||||
{
|
{
|
||||||
resize(newSize);
|
resize(newSize);
|
||||||
@ -655,7 +655,7 @@ PlainObjectBase<Derived>::setOnes(Index newSize)
|
|||||||
* \sa MatrixBase::setOnes(), setOnes(Index), class CwiseNullaryOp, MatrixBase::Ones()
|
* \sa MatrixBase::setOnes(), setOnes(Index), class CwiseNullaryOp, MatrixBase::Ones()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE Derived&
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
|
||||||
PlainObjectBase<Derived>::setOnes(Index rows, Index cols)
|
PlainObjectBase<Derived>::setOnes(Index rows, Index cols)
|
||||||
{
|
{
|
||||||
resize(rows, cols);
|
resize(rows, cols);
|
||||||
@ -679,7 +679,7 @@ PlainObjectBase<Derived>::setOnes(Index rows, Index cols)
|
|||||||
* \sa Identity(), setIdentity(), isIdentity()
|
* \sa Identity(), setIdentity(), isIdentity()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::IdentityReturnType
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::IdentityReturnType
|
||||||
MatrixBase<Derived>::Identity(Index rows, Index cols)
|
MatrixBase<Derived>::Identity(Index rows, Index cols)
|
||||||
{
|
{
|
||||||
return DenseBase<Derived>::NullaryExpr(rows, cols, internal::scalar_identity_op<Scalar>());
|
return DenseBase<Derived>::NullaryExpr(rows, cols, internal::scalar_identity_op<Scalar>());
|
||||||
@ -696,7 +696,7 @@ MatrixBase<Derived>::Identity(Index rows, Index cols)
|
|||||||
* \sa Identity(Index,Index), setIdentity(), isIdentity()
|
* \sa Identity(Index,Index), setIdentity(), isIdentity()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::IdentityReturnType
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::IdentityReturnType
|
||||||
MatrixBase<Derived>::Identity()
|
MatrixBase<Derived>::Identity()
|
||||||
{
|
{
|
||||||
EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
|
EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
|
||||||
@ -771,7 +771,7 @@ struct setIdentity_impl<Derived, true>
|
|||||||
* \sa class CwiseNullaryOp, Identity(), Identity(Index,Index), isIdentity()
|
* \sa class CwiseNullaryOp, Identity(), Identity(Index,Index), isIdentity()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setIdentity()
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setIdentity()
|
||||||
{
|
{
|
||||||
return internal::setIdentity_impl<Derived>::run(derived());
|
return internal::setIdentity_impl<Derived>::run(derived());
|
||||||
}
|
}
|
||||||
@ -787,7 +787,7 @@ EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setIdentity()
|
|||||||
* \sa MatrixBase::setIdentity(), class CwiseNullaryOp, MatrixBase::Identity()
|
* \sa MatrixBase::setIdentity(), class CwiseNullaryOp, MatrixBase::Identity()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setIdentity(Index rows, Index cols)
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setIdentity(Index rows, Index cols)
|
||||||
{
|
{
|
||||||
derived().resize(rows, cols);
|
derived().resize(rows, cols);
|
||||||
return setIdentity();
|
return setIdentity();
|
||||||
@ -800,7 +800,7 @@ EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setIdentity(Index rows, Index
|
|||||||
* \sa MatrixBase::Unit(Index), MatrixBase::UnitX(), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
|
* \sa MatrixBase::Unit(Index), MatrixBase::UnitX(), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::Unit(Index newSize, Index i)
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::Unit(Index newSize, Index i)
|
||||||
{
|
{
|
||||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
||||||
return BasisReturnType(SquareMatrixType::Identity(newSize,newSize), i);
|
return BasisReturnType(SquareMatrixType::Identity(newSize,newSize), i);
|
||||||
@ -815,7 +815,7 @@ EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBa
|
|||||||
* \sa MatrixBase::Unit(Index,Index), MatrixBase::UnitX(), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
|
* \sa MatrixBase::Unit(Index,Index), MatrixBase::UnitX(), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::Unit(Index i)
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::Unit(Index i)
|
||||||
{
|
{
|
||||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
||||||
return BasisReturnType(SquareMatrixType::Identity(),i);
|
return BasisReturnType(SquareMatrixType::Identity(),i);
|
||||||
@ -828,7 +828,7 @@ EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBa
|
|||||||
* \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
|
* \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitX()
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitX()
|
||||||
{ return Derived::Unit(0); }
|
{ return Derived::Unit(0); }
|
||||||
|
|
||||||
/** \returns an expression of the Y axis unit vector (0,1{,0}^*)
|
/** \returns an expression of the Y axis unit vector (0,1{,0}^*)
|
||||||
@ -838,7 +838,7 @@ EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBa
|
|||||||
* \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
|
* \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitY()
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitY()
|
||||||
{ return Derived::Unit(1); }
|
{ return Derived::Unit(1); }
|
||||||
|
|
||||||
/** \returns an expression of the Z axis unit vector (0,0,1{,0}^*)
|
/** \returns an expression of the Z axis unit vector (0,0,1{,0}^*)
|
||||||
@ -848,7 +848,7 @@ EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBa
|
|||||||
* \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
|
* \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitZ()
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitZ()
|
||||||
{ return Derived::Unit(2); }
|
{ return Derived::Unit(2); }
|
||||||
|
|
||||||
/** \returns an expression of the W axis unit vector (0,0,0,1)
|
/** \returns an expression of the W axis unit vector (0,0,0,1)
|
||||||
@ -858,7 +858,7 @@ EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBa
|
|||||||
* \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
|
* \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitW()
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitW()
|
||||||
{ return Derived::Unit(3); }
|
{ return Derived::Unit(3); }
|
||||||
|
|
||||||
} // end namespace Eigen
|
} // end namespace Eigen
|
||||||
|
@ -296,7 +296,7 @@ template<typename Derived> class DenseBase
|
|||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
Derived& operator=(const ReturnByValue<OtherDerived>& func);
|
Derived& operator=(const ReturnByValue<OtherDerived>& func);
|
||||||
|
|
||||||
/** \ínternal
|
/** \internal
|
||||||
* Copies \a other into *this without evaluating other. \returns a reference to *this.
|
* Copies \a other into *this without evaluating other. \returns a reference to *this.
|
||||||
* \deprecated */
|
* \deprecated */
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
@ -484,9 +484,9 @@ template<typename Derived> class DenseBase
|
|||||||
return derived().coeff(0,0);
|
return derived().coeff(0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool all() const;
|
EIGEN_DEVICE_FUNC bool all() const;
|
||||||
bool any() const;
|
EIGEN_DEVICE_FUNC bool any() const;
|
||||||
Index count() const;
|
EIGEN_DEVICE_FUNC Index count() const;
|
||||||
|
|
||||||
typedef VectorwiseOp<Derived, Horizontal> RowwiseReturnType;
|
typedef VectorwiseOp<Derived, Horizontal> RowwiseReturnType;
|
||||||
typedef const VectorwiseOp<const Derived, Horizontal> ConstRowwiseReturnType;
|
typedef const VectorwiseOp<const Derived, Horizontal> ConstRowwiseReturnType;
|
||||||
|
@ -184,7 +184,7 @@ template<typename MatrixType, int _DiagIndex> class Diagonal
|
|||||||
*
|
*
|
||||||
* \sa class Diagonal */
|
* \sa class Diagonal */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline typename MatrixBase<Derived>::DiagonalReturnType
|
EIGEN_DEVICE_FUNC inline typename MatrixBase<Derived>::DiagonalReturnType
|
||||||
MatrixBase<Derived>::diagonal()
|
MatrixBase<Derived>::diagonal()
|
||||||
{
|
{
|
||||||
return DiagonalReturnType(derived());
|
return DiagonalReturnType(derived());
|
||||||
@ -192,7 +192,7 @@ MatrixBase<Derived>::diagonal()
|
|||||||
|
|
||||||
/** This is the const version of diagonal(). */
|
/** This is the const version of diagonal(). */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline typename MatrixBase<Derived>::ConstDiagonalReturnType
|
EIGEN_DEVICE_FUNC inline typename MatrixBase<Derived>::ConstDiagonalReturnType
|
||||||
MatrixBase<Derived>::diagonal() const
|
MatrixBase<Derived>::diagonal() const
|
||||||
{
|
{
|
||||||
return ConstDiagonalReturnType(derived());
|
return ConstDiagonalReturnType(derived());
|
||||||
@ -210,7 +210,7 @@ MatrixBase<Derived>::diagonal() const
|
|||||||
*
|
*
|
||||||
* \sa MatrixBase::diagonal(), class Diagonal */
|
* \sa MatrixBase::diagonal(), class Diagonal */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline typename MatrixBase<Derived>::DiagonalDynamicIndexReturnType
|
EIGEN_DEVICE_FUNC inline typename MatrixBase<Derived>::DiagonalDynamicIndexReturnType
|
||||||
MatrixBase<Derived>::diagonal(Index index)
|
MatrixBase<Derived>::diagonal(Index index)
|
||||||
{
|
{
|
||||||
return DiagonalDynamicIndexReturnType(derived(), index);
|
return DiagonalDynamicIndexReturnType(derived(), index);
|
||||||
@ -218,7 +218,7 @@ MatrixBase<Derived>::diagonal(Index index)
|
|||||||
|
|
||||||
/** This is the const version of diagonal(Index). */
|
/** This is the const version of diagonal(Index). */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline typename MatrixBase<Derived>::ConstDiagonalDynamicIndexReturnType
|
EIGEN_DEVICE_FUNC inline typename MatrixBase<Derived>::ConstDiagonalDynamicIndexReturnType
|
||||||
MatrixBase<Derived>::diagonal(Index index) const
|
MatrixBase<Derived>::diagonal(Index index) const
|
||||||
{
|
{
|
||||||
return ConstDiagonalDynamicIndexReturnType(derived(), index);
|
return ConstDiagonalDynamicIndexReturnType(derived(), index);
|
||||||
@ -237,6 +237,7 @@ MatrixBase<Derived>::diagonal(Index index) const
|
|||||||
* \sa MatrixBase::diagonal(), class Diagonal */
|
* \sa MatrixBase::diagonal(), class Diagonal */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<int Index_>
|
template<int Index_>
|
||||||
|
EIGEN_DEVICE_FUNC
|
||||||
inline typename MatrixBase<Derived>::template DiagonalIndexReturnType<Index_>::Type
|
inline typename MatrixBase<Derived>::template DiagonalIndexReturnType<Index_>::Type
|
||||||
MatrixBase<Derived>::diagonal()
|
MatrixBase<Derived>::diagonal()
|
||||||
{
|
{
|
||||||
@ -246,6 +247,7 @@ MatrixBase<Derived>::diagonal()
|
|||||||
/** This is the const version of diagonal<int>(). */
|
/** This is the const version of diagonal<int>(). */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<int Index_>
|
template<int Index_>
|
||||||
|
EIGEN_DEVICE_FUNC
|
||||||
inline typename MatrixBase<Derived>::template ConstDiagonalIndexReturnType<Index_>::Type
|
inline typename MatrixBase<Derived>::template ConstDiagonalIndexReturnType<Index_>::Type
|
||||||
MatrixBase<Derived>::diagonal() const
|
MatrixBase<Derived>::diagonal() const
|
||||||
{
|
{
|
||||||
|
@ -44,7 +44,7 @@ class DiagonalBase : public EigenBase<Derived>
|
|||||||
|
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
DenseMatrixType toDenseMatrix() const { return derived(); }
|
DenseMatrixType toDenseMatrix() const { return derived(); }
|
||||||
|
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
inline const DiagonalVectorType& diagonal() const { return derived().diagonal(); }
|
inline const DiagonalVectorType& diagonal() const { return derived().diagonal(); }
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
@ -273,7 +273,7 @@ class DiagonalWrapper
|
|||||||
* \sa class DiagonalWrapper, class DiagonalMatrix, diagonal(), isDiagonal()
|
* \sa class DiagonalWrapper, class DiagonalMatrix, diagonal(), isDiagonal()
|
||||||
**/
|
**/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline const DiagonalWrapper<const Derived>
|
EIGEN_DEVICE_FUNC inline const DiagonalWrapper<const Derived>
|
||||||
MatrixBase<Derived>::asDiagonal() const
|
MatrixBase<Derived>::asDiagonal() const
|
||||||
{
|
{
|
||||||
return DiagonalWrapper<const Derived>(derived());
|
return DiagonalWrapper<const Derived>(derived());
|
||||||
|
@ -17,7 +17,7 @@ namespace Eigen {
|
|||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename DiagonalDerived>
|
template<typename DiagonalDerived>
|
||||||
inline const Product<Derived, DiagonalDerived, LazyProduct>
|
EIGEN_DEVICE_FUNC inline const Product<Derived, DiagonalDerived, LazyProduct>
|
||||||
MatrixBase<Derived>::operator*(const DiagonalBase<DiagonalDerived> &a_diagonal) const
|
MatrixBase<Derived>::operator*(const DiagonalBase<DiagonalDerived> &a_diagonal) const
|
||||||
{
|
{
|
||||||
return Product<Derived, DiagonalDerived, LazyProduct>(derived(),a_diagonal.derived());
|
return Product<Derived, DiagonalDerived, LazyProduct>(derived(),a_diagonal.derived());
|
||||||
|
@ -90,7 +90,7 @@ MatrixBase<Derived>::dot(const MatrixBase<OtherDerived>& other) const
|
|||||||
* \sa dot(), norm(), lpNorm()
|
* \sa dot(), norm(), lpNorm()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE typename NumTraits<typename internal::traits<Derived>::Scalar>::Real MatrixBase<Derived>::squaredNorm() const
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename NumTraits<typename internal::traits<Derived>::Scalar>::Real MatrixBase<Derived>::squaredNorm() const
|
||||||
{
|
{
|
||||||
return numext::real((*this).cwiseAbs2().sum());
|
return numext::real((*this).cwiseAbs2().sum());
|
||||||
}
|
}
|
||||||
@ -102,7 +102,7 @@ EIGEN_STRONG_INLINE typename NumTraits<typename internal::traits<Derived>::Scala
|
|||||||
* \sa lpNorm(), dot(), squaredNorm()
|
* \sa lpNorm(), dot(), squaredNorm()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real MatrixBase<Derived>::norm() const
|
EIGEN_DEVICE_FUNC inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real MatrixBase<Derived>::norm() const
|
||||||
{
|
{
|
||||||
return numext::sqrt(squaredNorm());
|
return numext::sqrt(squaredNorm());
|
||||||
}
|
}
|
||||||
@ -117,7 +117,7 @@ inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real Matr
|
|||||||
* \sa norm(), normalize()
|
* \sa norm(), normalize()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline const typename MatrixBase<Derived>::PlainObject
|
EIGEN_DEVICE_FUNC inline const typename MatrixBase<Derived>::PlainObject
|
||||||
MatrixBase<Derived>::normalized() const
|
MatrixBase<Derived>::normalized() const
|
||||||
{
|
{
|
||||||
typedef typename internal::nested_eval<Derived,2>::type _Nested;
|
typedef typename internal::nested_eval<Derived,2>::type _Nested;
|
||||||
@ -139,7 +139,7 @@ MatrixBase<Derived>::normalized() const
|
|||||||
* \sa norm(), normalized()
|
* \sa norm(), normalized()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline void MatrixBase<Derived>::normalize()
|
EIGEN_DEVICE_FUNC inline void MatrixBase<Derived>::normalize()
|
||||||
{
|
{
|
||||||
RealScalar z = squaredNorm();
|
RealScalar z = squaredNorm();
|
||||||
// NOTE: after extensive benchmarking, this conditional does not impact performance, at least on recent x86 CPU
|
// NOTE: after extensive benchmarking, this conditional does not impact performance, at least on recent x86 CPU
|
||||||
@ -160,7 +160,7 @@ inline void MatrixBase<Derived>::normalize()
|
|||||||
* \sa stableNorm(), stableNormalize(), normalized()
|
* \sa stableNorm(), stableNormalize(), normalized()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline const typename MatrixBase<Derived>::PlainObject
|
EIGEN_DEVICE_FUNC inline const typename MatrixBase<Derived>::PlainObject
|
||||||
MatrixBase<Derived>::stableNormalized() const
|
MatrixBase<Derived>::stableNormalized() const
|
||||||
{
|
{
|
||||||
typedef typename internal::nested_eval<Derived,3>::type _Nested;
|
typedef typename internal::nested_eval<Derived,3>::type _Nested;
|
||||||
@ -185,7 +185,7 @@ MatrixBase<Derived>::stableNormalized() const
|
|||||||
* \sa stableNorm(), stableNormalized(), normalize()
|
* \sa stableNorm(), stableNormalized(), normalize()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline void MatrixBase<Derived>::stableNormalize()
|
EIGEN_DEVICE_FUNC inline void MatrixBase<Derived>::stableNormalize()
|
||||||
{
|
{
|
||||||
RealScalar w = cwiseAbs().maxCoeff();
|
RealScalar w = cwiseAbs().maxCoeff();
|
||||||
RealScalar z = (derived()/w).squaredNorm();
|
RealScalar z = (derived()/w).squaredNorm();
|
||||||
@ -257,9 +257,9 @@ struct lpNorm_selector<Derived, Infinity>
|
|||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<int p>
|
template<int p>
|
||||||
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||||
inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real
|
EIGEN_DEVICE_FUNC inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real
|
||||||
#else
|
#else
|
||||||
MatrixBase<Derived>::RealScalar
|
EIGEN_DEVICE_FUNC MatrixBase<Derived>::RealScalar
|
||||||
#endif
|
#endif
|
||||||
MatrixBase<Derived>::lpNorm() const
|
MatrixBase<Derived>::lpNorm() const
|
||||||
{
|
{
|
||||||
|
@ -128,6 +128,7 @@ template<typename Derived> struct EigenBase
|
|||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
|
EIGEN_DEVICE_FUNC
|
||||||
Derived& DenseBase<Derived>::operator=(const EigenBase<OtherDerived> &other)
|
Derived& DenseBase<Derived>::operator=(const EigenBase<OtherDerived> &other)
|
||||||
{
|
{
|
||||||
call_assignment(derived(), other.derived());
|
call_assignment(derived(), other.derived());
|
||||||
@ -136,6 +137,7 @@ Derived& DenseBase<Derived>::operator=(const EigenBase<OtherDerived> &other)
|
|||||||
|
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
|
EIGEN_DEVICE_FUNC
|
||||||
Derived& DenseBase<Derived>::operator+=(const EigenBase<OtherDerived> &other)
|
Derived& DenseBase<Derived>::operator+=(const EigenBase<OtherDerived> &other)
|
||||||
{
|
{
|
||||||
call_assignment(derived(), other.derived(), internal::add_assign_op<Scalar,typename OtherDerived::Scalar>());
|
call_assignment(derived(), other.derived(), internal::add_assign_op<Scalar,typename OtherDerived::Scalar>());
|
||||||
@ -144,6 +146,7 @@ Derived& DenseBase<Derived>::operator+=(const EigenBase<OtherDerived> &other)
|
|||||||
|
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
|
EIGEN_DEVICE_FUNC
|
||||||
Derived& DenseBase<Derived>::operator-=(const EigenBase<OtherDerived> &other)
|
Derived& DenseBase<Derived>::operator-=(const EigenBase<OtherDerived> &other)
|
||||||
{
|
{
|
||||||
call_assignment(derived(), other.derived(), internal::sub_assign_op<Scalar,typename OtherDerived::Scalar>());
|
call_assignment(derived(), other.derived(), internal::sub_assign_op<Scalar,typename OtherDerived::Scalar>());
|
||||||
|
@ -100,7 +100,7 @@ struct isMuchSmallerThan_scalar_selector<Derived, true>
|
|||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
bool DenseBase<Derived>::isApprox(
|
EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isApprox(
|
||||||
const DenseBase<OtherDerived>& other,
|
const DenseBase<OtherDerived>& other,
|
||||||
const RealScalar& prec
|
const RealScalar& prec
|
||||||
) const
|
) const
|
||||||
@ -122,7 +122,7 @@ bool DenseBase<Derived>::isApprox(
|
|||||||
* \sa isApprox(), isMuchSmallerThan(const DenseBase<OtherDerived>&, RealScalar) const
|
* \sa isApprox(), isMuchSmallerThan(const DenseBase<OtherDerived>&, RealScalar) const
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
bool DenseBase<Derived>::isMuchSmallerThan(
|
EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isMuchSmallerThan(
|
||||||
const typename NumTraits<Scalar>::Real& other,
|
const typename NumTraits<Scalar>::Real& other,
|
||||||
const RealScalar& prec
|
const RealScalar& prec
|
||||||
) const
|
) const
|
||||||
@ -142,7 +142,7 @@ bool DenseBase<Derived>::isMuchSmallerThan(
|
|||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
bool DenseBase<Derived>::isMuchSmallerThan(
|
EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isMuchSmallerThan(
|
||||||
const DenseBase<OtherDerived>& other,
|
const DenseBase<OtherDerived>& other,
|
||||||
const RealScalar& prec
|
const RealScalar& prec
|
||||||
) const
|
) const
|
||||||
|
@ -428,7 +428,7 @@ MatrixBase<Derived>::operator*(const MatrixBase<OtherDerived> &other) const
|
|||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
const Product<Derived,OtherDerived,LazyProduct>
|
const Product<Derived,OtherDerived,LazyProduct>
|
||||||
MatrixBase<Derived>::lazyProduct(const MatrixBase<OtherDerived> &other) const
|
EIGEN_DEVICE_FUNC MatrixBase<Derived>::lazyProduct(const MatrixBase<OtherDerived> &other) const
|
||||||
{
|
{
|
||||||
enum {
|
enum {
|
||||||
ProductIsValid = Derived::ColsAtCompileTime==Dynamic
|
ProductIsValid = Derived::ColsAtCompileTime==Dynamic
|
||||||
|
@ -231,7 +231,7 @@ pload1(const typename unpacket_traits<Packet>::type *a) { return pset1<Packet>(
|
|||||||
* duplicated to form: {from[0],from[0],from[1],from[1],from[2],from[2],from[3],from[3]}
|
* duplicated to form: {from[0],from[0],from[1],from[1],from[2],from[2],from[3],from[3]}
|
||||||
* Currently, this function is only used for scalar * complex products.
|
* Currently, this function is only used for scalar * complex products.
|
||||||
*/
|
*/
|
||||||
template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
|
template<typename Packet> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet
|
||||||
ploaddup(const typename unpacket_traits<Packet>::type* from) { return *from; }
|
ploaddup(const typename unpacket_traits<Packet>::type* from) { return *from; }
|
||||||
|
|
||||||
/** \internal \returns a packet with elements of \a *from quadrupled.
|
/** \internal \returns a packet with elements of \a *from quadrupled.
|
||||||
@ -279,7 +279,7 @@ inline void pbroadcast2(const typename unpacket_traits<Packet>::type *a,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** \internal \brief Returns a packet with coefficients (a,a+1,...,a+packet_size-1). */
|
/** \internal \brief Returns a packet with coefficients (a,a+1,...,a+packet_size-1). */
|
||||||
template<typename Packet> inline Packet
|
template<typename Packet> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet
|
||||||
plset(const typename unpacket_traits<Packet>::type& a) { return a; }
|
plset(const typename unpacket_traits<Packet>::type& a) { return a; }
|
||||||
|
|
||||||
/** \internal copy the packet \a from to \a *to, \a to must be 16 bytes aligned */
|
/** \internal copy the packet \a from to \a *to, \a to must be 16 bytes aligned */
|
||||||
@ -487,7 +487,7 @@ EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void pstoret(Scalar* to, const Packet& fro
|
|||||||
* by the current computation.
|
* by the current computation.
|
||||||
*/
|
*/
|
||||||
template<typename Packet, int LoadMode>
|
template<typename Packet, int LoadMode>
|
||||||
inline Packet ploadt_ro(const typename unpacket_traits<Packet>::type* from)
|
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet ploadt_ro(const typename unpacket_traits<Packet>::type* from)
|
||||||
{
|
{
|
||||||
return ploadt<Packet, LoadMode>(from);
|
return ploadt<Packet, LoadMode>(from);
|
||||||
}
|
}
|
||||||
|
@ -512,7 +512,7 @@ namespace std_fallback {
|
|||||||
|
|
||||||
template<typename Scalar>
|
template<typename Scalar>
|
||||||
struct expm1_impl {
|
struct expm1_impl {
|
||||||
static inline Scalar run(const Scalar& x)
|
EIGEN_DEVICE_FUNC static inline Scalar run(const Scalar& x)
|
||||||
{
|
{
|
||||||
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar)
|
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar)
|
||||||
#if EIGEN_HAS_CXX11_MATH
|
#if EIGEN_HAS_CXX11_MATH
|
||||||
@ -549,7 +549,7 @@ namespace std_fallback {
|
|||||||
|
|
||||||
template<typename Scalar>
|
template<typename Scalar>
|
||||||
struct log1p_impl {
|
struct log1p_impl {
|
||||||
static inline Scalar run(const Scalar& x)
|
EIGEN_DEVICE_FUNC static inline Scalar run(const Scalar& x)
|
||||||
{
|
{
|
||||||
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar)
|
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar)
|
||||||
#if EIGEN_HAS_CXX11_MATH
|
#if EIGEN_HAS_CXX11_MATH
|
||||||
|
@ -294,7 +294,7 @@ template<typename Derived> class MatrixBase
|
|||||||
* fuzzy comparison such as isApprox()
|
* fuzzy comparison such as isApprox()
|
||||||
* \sa isApprox(), operator!= */
|
* \sa isApprox(), operator!= */
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
inline bool operator==(const MatrixBase<OtherDerived>& other) const
|
EIGEN_DEVICE_FUNC inline bool operator==(const MatrixBase<OtherDerived>& other) const
|
||||||
{ return cwiseEqual(other).all(); }
|
{ return cwiseEqual(other).all(); }
|
||||||
|
|
||||||
/** \returns true if at least one pair of coefficients of \c *this and \a other are not exactly equal to each other.
|
/** \returns true if at least one pair of coefficients of \c *this and \a other are not exactly equal to each other.
|
||||||
@ -302,7 +302,7 @@ template<typename Derived> class MatrixBase
|
|||||||
* fuzzy comparison such as isApprox()
|
* fuzzy comparison such as isApprox()
|
||||||
* \sa isApprox(), operator== */
|
* \sa isApprox(), operator== */
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
inline bool operator!=(const MatrixBase<OtherDerived>& other) const
|
EIGEN_DEVICE_FUNC inline bool operator!=(const MatrixBase<OtherDerived>& other) const
|
||||||
{ return cwiseNotEqual(other).any(); }
|
{ return cwiseNotEqual(other).any(); }
|
||||||
|
|
||||||
NoAlias<Derived,Eigen::MatrixBase > noalias();
|
NoAlias<Derived,Eigen::MatrixBase > noalias();
|
||||||
|
@ -67,25 +67,25 @@ template<typename ExpressionType> class NestByValue
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<int LoadMode>
|
template<int LoadMode>
|
||||||
inline const PacketScalar packet(Index row, Index col) const
|
EIGEN_DEVICE_FUNC inline const PacketScalar packet(Index row, Index col) const
|
||||||
{
|
{
|
||||||
return m_expression.template packet<LoadMode>(row, col);
|
return m_expression.template packet<LoadMode>(row, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int LoadMode>
|
template<int LoadMode>
|
||||||
inline void writePacket(Index row, Index col, const PacketScalar& x)
|
EIGEN_DEVICE_FUNC inline void writePacket(Index row, Index col, const PacketScalar& x)
|
||||||
{
|
{
|
||||||
m_expression.const_cast_derived().template writePacket<LoadMode>(row, col, x);
|
m_expression.const_cast_derived().template writePacket<LoadMode>(row, col, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int LoadMode>
|
template<int LoadMode>
|
||||||
inline const PacketScalar packet(Index index) const
|
EIGEN_DEVICE_FUNC inline const PacketScalar packet(Index index) const
|
||||||
{
|
{
|
||||||
return m_expression.template packet<LoadMode>(index);
|
return m_expression.template packet<LoadMode>(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int LoadMode>
|
template<int LoadMode>
|
||||||
inline void writePacket(Index index, const PacketScalar& x)
|
EIGEN_DEVICE_FUNC inline void writePacket(Index index, const PacketScalar& x)
|
||||||
{
|
{
|
||||||
m_expression.const_cast_derived().template writePacket<LoadMode>(index, x);
|
m_expression.const_cast_derived().template writePacket<LoadMode>(index, x);
|
||||||
}
|
}
|
||||||
@ -99,7 +99,7 @@ template<typename ExpressionType> class NestByValue
|
|||||||
/** \returns an expression of the temporary version of *this.
|
/** \returns an expression of the temporary version of *this.
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline const NestByValue<Derived>
|
EIGEN_DEVICE_FUNC inline const NestByValue<Derived>
|
||||||
DenseBase<Derived>::nestByValue() const
|
DenseBase<Derived>::nestByValue() const
|
||||||
{
|
{
|
||||||
return NestByValue<Derived>(derived());
|
return NestByValue<Derived>(derived());
|
||||||
|
@ -128,7 +128,7 @@ DenseBase<Derived>::Random()
|
|||||||
* \sa class CwiseNullaryOp, setRandom(Index), setRandom(Index,Index)
|
* \sa class CwiseNullaryOp, setRandom(Index), setRandom(Index,Index)
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline Derived& DenseBase<Derived>::setRandom()
|
EIGEN_DEVICE_FUNC inline Derived& DenseBase<Derived>::setRandom()
|
||||||
{
|
{
|
||||||
return *this = Random(rows(), cols());
|
return *this = Random(rows(), cols());
|
||||||
}
|
}
|
||||||
|
@ -407,7 +407,7 @@ protected:
|
|||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename Func>
|
template<typename Func>
|
||||||
typename internal::traits<Derived>::Scalar
|
EIGEN_DEVICE_FUNC typename internal::traits<Derived>::Scalar
|
||||||
DenseBase<Derived>::redux(const Func& func) const
|
DenseBase<Derived>::redux(const Func& func) const
|
||||||
{
|
{
|
||||||
eigen_assert(this->rows()>0 && this->cols()>0 && "you are using an empty matrix");
|
eigen_assert(this->rows()>0 && this->cols()>0 && "you are using an empty matrix");
|
||||||
@ -422,7 +422,7 @@ DenseBase<Derived>::redux(const Func& func) const
|
|||||||
* \warning the result is undefined if \c *this contains NaN.
|
* \warning the result is undefined if \c *this contains NaN.
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar
|
||||||
DenseBase<Derived>::minCoeff() const
|
DenseBase<Derived>::minCoeff() const
|
||||||
{
|
{
|
||||||
return derived().redux(Eigen::internal::scalar_min_op<Scalar,Scalar>());
|
return derived().redux(Eigen::internal::scalar_min_op<Scalar,Scalar>());
|
||||||
@ -432,7 +432,7 @@ DenseBase<Derived>::minCoeff() const
|
|||||||
* \warning the result is undefined if \c *this contains NaN.
|
* \warning the result is undefined if \c *this contains NaN.
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar
|
||||||
DenseBase<Derived>::maxCoeff() const
|
DenseBase<Derived>::maxCoeff() const
|
||||||
{
|
{
|
||||||
return derived().redux(Eigen::internal::scalar_max_op<Scalar,Scalar>());
|
return derived().redux(Eigen::internal::scalar_max_op<Scalar,Scalar>());
|
||||||
@ -445,7 +445,7 @@ DenseBase<Derived>::maxCoeff() const
|
|||||||
* \sa trace(), prod(), mean()
|
* \sa trace(), prod(), mean()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar
|
||||||
DenseBase<Derived>::sum() const
|
DenseBase<Derived>::sum() const
|
||||||
{
|
{
|
||||||
if(SizeAtCompileTime==0 || (SizeAtCompileTime==Dynamic && size()==0))
|
if(SizeAtCompileTime==0 || (SizeAtCompileTime==Dynamic && size()==0))
|
||||||
@ -458,7 +458,7 @@ DenseBase<Derived>::sum() const
|
|||||||
* \sa trace(), prod(), sum()
|
* \sa trace(), prod(), sum()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar
|
||||||
DenseBase<Derived>::mean() const
|
DenseBase<Derived>::mean() const
|
||||||
{
|
{
|
||||||
#ifdef __INTEL_COMPILER
|
#ifdef __INTEL_COMPILER
|
||||||
@ -479,7 +479,7 @@ DenseBase<Derived>::mean() const
|
|||||||
* \sa sum(), mean(), trace()
|
* \sa sum(), mean(), trace()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar
|
||||||
DenseBase<Derived>::prod() const
|
DenseBase<Derived>::prod() const
|
||||||
{
|
{
|
||||||
if(SizeAtCompileTime==0 || (SizeAtCompileTime==Dynamic && size()==0))
|
if(SizeAtCompileTime==0 || (SizeAtCompileTime==Dynamic && size()==0))
|
||||||
@ -494,7 +494,7 @@ DenseBase<Derived>::prod() const
|
|||||||
* \sa diagonal(), sum()
|
* \sa diagonal(), sum()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar
|
||||||
MatrixBase<Derived>::trace() const
|
MatrixBase<Derived>::trace() const
|
||||||
{
|
{
|
||||||
return derived().diagonal().sum();
|
return derived().diagonal().sum();
|
||||||
|
@ -115,7 +115,7 @@ template<typename MatrixType,int RowFactor,int ColFactor> class Replicate
|
|||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<int RowFactor, int ColFactor>
|
template<int RowFactor, int ColFactor>
|
||||||
const Replicate<Derived,RowFactor,ColFactor>
|
EIGEN_DEVICE_FUNC const Replicate<Derived,RowFactor,ColFactor>
|
||||||
DenseBase<Derived>::replicate() const
|
DenseBase<Derived>::replicate() const
|
||||||
{
|
{
|
||||||
return Replicate<Derived,RowFactor,ColFactor>(derived());
|
return Replicate<Derived,RowFactor,ColFactor>(derived());
|
||||||
@ -130,7 +130,7 @@ DenseBase<Derived>::replicate() const
|
|||||||
* \sa VectorwiseOp::replicate(), DenseBase::replicate(), class Replicate
|
* \sa VectorwiseOp::replicate(), DenseBase::replicate(), class Replicate
|
||||||
*/
|
*/
|
||||||
template<typename ExpressionType, int Direction>
|
template<typename ExpressionType, int Direction>
|
||||||
const typename VectorwiseOp<ExpressionType,Direction>::ReplicateReturnType
|
EIGEN_DEVICE_FUNC const typename VectorwiseOp<ExpressionType,Direction>::ReplicateReturnType
|
||||||
VectorwiseOp<ExpressionType,Direction>::replicate(Index factor) const
|
VectorwiseOp<ExpressionType,Direction>::replicate(Index factor) const
|
||||||
{
|
{
|
||||||
return typename VectorwiseOp<ExpressionType,Direction>::ReplicateReturnType
|
return typename VectorwiseOp<ExpressionType,Direction>::ReplicateReturnType
|
||||||
|
@ -79,7 +79,7 @@ template<typename Derived> class ReturnByValue
|
|||||||
|
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
Derived& DenseBase<Derived>::operator=(const ReturnByValue<OtherDerived>& other)
|
EIGEN_DEVICE_FUNC Derived& DenseBase<Derived>::operator=(const ReturnByValue<OtherDerived>& other)
|
||||||
{
|
{
|
||||||
other.evalTo(derived());
|
other.evalTo(derived());
|
||||||
return derived();
|
return derived();
|
||||||
|
@ -114,7 +114,7 @@ template<typename MatrixType, int Direction> class Reverse
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline typename DenseBase<Derived>::ReverseReturnType
|
EIGEN_DEVICE_FUNC inline typename DenseBase<Derived>::ReverseReturnType
|
||||||
DenseBase<Derived>::reverse()
|
DenseBase<Derived>::reverse()
|
||||||
{
|
{
|
||||||
return ReverseReturnType(derived());
|
return ReverseReturnType(derived());
|
||||||
@ -136,7 +136,7 @@ DenseBase<Derived>::reverse()
|
|||||||
*
|
*
|
||||||
* \sa VectorwiseOp::reverseInPlace(), reverse() */
|
* \sa VectorwiseOp::reverseInPlace(), reverse() */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline void DenseBase<Derived>::reverseInPlace()
|
EIGEN_DEVICE_FUNC inline void DenseBase<Derived>::reverseInPlace()
|
||||||
{
|
{
|
||||||
if(cols()>rows())
|
if(cols()>rows())
|
||||||
{
|
{
|
||||||
@ -201,7 +201,7 @@ struct vectorwise_reverse_inplace_impl<Horizontal>
|
|||||||
*
|
*
|
||||||
* \sa DenseBase::reverseInPlace(), reverse() */
|
* \sa DenseBase::reverseInPlace(), reverse() */
|
||||||
template<typename ExpressionType, int Direction>
|
template<typename ExpressionType, int Direction>
|
||||||
void VectorwiseOp<ExpressionType,Direction>::reverseInPlace()
|
EIGEN_DEVICE_FUNC void VectorwiseOp<ExpressionType,Direction>::reverseInPlace()
|
||||||
{
|
{
|
||||||
internal::vectorwise_reverse_inplace_impl<Direction>::run(_expression().const_cast_derived());
|
internal::vectorwise_reverse_inplace_impl<Direction>::run(_expression().const_cast_derived());
|
||||||
}
|
}
|
||||||
|
@ -322,7 +322,7 @@ public:
|
|||||||
/** This is the const version of MatrixBase::selfadjointView() */
|
/** This is the const version of MatrixBase::selfadjointView() */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<unsigned int UpLo>
|
template<unsigned int UpLo>
|
||||||
typename MatrixBase<Derived>::template ConstSelfAdjointViewReturnType<UpLo>::Type
|
EIGEN_DEVICE_FUNC typename MatrixBase<Derived>::template ConstSelfAdjointViewReturnType<UpLo>::Type
|
||||||
MatrixBase<Derived>::selfadjointView() const
|
MatrixBase<Derived>::selfadjointView() const
|
||||||
{
|
{
|
||||||
return typename ConstSelfAdjointViewReturnType<UpLo>::Type(derived());
|
return typename ConstSelfAdjointViewReturnType<UpLo>::Type(derived());
|
||||||
@ -339,7 +339,7 @@ MatrixBase<Derived>::selfadjointView() const
|
|||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<unsigned int UpLo>
|
template<unsigned int UpLo>
|
||||||
typename MatrixBase<Derived>::template SelfAdjointViewReturnType<UpLo>::Type
|
EIGEN_DEVICE_FUNC typename MatrixBase<Derived>::template SelfAdjointViewReturnType<UpLo>::Type
|
||||||
MatrixBase<Derived>::selfadjointView()
|
MatrixBase<Derived>::selfadjointView()
|
||||||
{
|
{
|
||||||
return typename SelfAdjointViewReturnType<UpLo>::Type(derived());
|
return typename SelfAdjointViewReturnType<UpLo>::Type(derived());
|
||||||
|
@ -15,7 +15,7 @@ namespace Eigen {
|
|||||||
// TODO generalize the scalar type of 'other'
|
// TODO generalize the scalar type of 'other'
|
||||||
|
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator*=(const Scalar& other)
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator*=(const Scalar& other)
|
||||||
{
|
{
|
||||||
typedef typename Derived::PlainObject PlainObject;
|
typedef typename Derived::PlainObject PlainObject;
|
||||||
internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::mul_assign_op<Scalar,Scalar>());
|
internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::mul_assign_op<Scalar,Scalar>());
|
||||||
@ -23,7 +23,7 @@ EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator*=(const Scalar& other)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE Derived& ArrayBase<Derived>::operator+=(const Scalar& other)
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& ArrayBase<Derived>::operator+=(const Scalar& other)
|
||||||
{
|
{
|
||||||
typedef typename Derived::PlainObject PlainObject;
|
typedef typename Derived::PlainObject PlainObject;
|
||||||
internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::add_assign_op<Scalar,Scalar>());
|
internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::add_assign_op<Scalar,Scalar>());
|
||||||
@ -31,7 +31,7 @@ EIGEN_STRONG_INLINE Derived& ArrayBase<Derived>::operator+=(const Scalar& other)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE Derived& ArrayBase<Derived>::operator-=(const Scalar& other)
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& ArrayBase<Derived>::operator-=(const Scalar& other)
|
||||||
{
|
{
|
||||||
typedef typename Derived::PlainObject PlainObject;
|
typedef typename Derived::PlainObject PlainObject;
|
||||||
internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::sub_assign_op<Scalar,Scalar>());
|
internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::sub_assign_op<Scalar,Scalar>());
|
||||||
@ -39,7 +39,7 @@ EIGEN_STRONG_INLINE Derived& ArrayBase<Derived>::operator-=(const Scalar& other)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator/=(const Scalar& other)
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator/=(const Scalar& other)
|
||||||
{
|
{
|
||||||
typedef typename Derived::PlainObject PlainObject;
|
typedef typename Derived::PlainObject PlainObject;
|
||||||
internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::div_assign_op<Scalar,Scalar>());
|
internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::div_assign_op<Scalar,Scalar>());
|
||||||
|
@ -164,7 +164,7 @@ struct triangular_solver_selector<Lhs,Rhs,OnTheRight,Mode,CompleteUnrolling,1> {
|
|||||||
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||||
template<typename MatrixType, unsigned int Mode>
|
template<typename MatrixType, unsigned int Mode>
|
||||||
template<int Side, typename OtherDerived>
|
template<int Side, typename OtherDerived>
|
||||||
void TriangularViewImpl<MatrixType,Mode,Dense>::solveInPlace(const MatrixBase<OtherDerived>& _other) const
|
EIGEN_DEVICE_FUNC void TriangularViewImpl<MatrixType,Mode,Dense>::solveInPlace(const MatrixBase<OtherDerived>& _other) const
|
||||||
{
|
{
|
||||||
OtherDerived& other = _other.const_cast_derived();
|
OtherDerived& other = _other.const_cast_derived();
|
||||||
eigen_assert( derived().cols() == derived().rows() && ((Side==OnTheLeft && derived().cols() == other.rows()) || (Side==OnTheRight && derived().cols() == other.cols())) );
|
eigen_assert( derived().cols() == derived().rows() && ((Side==OnTheLeft && derived().cols() == other.rows()) || (Side==OnTheRight && derived().cols() == other.cols())) );
|
||||||
|
@ -170,7 +170,8 @@ MatrixBase<Derived>::stableNorm() const
|
|||||||
enum {
|
enum {
|
||||||
CanAlign = ( (int(DerivedCopyClean::Flags)&DirectAccessBit)
|
CanAlign = ( (int(DerivedCopyClean::Flags)&DirectAccessBit)
|
||||||
|| (int(internal::evaluator<DerivedCopyClean>::Alignment)>0) // FIXME Alignment)>0 might not be enough
|
|| (int(internal::evaluator<DerivedCopyClean>::Alignment)>0) // FIXME Alignment)>0 might not be enough
|
||||||
) && (blockSize*sizeof(Scalar)*2<EIGEN_STACK_ALLOCATION_LIMIT) // ifwe cannot allocate on the stack, then let's not bother about this optimization
|
) && (blockSize*sizeof(Scalar)*2<EIGEN_STACK_ALLOCATION_LIMIT)
|
||||||
|
&& (EIGEN_MAX_STATIC_ALIGN_BYTES>0) // if we cannot allocate on the stack, then let's not bother about this optimization
|
||||||
};
|
};
|
||||||
typedef typename internal::conditional<CanAlign, Ref<const Matrix<Scalar,Dynamic,1,0,blockSize,1>, internal::evaluator<DerivedCopyClean>::Alignment>,
|
typedef typename internal::conditional<CanAlign, Ref<const Matrix<Scalar,Dynamic,1,0,blockSize,1>, internal::evaluator<DerivedCopyClean>::Alignment>,
|
||||||
typename DerivedCopyClean::ConstSegmentReturnType>::type SegmentWrapper;
|
typename DerivedCopyClean::ConstSegmentReturnType>::type SegmentWrapper;
|
||||||
|
@ -168,7 +168,7 @@ template<typename MatrixType> class TransposeImpl<MatrixType,Dense>
|
|||||||
*
|
*
|
||||||
* \sa transposeInPlace(), adjoint() */
|
* \sa transposeInPlace(), adjoint() */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline Transpose<Derived>
|
EIGEN_DEVICE_FUNC inline Transpose<Derived>
|
||||||
DenseBase<Derived>::transpose()
|
DenseBase<Derived>::transpose()
|
||||||
{
|
{
|
||||||
return TransposeReturnType(derived());
|
return TransposeReturnType(derived());
|
||||||
@ -180,7 +180,7 @@ DenseBase<Derived>::transpose()
|
|||||||
*
|
*
|
||||||
* \sa transposeInPlace(), adjoint() */
|
* \sa transposeInPlace(), adjoint() */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline typename DenseBase<Derived>::ConstTransposeReturnType
|
EIGEN_DEVICE_FUNC inline typename DenseBase<Derived>::ConstTransposeReturnType
|
||||||
DenseBase<Derived>::transpose() const
|
DenseBase<Derived>::transpose() const
|
||||||
{
|
{
|
||||||
return ConstTransposeReturnType(derived());
|
return ConstTransposeReturnType(derived());
|
||||||
@ -206,7 +206,7 @@ DenseBase<Derived>::transpose() const
|
|||||||
*
|
*
|
||||||
* \sa adjointInPlace(), transpose(), conjugate(), class Transpose, class internal::scalar_conjugate_op */
|
* \sa adjointInPlace(), transpose(), conjugate(), class Transpose, class internal::scalar_conjugate_op */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline const typename MatrixBase<Derived>::AdjointReturnType
|
EIGEN_DEVICE_FUNC inline const typename MatrixBase<Derived>::AdjointReturnType
|
||||||
MatrixBase<Derived>::adjoint() const
|
MatrixBase<Derived>::adjoint() const
|
||||||
{
|
{
|
||||||
return AdjointReturnType(this->transpose());
|
return AdjointReturnType(this->transpose());
|
||||||
@ -281,7 +281,7 @@ struct inplace_transpose_selector<MatrixType,false,MatchPacketSize> { // non squ
|
|||||||
*
|
*
|
||||||
* \sa transpose(), adjoint(), adjointInPlace() */
|
* \sa transpose(), adjoint(), adjointInPlace() */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline void DenseBase<Derived>::transposeInPlace()
|
EIGEN_DEVICE_FUNC inline void DenseBase<Derived>::transposeInPlace()
|
||||||
{
|
{
|
||||||
eigen_assert((rows() == cols() || (RowsAtCompileTime == Dynamic && ColsAtCompileTime == Dynamic))
|
eigen_assert((rows() == cols() || (RowsAtCompileTime == Dynamic && ColsAtCompileTime == Dynamic))
|
||||||
&& "transposeInPlace() called on a non-square non-resizable matrix");
|
&& "transposeInPlace() called on a non-square non-resizable matrix");
|
||||||
@ -312,7 +312,7 @@ inline void DenseBase<Derived>::transposeInPlace()
|
|||||||
*
|
*
|
||||||
* \sa transpose(), adjoint(), transposeInPlace() */
|
* \sa transpose(), adjoint(), transposeInPlace() */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline void MatrixBase<Derived>::adjointInPlace()
|
EIGEN_DEVICE_FUNC inline void MatrixBase<Derived>::adjointInPlace()
|
||||||
{
|
{
|
||||||
derived() = adjoint().eval();
|
derived() = adjoint().eval();
|
||||||
}
|
}
|
||||||
|
@ -488,7 +488,6 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularViewImpl<_Mat
|
|||||||
* \sa TriangularView::solveInPlace()
|
* \sa TriangularView::solveInPlace()
|
||||||
*/
|
*/
|
||||||
template<int Side, typename Other>
|
template<int Side, typename Other>
|
||||||
EIGEN_DEVICE_FUNC
|
|
||||||
inline const internal::triangular_solve_retval<Side,TriangularViewType, Other>
|
inline const internal::triangular_solve_retval<Side,TriangularViewType, Other>
|
||||||
solve(const MatrixBase<Other>& other) const;
|
solve(const MatrixBase<Other>& other) const;
|
||||||
|
|
||||||
@ -554,7 +553,7 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularViewImpl<_Mat
|
|||||||
// FIXME should we keep that possibility
|
// FIXME should we keep that possibility
|
||||||
template<typename MatrixType, unsigned int Mode>
|
template<typename MatrixType, unsigned int Mode>
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
inline TriangularView<MatrixType, Mode>&
|
EIGEN_DEVICE_FUNC inline TriangularView<MatrixType, Mode>&
|
||||||
TriangularViewImpl<MatrixType, Mode, Dense>::operator=(const MatrixBase<OtherDerived>& other)
|
TriangularViewImpl<MatrixType, Mode, Dense>::operator=(const MatrixBase<OtherDerived>& other)
|
||||||
{
|
{
|
||||||
internal::call_assignment_no_alias(derived(), other.derived(), internal::assign_op<Scalar,typename OtherDerived::Scalar>());
|
internal::call_assignment_no_alias(derived(), other.derived(), internal::assign_op<Scalar,typename OtherDerived::Scalar>());
|
||||||
@ -564,7 +563,7 @@ TriangularViewImpl<MatrixType, Mode, Dense>::operator=(const MatrixBase<OtherDer
|
|||||||
// FIXME should we keep that possibility
|
// FIXME should we keep that possibility
|
||||||
template<typename MatrixType, unsigned int Mode>
|
template<typename MatrixType, unsigned int Mode>
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
void TriangularViewImpl<MatrixType, Mode, Dense>::lazyAssign(const MatrixBase<OtherDerived>& other)
|
EIGEN_DEVICE_FUNC void TriangularViewImpl<MatrixType, Mode, Dense>::lazyAssign(const MatrixBase<OtherDerived>& other)
|
||||||
{
|
{
|
||||||
internal::call_assignment_no_alias(derived(), other.template triangularView<Mode>());
|
internal::call_assignment_no_alias(derived(), other.template triangularView<Mode>());
|
||||||
}
|
}
|
||||||
@ -573,7 +572,7 @@ void TriangularViewImpl<MatrixType, Mode, Dense>::lazyAssign(const MatrixBase<Ot
|
|||||||
|
|
||||||
template<typename MatrixType, unsigned int Mode>
|
template<typename MatrixType, unsigned int Mode>
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
inline TriangularView<MatrixType, Mode>&
|
EIGEN_DEVICE_FUNC inline TriangularView<MatrixType, Mode>&
|
||||||
TriangularViewImpl<MatrixType, Mode, Dense>::operator=(const TriangularBase<OtherDerived>& other)
|
TriangularViewImpl<MatrixType, Mode, Dense>::operator=(const TriangularBase<OtherDerived>& other)
|
||||||
{
|
{
|
||||||
eigen_assert(Mode == int(OtherDerived::Mode));
|
eigen_assert(Mode == int(OtherDerived::Mode));
|
||||||
@ -583,7 +582,7 @@ TriangularViewImpl<MatrixType, Mode, Dense>::operator=(const TriangularBase<Othe
|
|||||||
|
|
||||||
template<typename MatrixType, unsigned int Mode>
|
template<typename MatrixType, unsigned int Mode>
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
void TriangularViewImpl<MatrixType, Mode, Dense>::lazyAssign(const TriangularBase<OtherDerived>& other)
|
EIGEN_DEVICE_FUNC void TriangularViewImpl<MatrixType, Mode, Dense>::lazyAssign(const TriangularBase<OtherDerived>& other)
|
||||||
{
|
{
|
||||||
eigen_assert(Mode == int(OtherDerived::Mode));
|
eigen_assert(Mode == int(OtherDerived::Mode));
|
||||||
internal::call_assignment_no_alias(derived(), other.derived());
|
internal::call_assignment_no_alias(derived(), other.derived());
|
||||||
@ -598,7 +597,7 @@ void TriangularViewImpl<MatrixType, Mode, Dense>::lazyAssign(const TriangularBas
|
|||||||
* If the matrix is triangular, the opposite part is set to zero. */
|
* If the matrix is triangular, the opposite part is set to zero. */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename DenseDerived>
|
template<typename DenseDerived>
|
||||||
void TriangularBase<Derived>::evalTo(MatrixBase<DenseDerived> &other) const
|
EIGEN_DEVICE_FUNC void TriangularBase<Derived>::evalTo(MatrixBase<DenseDerived> &other) const
|
||||||
{
|
{
|
||||||
evalToLazy(other.derived());
|
evalToLazy(other.derived());
|
||||||
}
|
}
|
||||||
@ -624,6 +623,7 @@ void TriangularBase<Derived>::evalTo(MatrixBase<DenseDerived> &other) const
|
|||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<unsigned int Mode>
|
template<unsigned int Mode>
|
||||||
|
EIGEN_DEVICE_FUNC
|
||||||
typename MatrixBase<Derived>::template TriangularViewReturnType<Mode>::Type
|
typename MatrixBase<Derived>::template TriangularViewReturnType<Mode>::Type
|
||||||
MatrixBase<Derived>::triangularView()
|
MatrixBase<Derived>::triangularView()
|
||||||
{
|
{
|
||||||
@ -633,6 +633,7 @@ MatrixBase<Derived>::triangularView()
|
|||||||
/** This is the const version of MatrixBase::triangularView() */
|
/** This is the const version of MatrixBase::triangularView() */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<unsigned int Mode>
|
template<unsigned int Mode>
|
||||||
|
EIGEN_DEVICE_FUNC
|
||||||
typename MatrixBase<Derived>::template ConstTriangularViewReturnType<Mode>::Type
|
typename MatrixBase<Derived>::template ConstTriangularViewReturnType<Mode>::Type
|
||||||
MatrixBase<Derived>::triangularView() const
|
MatrixBase<Derived>::triangularView() const
|
||||||
{
|
{
|
||||||
@ -930,7 +931,7 @@ struct triangular_assignment_loop<Kernel, Mode, Dynamic, SetOpposite>
|
|||||||
* If the matrix is triangular, the opposite part is set to zero. */
|
* If the matrix is triangular, the opposite part is set to zero. */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename DenseDerived>
|
template<typename DenseDerived>
|
||||||
void TriangularBase<Derived>::evalToLazy(MatrixBase<DenseDerived> &other) const
|
EIGEN_DEVICE_FUNC void TriangularBase<Derived>::evalToLazy(MatrixBase<DenseDerived> &other) const
|
||||||
{
|
{
|
||||||
other.derived().resize(this->rows(), this->cols());
|
other.derived().resize(this->rows(), this->cols());
|
||||||
internal::call_triangular_assignment_loop<Derived::Mode,(Derived::Mode&SelfAdjoint)==0 /* SetOpposite */>(other.derived(), derived().nestedExpression());
|
internal::call_triangular_assignment_loop<Derived::Mode,(Derived::Mode&SelfAdjoint)==0 /* SetOpposite */>(other.derived(), derived().nestedExpression());
|
||||||
|
@ -670,7 +670,7 @@ 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>
|
||||||
inline typename DenseBase<Derived>::ColwiseReturnType
|
EIGEN_DEVICE_FUNC inline typename DenseBase<Derived>::ColwiseReturnType
|
||||||
DenseBase<Derived>::colwise()
|
DenseBase<Derived>::colwise()
|
||||||
{
|
{
|
||||||
return ColwiseReturnType(derived());
|
return ColwiseReturnType(derived());
|
||||||
@ -684,7 +684,7 @@ DenseBase<Derived>::colwise()
|
|||||||
* \sa colwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting
|
* \sa colwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline typename DenseBase<Derived>::RowwiseReturnType
|
EIGEN_DEVICE_FUNC inline typename DenseBase<Derived>::RowwiseReturnType
|
||||||
DenseBase<Derived>::rowwise()
|
DenseBase<Derived>::rowwise()
|
||||||
{
|
{
|
||||||
return RowwiseReturnType(derived());
|
return RowwiseReturnType(derived());
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted.
|
// modification, are permitted.
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
@ -167,10 +167,10 @@ template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 ploadu<double2>(const d
|
|||||||
return make_double2(from[0], from[1]);
|
return make_double2(from[0], from[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<> EIGEN_STRONG_INLINE float4 ploaddup<float4>(const float* from) {
|
template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 ploaddup<float4>(const float* from) {
|
||||||
return make_float4(from[0], from[0], from[1], from[1]);
|
return make_float4(from[0], from[0], from[1], from[1]);
|
||||||
}
|
}
|
||||||
template<> EIGEN_STRONG_INLINE double2 ploaddup<double2>(const double* from) {
|
template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 ploaddup<double2>(const double* from) {
|
||||||
return make_double2(from[0], from[0]);
|
return make_double2(from[0], from[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,7 +291,7 @@ template<> EIGEN_DEVICE_FUNC inline double2 pabs<double2>(const double2& a) {
|
|||||||
|
|
||||||
EIGEN_DEVICE_FUNC inline void
|
EIGEN_DEVICE_FUNC inline void
|
||||||
ptranspose(PacketBlock<float4,4>& kernel) {
|
ptranspose(PacketBlock<float4,4>& kernel) {
|
||||||
double tmp = kernel.packet[0].y;
|
float tmp = kernel.packet[0].y;
|
||||||
kernel.packet[0].y = kernel.packet[1].x;
|
kernel.packet[0].y = kernel.packet[1].x;
|
||||||
kernel.packet[1].x = tmp;
|
kernel.packet[1].x = tmp;
|
||||||
|
|
||||||
|
@ -51,14 +51,17 @@ typedef uint32x4_t Packet4ui;
|
|||||||
#define _EIGEN_DECLARE_CONST_Packet4i(NAME,X) \
|
#define _EIGEN_DECLARE_CONST_Packet4i(NAME,X) \
|
||||||
const Packet4i p4i_##NAME = pset1<Packet4i>(X)
|
const Packet4i p4i_##NAME = pset1<Packet4i>(X)
|
||||||
|
|
||||||
// arm64 does have the pld instruction. If available, let's trust the __builtin_prefetch built-in function
|
#if EIGEN_ARCH_ARM64
|
||||||
// which available on LLVM and GCC (at least)
|
// __builtin_prefetch tends to do nothing on ARM64 compilers because the
|
||||||
#if EIGEN_HAS_BUILTIN(__builtin_prefetch) || EIGEN_COMP_GNUC
|
// prefetch instructions there are too detailed for __builtin_prefetch to map
|
||||||
|
// meaningfully to them.
|
||||||
|
#define EIGEN_ARM_PREFETCH(ADDR) __asm__ __volatile__("prfm pldl1keep, [%[addr]]\n" ::[addr] "r"(ADDR) : );
|
||||||
|
#elif EIGEN_HAS_BUILTIN(__builtin_prefetch) || EIGEN_COMP_GNUC
|
||||||
#define EIGEN_ARM_PREFETCH(ADDR) __builtin_prefetch(ADDR);
|
#define EIGEN_ARM_PREFETCH(ADDR) __builtin_prefetch(ADDR);
|
||||||
#elif defined __pld
|
#elif defined __pld
|
||||||
#define EIGEN_ARM_PREFETCH(ADDR) __pld(ADDR)
|
#define EIGEN_ARM_PREFETCH(ADDR) __pld(ADDR)
|
||||||
#elif !EIGEN_ARCH_ARM64
|
#elif EIGEN_ARCH_ARM32
|
||||||
#define EIGEN_ARM_PREFETCH(ADDR) __asm__ __volatile__ ( " pld [%[addr]]\n" :: [addr] "r" (ADDR) : "cc" );
|
#define EIGEN_ARM_PREFETCH(ADDR) __asm__ __volatile__ ("pld [%[addr]]\n" :: [addr] "r" (ADDR) : );
|
||||||
#else
|
#else
|
||||||
// by default no explicit prefetching
|
// by default no explicit prefetching
|
||||||
#define EIGEN_ARM_PREFETCH(ADDR)
|
#define EIGEN_ARM_PREFETCH(ADDR)
|
||||||
|
@ -292,12 +292,12 @@ struct general_product_to_triangular_selector<MatrixType,ProductType,UpLo,false>
|
|||||||
|
|
||||||
template<typename MatrixType, unsigned int UpLo>
|
template<typename MatrixType, unsigned int UpLo>
|
||||||
template<typename ProductType>
|
template<typename ProductType>
|
||||||
TriangularView<MatrixType,UpLo>& TriangularViewImpl<MatrixType,UpLo,Dense>::_assignProduct(const ProductType& prod, const Scalar& alpha, bool beta)
|
EIGEN_DEVICE_FUNC TriangularView<MatrixType,UpLo>& TriangularViewImpl<MatrixType,UpLo,Dense>::_assignProduct(const ProductType& prod, const Scalar& alpha, bool beta)
|
||||||
{
|
{
|
||||||
eigen_assert(derived().nestedExpression().rows() == prod.rows() && derived().cols() == prod.cols());
|
eigen_assert(derived().nestedExpression().rows() == prod.rows() && derived().cols() == prod.cols());
|
||||||
|
|
||||||
general_product_to_triangular_selector<MatrixType, ProductType, UpLo, internal::traits<ProductType>::InnerSize==1>::run(derived().nestedExpression().const_cast_derived(), prod, alpha, beta);
|
general_product_to_triangular_selector<MatrixType, ProductType, UpLo, internal::traits<ProductType>::InnerSize==1>::run(derived().nestedExpression().const_cast_derived(), prod, alpha, beta);
|
||||||
|
|
||||||
return derived();
|
return derived();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ struct selfadjoint_product_selector<MatrixType,OtherType,UpLo,false>
|
|||||||
|
|
||||||
template<typename MatrixType, unsigned int UpLo>
|
template<typename MatrixType, unsigned int UpLo>
|
||||||
template<typename DerivedU>
|
template<typename DerivedU>
|
||||||
SelfAdjointView<MatrixType,UpLo>& SelfAdjointView<MatrixType,UpLo>
|
EIGEN_DEVICE_FUNC SelfAdjointView<MatrixType,UpLo>& SelfAdjointView<MatrixType,UpLo>
|
||||||
::rankUpdate(const MatrixBase<DerivedU>& u, const Scalar& alpha)
|
::rankUpdate(const MatrixBase<DerivedU>& u, const Scalar& alpha)
|
||||||
{
|
{
|
||||||
selfadjoint_product_selector<MatrixType,DerivedU,UpLo>::run(_expression().const_cast_derived(), u.derived(), alpha);
|
selfadjoint_product_selector<MatrixType,DerivedU,UpLo>::run(_expression().const_cast_derived(), u.derived(), alpha);
|
||||||
|
@ -57,7 +57,7 @@ template<bool Cond, typename T> struct conj_expr_if
|
|||||||
|
|
||||||
template<typename MatrixType, unsigned int UpLo>
|
template<typename MatrixType, unsigned int UpLo>
|
||||||
template<typename DerivedU, typename DerivedV>
|
template<typename DerivedU, typename DerivedV>
|
||||||
SelfAdjointView<MatrixType,UpLo>& SelfAdjointView<MatrixType,UpLo>
|
EIGEN_DEVICE_FUNC SelfAdjointView<MatrixType,UpLo>& SelfAdjointView<MatrixType,UpLo>
|
||||||
::rankUpdate(const MatrixBase<DerivedU>& u, const MatrixBase<DerivedV>& v, const Scalar& alpha)
|
::rankUpdate(const MatrixBase<DerivedU>& u, const MatrixBase<DerivedV>& v, const Scalar& alpha)
|
||||||
{
|
{
|
||||||
typedef internal::blas_traits<DerivedU> UBlasTraits;
|
typedef internal::blas_traits<DerivedU> UBlasTraits;
|
||||||
|
@ -151,9 +151,9 @@ struct get_fixed_value<variable_if_dynamic<T,N>,Default> {
|
|||||||
static const int value = N;
|
static const int value = N;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T> Index get_runtime_value(const T &x) { return x; }
|
template<typename T> EIGEN_DEVICE_FUNC Index get_runtime_value(const T &x) { return x; }
|
||||||
#if !EIGEN_HAS_CXX14
|
#if !EIGEN_HAS_CXX14
|
||||||
template<int N> Index get_runtime_value(FixedInt<N> (*)()) { return N; }
|
template<int N> EIGEN_DEVICE_FUNC Index get_runtime_value(FixedInt<N> (*)()) { return N; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Cleanup integer/FixedInt/VariableAndFixedInt/etc types:
|
// Cleanup integer/FixedInt/VariableAndFixedInt/etc types:
|
||||||
|
@ -542,8 +542,8 @@
|
|||||||
// - static is not very good because it prevents definitions from different object files to be merged.
|
// - static is not very good because it prevents definitions from different object files to be merged.
|
||||||
// So static causes the resulting linked executable to be bloated with multiple copies of the same function.
|
// So static causes the resulting linked executable to be bloated with multiple copies of the same function.
|
||||||
// - inline is not perfect either as it unwantedly hints the compiler toward inlining the function.
|
// - inline is not perfect either as it unwantedly hints the compiler toward inlining the function.
|
||||||
#define EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
#define EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_DEVICE_FUNC
|
||||||
#define EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS inline
|
#define EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_DEVICE_FUNC inline
|
||||||
|
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
# ifndef EIGEN_NO_DEBUG
|
# ifndef EIGEN_NO_DEBUG
|
||||||
|
@ -85,7 +85,7 @@ MatrixBase<Derived>::eigenvalues() const
|
|||||||
* \sa SelfAdjointEigenSolver::eigenvalues(), MatrixBase::eigenvalues()
|
* \sa SelfAdjointEigenSolver::eigenvalues(), MatrixBase::eigenvalues()
|
||||||
*/
|
*/
|
||||||
template<typename MatrixType, unsigned int UpLo>
|
template<typename MatrixType, unsigned int UpLo>
|
||||||
inline typename SelfAdjointView<MatrixType, UpLo>::EigenvaluesReturnType
|
EIGEN_DEVICE_FUNC inline typename SelfAdjointView<MatrixType, UpLo>::EigenvaluesReturnType
|
||||||
SelfAdjointView<MatrixType, UpLo>::eigenvalues() const
|
SelfAdjointView<MatrixType, UpLo>::eigenvalues() const
|
||||||
{
|
{
|
||||||
typedef typename SelfAdjointView<MatrixType, UpLo>::PlainObject PlainObject;
|
typedef typename SelfAdjointView<MatrixType, UpLo>::PlainObject PlainObject;
|
||||||
@ -149,7 +149,7 @@ MatrixBase<Derived>::operatorNorm() const
|
|||||||
* \sa eigenvalues(), MatrixBase::operatorNorm()
|
* \sa eigenvalues(), MatrixBase::operatorNorm()
|
||||||
*/
|
*/
|
||||||
template<typename MatrixType, unsigned int UpLo>
|
template<typename MatrixType, unsigned int UpLo>
|
||||||
inline typename SelfAdjointView<MatrixType, UpLo>::RealScalar
|
EIGEN_DEVICE_FUNC inline typename SelfAdjointView<MatrixType, UpLo>::RealScalar
|
||||||
SelfAdjointView<MatrixType, UpLo>::operatorNorm() const
|
SelfAdjointView<MatrixType, UpLo>::operatorNorm() const
|
||||||
{
|
{
|
||||||
return eigenvalues().cwiseAbs().maxCoeff();
|
return eigenvalues().cwiseAbs().maxCoeff();
|
||||||
|
@ -411,11 +411,9 @@ template<typename _MatrixType> class FullPivLU
|
|||||||
|
|
||||||
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||||
template<typename RhsType, typename DstType>
|
template<typename RhsType, typename DstType>
|
||||||
EIGEN_DEVICE_FUNC
|
|
||||||
void _solve_impl(const RhsType &rhs, DstType &dst) const;
|
void _solve_impl(const RhsType &rhs, DstType &dst) const;
|
||||||
|
|
||||||
template<bool Conjugate, typename RhsType, typename DstType>
|
template<bool Conjugate, typename RhsType, typename DstType>
|
||||||
EIGEN_DEVICE_FUNC
|
|
||||||
void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const;
|
void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1004,7 +1004,7 @@ static IndexType find_ordering /* return the number of garbage collections */
|
|||||||
COLAMD_ASSERT (head [min_score] >= COLAMD_EMPTY) ;
|
COLAMD_ASSERT (head [min_score] >= COLAMD_EMPTY) ;
|
||||||
|
|
||||||
/* get pivot column from head of minimum degree list */
|
/* get pivot column from head of minimum degree list */
|
||||||
while (head [min_score] == COLAMD_EMPTY && min_score < n_col)
|
while (min_score < n_col && head [min_score] == COLAMD_EMPTY)
|
||||||
{
|
{
|
||||||
min_score++ ;
|
min_score++ ;
|
||||||
}
|
}
|
||||||
|
@ -416,7 +416,6 @@ template<typename _MatrixType> class ColPivHouseholderQR
|
|||||||
|
|
||||||
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||||
template<typename RhsType, typename DstType>
|
template<typename RhsType, typename DstType>
|
||||||
EIGEN_DEVICE_FUNC
|
|
||||||
void _solve_impl(const RhsType &rhs, DstType &dst) const;
|
void _solve_impl(const RhsType &rhs, DstType &dst) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -367,7 +367,7 @@ class CompleteOrthogonalDecomposition {
|
|||||||
|
|
||||||
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||||
template <typename RhsType, typename DstType>
|
template <typename RhsType, typename DstType>
|
||||||
EIGEN_DEVICE_FUNC void _solve_impl(const RhsType& rhs, DstType& dst) const;
|
void _solve_impl(const RhsType& rhs, DstType& dst) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -392,22 +392,21 @@ template<typename _MatrixType> class FullPivHouseholderQR
|
|||||||
* diagonal coefficient of U.
|
* diagonal coefficient of U.
|
||||||
*/
|
*/
|
||||||
RealScalar maxPivot() const { return m_maxpivot; }
|
RealScalar maxPivot() const { return m_maxpivot; }
|
||||||
|
|
||||||
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||||
template<typename RhsType, typename DstType>
|
template<typename RhsType, typename DstType>
|
||||||
EIGEN_DEVICE_FUNC
|
|
||||||
void _solve_impl(const RhsType &rhs, DstType &dst) const;
|
void _solve_impl(const RhsType &rhs, DstType &dst) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
static void check_template_parameters()
|
static void check_template_parameters()
|
||||||
{
|
{
|
||||||
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
|
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
|
||||||
}
|
}
|
||||||
|
|
||||||
void computeInPlace();
|
void computeInPlace();
|
||||||
|
|
||||||
MatrixType m_qr;
|
MatrixType m_qr;
|
||||||
HCoeffsType m_hCoeffs;
|
HCoeffsType m_hCoeffs;
|
||||||
IntDiagSizeVectorType m_rows_transpositions;
|
IntDiagSizeVectorType m_rows_transpositions;
|
||||||
|
@ -204,28 +204,27 @@ template<typename _MatrixType> class HouseholderQR
|
|||||||
|
|
||||||
inline Index rows() const { return m_qr.rows(); }
|
inline Index rows() const { return m_qr.rows(); }
|
||||||
inline Index cols() const { return m_qr.cols(); }
|
inline Index cols() const { return m_qr.cols(); }
|
||||||
|
|
||||||
/** \returns a const reference to the vector of Householder coefficients used to represent the factor \c Q.
|
/** \returns a const reference to the vector of Householder coefficients used to represent the factor \c Q.
|
||||||
*
|
*
|
||||||
* For advanced uses only.
|
* For advanced uses only.
|
||||||
*/
|
*/
|
||||||
const HCoeffsType& hCoeffs() const { return m_hCoeffs; }
|
const HCoeffsType& hCoeffs() const { return m_hCoeffs; }
|
||||||
|
|
||||||
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||||
template<typename RhsType, typename DstType>
|
template<typename RhsType, typename DstType>
|
||||||
EIGEN_DEVICE_FUNC
|
|
||||||
void _solve_impl(const RhsType &rhs, DstType &dst) const;
|
void _solve_impl(const RhsType &rhs, DstType &dst) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
static void check_template_parameters()
|
static void check_template_parameters()
|
||||||
{
|
{
|
||||||
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
|
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
|
||||||
}
|
}
|
||||||
|
|
||||||
void computeInPlace();
|
void computeInPlace();
|
||||||
|
|
||||||
MatrixType m_qr;
|
MatrixType m_qr;
|
||||||
HCoeffsType m_hCoeffs;
|
HCoeffsType m_hCoeffs;
|
||||||
RowVectorType m_temp;
|
RowVectorType m_temp;
|
||||||
|
@ -212,7 +212,6 @@ public:
|
|||||||
|
|
||||||
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||||
template<typename RhsType, typename DstType>
|
template<typename RhsType, typename DstType>
|
||||||
EIGEN_DEVICE_FUNC
|
|
||||||
void _solve_impl(const RhsType &rhs, DstType &dst) const;
|
void _solve_impl(const RhsType &rhs, DstType &dst) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -43,10 +43,6 @@
|
|||||||
#include "lapacke_config.h"
|
#include "lapacke_config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#ifndef lapack_int
|
#ifndef lapack_int
|
||||||
@ -108,6 +104,11 @@ lapack_complex_double lapack_make_complex_double( double re, double im );
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#ifndef LAPACKE_malloc
|
#ifndef LAPACKE_malloc
|
||||||
#define LAPACKE_malloc( size ) malloc( size )
|
#define LAPACKE_malloc( size ) malloc( size )
|
||||||
#endif
|
#endif
|
||||||
|
@ -75,16 +75,16 @@ large enough to hold all the data.
|
|||||||
|
|
||||||
// Map a tensor of ints on top of stack-allocated storage.
|
// Map a tensor of ints on top of stack-allocated storage.
|
||||||
int storage[128]; // 2 x 4 x 2 x 8 = 128
|
int storage[128]; // 2 x 4 x 2 x 8 = 128
|
||||||
TensorMap<int, 4> t_4d(storage, 2, 4, 2, 8);
|
TensorMap<Tensor<int, 4>> t_4d(storage, 2, 4, 2, 8);
|
||||||
|
|
||||||
// The same storage can be viewed as a different tensor.
|
// The same storage can be viewed as a different tensor.
|
||||||
// You can also pass the sizes as an array.
|
// You can also pass the sizes as an array.
|
||||||
TensorMap<int, 2> t_2d(storage, 16, 8);
|
TensorMap<Tensor<int, 2>> t_2d(storage, 16, 8);
|
||||||
|
|
||||||
// You can also map fixed-size tensors. Here we get a 1d view of
|
// You can also map fixed-size tensors. Here we get a 1d view of
|
||||||
// the 2d fixed-size tensor.
|
// the 2d fixed-size tensor.
|
||||||
Tensor<float, Sizes<4, 5>> t_4x3;
|
Tensor<float, Sizes<4, 5>> t_4x3;
|
||||||
TensorMap<float, 1> t_12(t_4x3, 12);
|
TensorMap<Tensor<float, 1>> t_12(t_4x3, 12);
|
||||||
|
|
||||||
|
|
||||||
#### Class TensorRef
|
#### Class TensorRef
|
||||||
|
@ -50,6 +50,7 @@ template <DenseIndex DimId>
|
|||||||
struct DimensionId
|
struct DimensionId
|
||||||
{
|
{
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DimensionId(DenseIndex dim) {
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DimensionId(DenseIndex dim) {
|
||||||
|
EIGEN_UNUSED_VARIABLE(dim);
|
||||||
eigen_assert(dim == DimId);
|
eigen_assert(dim == DimId);
|
||||||
}
|
}
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DenseIndex actualDim() const {
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DenseIndex actualDim() const {
|
||||||
|
@ -529,7 +529,6 @@ EigenFloatContractionKernelInternal16x16(const LhsMapper lhs, const RhsMapper rh
|
|||||||
float2 rhs_shmem2[][8], const Index m_size,
|
float2 rhs_shmem2[][8], const Index m_size,
|
||||||
const Index n_size, const Index k_size,
|
const Index n_size, const Index k_size,
|
||||||
const Index base_m, const Index base_n) {
|
const Index base_m, const Index base_n) {
|
||||||
typedef float Scalar;
|
|
||||||
|
|
||||||
// prefetch registers
|
// prefetch registers
|
||||||
float4 lhs_pf0, rhs_pf0;
|
float4 lhs_pf0, rhs_pf0;
|
||||||
@ -540,27 +539,27 @@ EigenFloatContractionKernelInternal16x16(const LhsMapper lhs, const RhsMapper rh
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define prefetch_lhs(reg, row, col) \
|
#define prefetch_lhs(reg, row, col) \
|
||||||
if (!CHECK_LHS_BOUNDARY) { \
|
if (!CHECK_LHS_BOUNDARY) { \
|
||||||
if (col < k_size) { \
|
if (col < k_size) { \
|
||||||
reg =lhs.loadPacket<Unaligned>(row, col); \
|
reg =lhs.template loadPacket<Unaligned>(row, col); \
|
||||||
} \
|
} \
|
||||||
} else { \
|
} else { \
|
||||||
if (col < k_size) { \
|
if (col < k_size) { \
|
||||||
if (row + 3 < m_size) { \
|
if (row + 3 < m_size) { \
|
||||||
reg =lhs.loadPacket<Unaligned>(row, col); \
|
reg =lhs.template loadPacket<Unaligned>(row, col); \
|
||||||
} else if (row + 2 < m_size) { \
|
} else if (row + 2 < m_size) { \
|
||||||
reg.x =lhs(row + 0, col); \
|
reg.x =lhs(row + 0, col); \
|
||||||
reg.y =lhs(row + 1, col); \
|
reg.y =lhs(row + 1, col); \
|
||||||
reg.z =lhs(row + 2, col); \
|
reg.z =lhs(row + 2, col); \
|
||||||
} else if (row + 1 < m_size) { \
|
} else if (row + 1 < m_size) { \
|
||||||
reg.x =lhs(row + 0, col); \
|
reg.x =lhs(row + 0, col); \
|
||||||
reg.y =lhs(row + 1, col); \
|
reg.y =lhs(row + 1, col); \
|
||||||
} else if (row < m_size) { \
|
} else if (row < m_size) { \
|
||||||
reg.x =lhs(row + 0, col); \
|
reg.x =lhs(row + 0, col); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
|
|
||||||
|
|
||||||
Index lhs_vert = base_m+threadIdx.x*4;
|
Index lhs_vert = base_m+threadIdx.x*4;
|
||||||
@ -578,7 +577,7 @@ EigenFloatContractionKernelInternal16x16(const LhsMapper lhs, const RhsMapper rh
|
|||||||
if (!CHECK_RHS_BOUNDARY) {
|
if (!CHECK_RHS_BOUNDARY) {
|
||||||
if ((rhs_vert + 3) < k_size) {
|
if ((rhs_vert + 3) < k_size) {
|
||||||
// just CHECK_RHS_BOUNDARY
|
// just CHECK_RHS_BOUNDARY
|
||||||
rhs_pf0 = rhs.loadPacket<Unaligned>(rhs_vert, rhs_horiz0);
|
rhs_pf0 = rhs.template loadPacket<Unaligned>(rhs_vert, rhs_horiz0);
|
||||||
} else if (rhs_vert + 2 < k_size) {
|
} else if (rhs_vert + 2 < k_size) {
|
||||||
// just CHECK_RHS_BOUNDARY
|
// just CHECK_RHS_BOUNDARY
|
||||||
rhs_pf0.x = rhs(rhs_vert, rhs_horiz0);
|
rhs_pf0.x = rhs(rhs_vert, rhs_horiz0);
|
||||||
@ -593,7 +592,7 @@ EigenFloatContractionKernelInternal16x16(const LhsMapper lhs, const RhsMapper rh
|
|||||||
} else {
|
} else {
|
||||||
if (rhs_horiz0 < n_size) {
|
if (rhs_horiz0 < n_size) {
|
||||||
if ((rhs_vert + 3) < k_size) {
|
if ((rhs_vert + 3) < k_size) {
|
||||||
rhs_pf0 = rhs.loadPacket<Unaligned>(rhs_vert, rhs_horiz0);
|
rhs_pf0 = rhs.template loadPacket<Unaligned>(rhs_vert, rhs_horiz0);
|
||||||
} else if ((rhs_vert + 2) < k_size) {
|
} else if ((rhs_vert + 2) < k_size) {
|
||||||
rhs_pf0.x = rhs(rhs_vert, rhs_horiz0);
|
rhs_pf0.x = rhs(rhs_vert, rhs_horiz0);
|
||||||
rhs_pf0.y = rhs(rhs_vert + 1, rhs_horiz0);
|
rhs_pf0.y = rhs(rhs_vert + 1, rhs_horiz0);
|
||||||
@ -766,7 +765,6 @@ EigenFloatContractionKernelInternal(const LhsMapper lhs, const RhsMapper rhs,
|
|||||||
float2 rhs_shmem2[][8], const Index m_size,
|
float2 rhs_shmem2[][8], const Index m_size,
|
||||||
const Index n_size, const Index k_size,
|
const Index n_size, const Index k_size,
|
||||||
const Index base_m, const Index base_n) {
|
const Index base_m, const Index base_n) {
|
||||||
typedef float Scalar;
|
|
||||||
|
|
||||||
// prefetch registers
|
// prefetch registers
|
||||||
float4 lhs_pf0, lhs_pf1, lhs_pf2, lhs_pf3;
|
float4 lhs_pf0, lhs_pf1, lhs_pf2, lhs_pf3;
|
||||||
@ -790,37 +788,37 @@ EigenFloatContractionKernelInternal(const LhsMapper lhs, const RhsMapper rhs,
|
|||||||
|
|
||||||
if (!CHECK_LHS_BOUNDARY) {
|
if (!CHECK_LHS_BOUNDARY) {
|
||||||
if ((threadIdx.y/4+k+24) < k_size) {
|
if ((threadIdx.y/4+k+24) < k_size) {
|
||||||
lhs_pf0 =lhs.loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k));
|
lhs_pf0 =lhs.template loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k));
|
||||||
lhs_pf1 =lhs.loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k+8));
|
lhs_pf1 =lhs.template loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k+8));
|
||||||
lhs_pf2 =lhs.loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k+16));
|
lhs_pf2 =lhs.template loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k+16));
|
||||||
lhs_pf3 =lhs.loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k+24));
|
lhs_pf3 =lhs.template loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k+24));
|
||||||
} else if ((threadIdx.y/4+k+16) < k_size) {
|
} else if ((threadIdx.y/4+k+16) < k_size) {
|
||||||
lhs_pf0 =lhs.loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k));
|
lhs_pf0 =lhs.template loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k));
|
||||||
lhs_pf1 =lhs.loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k+8));
|
lhs_pf1 =lhs.template loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k+8));
|
||||||
lhs_pf2 =lhs.loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k+16));
|
lhs_pf2 =lhs.template loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k+16));
|
||||||
} else if ((threadIdx.y/4+k+8) < k_size) {
|
} else if ((threadIdx.y/4+k+8) < k_size) {
|
||||||
lhs_pf0 =lhs.loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k));
|
lhs_pf0 =lhs.template loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k));
|
||||||
lhs_pf1 =lhs.loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k+8));
|
lhs_pf1 =lhs.template loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k+8));
|
||||||
} else if ((threadIdx.y/4+k) < k_size) {
|
} else if ((threadIdx.y/4+k) < k_size) {
|
||||||
lhs_pf0 =lhs.loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k));
|
lhs_pf0 =lhs.template loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// just CHECK_LHS_BOUNDARY
|
// just CHECK_LHS_BOUNDARY
|
||||||
if (lhs_vert + 3 < m_size) {
|
if (lhs_vert + 3 < m_size) {
|
||||||
if ((threadIdx.y/4+k+24) < k_size) {
|
if ((threadIdx.y/4+k+24) < k_size) {
|
||||||
lhs_pf0 =lhs.loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k));
|
lhs_pf0 =lhs.template loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k));
|
||||||
lhs_pf1 =lhs.loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k+8));
|
lhs_pf1 =lhs.template loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k+8));
|
||||||
lhs_pf2 =lhs.loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k+16));
|
lhs_pf2 =lhs.template loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k+16));
|
||||||
lhs_pf3 =lhs.loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k+24));
|
lhs_pf3 =lhs.template loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k+24));
|
||||||
} else if ((threadIdx.y/4+k+16) < k_size) {
|
} else if ((threadIdx.y/4+k+16) < k_size) {
|
||||||
lhs_pf0 =lhs.loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k));
|
lhs_pf0 =lhs.template loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k));
|
||||||
lhs_pf1 =lhs.loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k+8));
|
lhs_pf1 =lhs.template loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k+8));
|
||||||
lhs_pf2 =lhs.loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k+16));
|
lhs_pf2 =lhs.template loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k+16));
|
||||||
} else if ((threadIdx.y/4+k+8) < k_size) {
|
} else if ((threadIdx.y/4+k+8) < k_size) {
|
||||||
lhs_pf0 =lhs.loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k));
|
lhs_pf0 =lhs.template loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k));
|
||||||
lhs_pf1 =lhs.loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k+8));
|
lhs_pf1 =lhs.template loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k+8));
|
||||||
} else if ((threadIdx.y/4+k) < k_size) {
|
} else if ((threadIdx.y/4+k) < k_size) {
|
||||||
lhs_pf0 =lhs.loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k));
|
lhs_pf0 =lhs.template loadPacket<Unaligned>(lhs_vert, (threadIdx.y/4+k));
|
||||||
}
|
}
|
||||||
} else if (lhs_vert + 2 < m_size) {
|
} else if (lhs_vert + 2 < m_size) {
|
||||||
if ((threadIdx.y/4+k+24) < k_size) {
|
if ((threadIdx.y/4+k+24) < k_size) {
|
||||||
@ -909,8 +907,8 @@ EigenFloatContractionKernelInternal(const LhsMapper lhs, const RhsMapper rhs,
|
|||||||
if (!CHECK_RHS_BOUNDARY) {
|
if (!CHECK_RHS_BOUNDARY) {
|
||||||
if ((rhs_vert + 3) < k_size) {
|
if ((rhs_vert + 3) < k_size) {
|
||||||
// just CHECK_RHS_BOUNDARY
|
// just CHECK_RHS_BOUNDARY
|
||||||
rhs_pf0 = rhs.loadPacket<Unaligned>(rhs_vert, rhs_horiz0);
|
rhs_pf0 = rhs.template loadPacket<Unaligned>(rhs_vert, rhs_horiz0);
|
||||||
rhs_pf1 = rhs.loadPacket<Unaligned>(rhs_vert, rhs_horiz1);
|
rhs_pf1 = rhs.template loadPacket<Unaligned>(rhs_vert, rhs_horiz1);
|
||||||
} else if (rhs_vert + 2 < k_size) {
|
} else if (rhs_vert + 2 < k_size) {
|
||||||
// just CHECK_RHS_BOUNDARY
|
// just CHECK_RHS_BOUNDARY
|
||||||
rhs_pf0.x = rhs(rhs_vert, rhs_horiz0);
|
rhs_pf0.x = rhs(rhs_vert, rhs_horiz0);
|
||||||
@ -932,8 +930,8 @@ EigenFloatContractionKernelInternal(const LhsMapper lhs, const RhsMapper rhs,
|
|||||||
if (rhs_horiz1 < n_size) {
|
if (rhs_horiz1 < n_size) {
|
||||||
if ((rhs_vert + 3) < k_size) {
|
if ((rhs_vert + 3) < k_size) {
|
||||||
// just CHECK_RHS_BOUNDARY
|
// just CHECK_RHS_BOUNDARY
|
||||||
rhs_pf0 = rhs.loadPacket<Unaligned>(rhs_vert, rhs_horiz0);
|
rhs_pf0 = rhs.template loadPacket<Unaligned>(rhs_vert, rhs_horiz0);
|
||||||
rhs_pf1 = rhs.loadPacket<Unaligned>(rhs_vert, rhs_horiz1);
|
rhs_pf1 = rhs.template loadPacket<Unaligned>(rhs_vert, rhs_horiz1);
|
||||||
} else if (rhs_vert + 2 < k_size) {
|
} else if (rhs_vert + 2 < k_size) {
|
||||||
// just CHECK_RHS_BOUNDARY
|
// just CHECK_RHS_BOUNDARY
|
||||||
rhs_pf0.x = rhs(rhs_vert, rhs_horiz0);
|
rhs_pf0.x = rhs(rhs_vert, rhs_horiz0);
|
||||||
@ -954,7 +952,7 @@ EigenFloatContractionKernelInternal(const LhsMapper lhs, const RhsMapper rhs,
|
|||||||
} else if (rhs_horiz0 < n_size) {
|
} else if (rhs_horiz0 < n_size) {
|
||||||
if ((rhs_vert + 3) < k_size) {
|
if ((rhs_vert + 3) < k_size) {
|
||||||
// just CHECK_RHS_BOUNDARY
|
// just CHECK_RHS_BOUNDARY
|
||||||
rhs_pf0 = rhs.loadPacket<Unaligned>(rhs_vert, rhs_horiz0);
|
rhs_pf0 = rhs.template loadPacket<Unaligned>(rhs_vert, rhs_horiz0);
|
||||||
} else if ((rhs_vert + 2) < k_size) {
|
} else if ((rhs_vert + 2) < k_size) {
|
||||||
// just CHECK_RHS_BOUNDARY
|
// just CHECK_RHS_BOUNDARY
|
||||||
rhs_pf0.x = rhs(rhs_vert, rhs_horiz0);
|
rhs_pf0.x = rhs(rhs_vert, rhs_horiz0);
|
||||||
@ -1137,9 +1135,6 @@ EigenFloatContractionKernel(const LhsMapper lhs, const RhsMapper rhs,
|
|||||||
typedef float2 LHS_MEM[64][32];
|
typedef float2 LHS_MEM[64][32];
|
||||||
typedef float2 RHS_MEM[128][8];
|
typedef float2 RHS_MEM[128][8];
|
||||||
|
|
||||||
typedef float2 LHS_MEM16x16[32][16];
|
|
||||||
typedef float2 RHS_MEM16x16[64][8];
|
|
||||||
|
|
||||||
const Index m_block_idx = blockIdx.x;
|
const Index m_block_idx = blockIdx.x;
|
||||||
const Index n_block_idx = blockIdx.y;
|
const Index n_block_idx = blockIdx.y;
|
||||||
|
|
||||||
|
@ -217,7 +217,10 @@ struct GpuDevice {
|
|||||||
EIGEN_UNUSED_VARIABLE(err)
|
EIGEN_UNUSED_VARIABLE(err)
|
||||||
assert(err == cudaSuccess);
|
assert(err == cudaSuccess);
|
||||||
#else
|
#else
|
||||||
eigen_assert(false && "The default device should be used instead to generate kernel code");
|
EIGEN_UNUSED_VARIABLE(dst);
|
||||||
|
EIGEN_UNUSED_VARIABLE(src);
|
||||||
|
EIGEN_UNUSED_VARIABLE(n);
|
||||||
|
eigen_assert(false && "The default device should be used instead to generate kernel code");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,17 @@
|
|||||||
#ifndef EIGEN_CXX11_TENSOR_TENSOR_REDUCTION_H
|
#ifndef EIGEN_CXX11_TENSOR_TENSOR_REDUCTION_H
|
||||||
#define EIGEN_CXX11_TENSOR_TENSOR_REDUCTION_H
|
#define EIGEN_CXX11_TENSOR_TENSOR_REDUCTION_H
|
||||||
|
|
||||||
|
// clang is incompatible with the CUDA syntax wrt making a kernel a class friend,
|
||||||
|
// so we'll use a macro to make clang happy.
|
||||||
|
#ifndef KERNEL_FRIEND
|
||||||
|
#if defined(__clang__) && defined(__CUDA__)
|
||||||
|
#define KERNEL_FRIEND friend __global__
|
||||||
|
#else
|
||||||
|
#define KERNEL_FRIEND friend
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
namespace Eigen {
|
namespace Eigen {
|
||||||
|
|
||||||
|
|
||||||
@ -681,15 +692,15 @@ struct TensorEvaluator<const TensorReductionOp<Op, Dims, ArgType, MakePointer_>,
|
|||||||
template <typename S, typename O, bool V> friend struct internal::FullReducerShard;
|
template <typename S, typename O, bool V> friend struct internal::FullReducerShard;
|
||||||
#endif
|
#endif
|
||||||
#if defined(EIGEN_USE_GPU) && defined(__CUDACC__)
|
#if defined(EIGEN_USE_GPU) && defined(__CUDACC__)
|
||||||
template <int B, int N, typename S, typename R, typename I> friend void internal::FullReductionKernel(R, const S, I, typename S::CoeffReturnType*, unsigned int*);
|
template <int B, int N, typename S, typename R, typename I> KERNEL_FRIEND void internal::FullReductionKernel(R, const S, I, typename S::CoeffReturnType*, unsigned int*);
|
||||||
#ifdef EIGEN_HAS_CUDA_FP16
|
#ifdef EIGEN_HAS_CUDA_FP16
|
||||||
template <typename S, typename R, typename I> friend void internal::ReductionInitFullReduxKernelHalfFloat(R, const S, I, half2*);
|
template <typename S, typename R, typename I> KERNEL_FRIEND void internal::ReductionInitFullReduxKernelHalfFloat(R, const S, I, half2*);
|
||||||
template <int B, int N, typename S, typename R, typename I> friend void internal::FullReductionKernelHalfFloat(R, const S, I, half*, half2*);
|
template <int B, int N, typename S, typename R, typename I> KERNEL_FRIEND void internal::FullReductionKernelHalfFloat(R, const S, I, half*, half2*);
|
||||||
template <int NPT, typename S, typename R, typename I> friend void internal::InnerReductionKernelHalfFloat(R, const S, I, I, half*);
|
template <int NPT, typename S, typename R, typename I> KERNEL_FRIEND void internal::InnerReductionKernelHalfFloat(R, const S, I, I, half*);
|
||||||
#endif
|
#endif
|
||||||
template <int NPT, typename S, typename R, typename I> friend void internal::InnerReductionKernel(R, const S, I, I, typename S::CoeffReturnType*);
|
template <int NPT, typename S, typename R, typename I> KERNEL_FRIEND void internal::InnerReductionKernel(R, const S, I, I, typename S::CoeffReturnType*);
|
||||||
|
|
||||||
template <int NPT, typename S, typename R, typename I> friend void internal::OuterReductionKernel(R, const S, I, I, typename S::CoeffReturnType*);
|
template <int NPT, typename S, typename R, typename I> KERNEL_FRIEND void internal::OuterReductionKernel(R, const S, I, I, typename S::CoeffReturnType*);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(EIGEN_USE_SYCL)
|
#if defined(EIGEN_USE_SYCL)
|
||||||
|
@ -287,7 +287,6 @@ struct FullReductionLauncher<
|
|||||||
void>::type> {
|
void>::type> {
|
||||||
static void run(const Self& self, Op& reducer, const GpuDevice& device, OutputType* output, typename Self::Index num_coeffs) {
|
static void run(const Self& self, Op& reducer, const GpuDevice& device, OutputType* output, typename Self::Index num_coeffs) {
|
||||||
typedef typename Self::Index Index;
|
typedef typename Self::Index Index;
|
||||||
typedef typename Self::CoeffReturnType Scalar;
|
|
||||||
const int block_size = 256;
|
const int block_size = 256;
|
||||||
const int num_per_thread = 128;
|
const int num_per_thread = 128;
|
||||||
const int num_blocks = divup<int>(num_coeffs, block_size * num_per_thread);
|
const int num_blocks = divup<int>(num_coeffs, block_size * num_per_thread);
|
||||||
|
@ -31,12 +31,12 @@ namespace Eigen {
|
|||||||
*
|
*
|
||||||
* \sa Tensor
|
* \sa Tensor
|
||||||
*/
|
*/
|
||||||
template<typename T, typename Dimensions, int Options_> class TensorStorage;
|
template<typename T, typename Dimensions, int Options> class TensorStorage;
|
||||||
|
|
||||||
|
|
||||||
// Pure fixed-size storage
|
// Pure fixed-size storage
|
||||||
template<typename T, int Options_, typename FixedDimensions>
|
template<typename T, typename FixedDimensions, int Options_>
|
||||||
class TensorStorage<T, FixedDimensions, Options_>
|
class TensorStorage
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
static const std::size_t Size = FixedDimensions::total_size;
|
static const std::size_t Size = FixedDimensions::total_size;
|
||||||
@ -66,7 +66,7 @@ class TensorStorage<T, FixedDimensions, Options_>
|
|||||||
|
|
||||||
|
|
||||||
// pure dynamic
|
// pure dynamic
|
||||||
template<typename T, int Options_, typename IndexType, int NumIndices_>
|
template<typename T, typename IndexType, int NumIndices_, int Options_>
|
||||||
class TensorStorage<T, DSizes<IndexType, NumIndices_>, Options_>
|
class TensorStorage<T, DSizes<IndexType, NumIndices_>, Options_>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -23,6 +23,7 @@ struct static_val {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE static_val(const T& v) {
|
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE static_val(const T& v) {
|
||||||
|
EIGEN_UNUSED_VARIABLE(v);
|
||||||
eigen_assert(v == n);
|
eigen_assert(v == n);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -20,7 +20,13 @@ class NonBlockingThreadPoolTempl : public Eigen::ThreadPoolInterface {
|
|||||||
typedef RunQueue<Task, 1024> Queue;
|
typedef RunQueue<Task, 1024> Queue;
|
||||||
|
|
||||||
NonBlockingThreadPoolTempl(int num_threads, Environment env = Environment())
|
NonBlockingThreadPoolTempl(int num_threads, Environment env = Environment())
|
||||||
: env_(env),
|
: NonBlockingThreadPoolTempl(num_threads, true, env) {}
|
||||||
|
|
||||||
|
NonBlockingThreadPoolTempl(int num_threads, bool allow_spinning,
|
||||||
|
Environment env = Environment())
|
||||||
|
: num_threads_(num_threads),
|
||||||
|
allow_spinning_(allow_spinning),
|
||||||
|
env_(env),
|
||||||
threads_(num_threads),
|
threads_(num_threads),
|
||||||
queues_(num_threads),
|
queues_(num_threads),
|
||||||
coprimes_(num_threads),
|
coprimes_(num_threads),
|
||||||
@ -30,18 +36,18 @@ class NonBlockingThreadPoolTempl : public Eigen::ThreadPoolInterface {
|
|||||||
done_(false),
|
done_(false),
|
||||||
cancelled_(false),
|
cancelled_(false),
|
||||||
ec_(waiters_) {
|
ec_(waiters_) {
|
||||||
waiters_.resize(num_threads);
|
waiters_.resize(num_threads_);
|
||||||
|
|
||||||
// Calculate coprimes of num_threads.
|
// Calculate coprimes of num_threads_.
|
||||||
// Coprimes are used for a random walk over all threads in Steal
|
// Coprimes are used for a random walk over all threads in Steal
|
||||||
// and NonEmptyQueueIndex. Iteration is based on the fact that if we take
|
// and NonEmptyQueueIndex. Iteration is based on the fact that if we take
|
||||||
// a walk starting thread index t and calculate num_threads - 1 subsequent
|
// a walk starting thread index t and calculate num_threads - 1 subsequent
|
||||||
// indices as (t + coprime) % num_threads, we will cover all threads without
|
// indices as (t + coprime) % num_threads, we will cover all threads without
|
||||||
// repetitions (effectively getting a presudo-random permutation of thread
|
// repetitions (effectively getting a presudo-random permutation of thread
|
||||||
// indices).
|
// indices).
|
||||||
for (int i = 1; i <= num_threads; i++) {
|
for (int i = 1; i <= num_threads_; i++) {
|
||||||
unsigned a = i;
|
unsigned a = i;
|
||||||
unsigned b = num_threads;
|
unsigned b = num_threads_;
|
||||||
// If GCD(a, b) == 1, then a and b are coprimes.
|
// If GCD(a, b) == 1, then a and b are coprimes.
|
||||||
while (b != 0) {
|
while (b != 0) {
|
||||||
unsigned tmp = a;
|
unsigned tmp = a;
|
||||||
@ -52,10 +58,10 @@ class NonBlockingThreadPoolTempl : public Eigen::ThreadPoolInterface {
|
|||||||
coprimes_.push_back(i);
|
coprimes_.push_back(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < num_threads; i++) {
|
for (int i = 0; i < num_threads_; i++) {
|
||||||
queues_.push_back(new Queue());
|
queues_.push_back(new Queue());
|
||||||
}
|
}
|
||||||
for (int i = 0; i < num_threads; i++) {
|
for (int i = 0; i < num_threads_; i++) {
|
||||||
threads_.push_back(env_.CreateThread([this, i]() { WorkerLoop(i); }));
|
threads_.push_back(env_.CreateThread([this, i]() { WorkerLoop(i); }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,8 +83,8 @@ class NonBlockingThreadPoolTempl : public Eigen::ThreadPoolInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Join threads explicitly to avoid destruction order issues.
|
// Join threads explicitly to avoid destruction order issues.
|
||||||
for (size_t i = 0; i < threads_.size(); i++) delete threads_[i];
|
for (size_t i = 0; i < num_threads_; i++) delete threads_[i];
|
||||||
for (size_t i = 0; i < threads_.size(); i++) delete queues_[i];
|
for (size_t i = 0; i < num_threads_; i++) delete queues_[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
void Schedule(std::function<void()> fn) {
|
void Schedule(std::function<void()> fn) {
|
||||||
@ -125,7 +131,7 @@ class NonBlockingThreadPoolTempl : public Eigen::ThreadPoolInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int NumThreads() const final {
|
int NumThreads() const final {
|
||||||
return static_cast<int>(threads_.size());
|
return num_threads_;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CurrentThreadId() const final {
|
int CurrentThreadId() const final {
|
||||||
@ -149,6 +155,8 @@ class NonBlockingThreadPoolTempl : public Eigen::ThreadPoolInterface {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Environment env_;
|
Environment env_;
|
||||||
|
const int num_threads_;
|
||||||
|
const bool allow_spinning_;
|
||||||
MaxSizeVector<Thread*> threads_;
|
MaxSizeVector<Thread*> threads_;
|
||||||
MaxSizeVector<Queue*> queues_;
|
MaxSizeVector<Queue*> queues_;
|
||||||
MaxSizeVector<unsigned> coprimes_;
|
MaxSizeVector<unsigned> coprimes_;
|
||||||
@ -167,36 +175,62 @@ class NonBlockingThreadPoolTempl : public Eigen::ThreadPoolInterface {
|
|||||||
pt->thread_id = thread_id;
|
pt->thread_id = thread_id;
|
||||||
Queue* q = queues_[thread_id];
|
Queue* q = queues_[thread_id];
|
||||||
EventCount::Waiter* waiter = &waiters_[thread_id];
|
EventCount::Waiter* waiter = &waiters_[thread_id];
|
||||||
while (!cancelled_) {
|
// TODO(dvyukov,rmlarsen): The time spent in Steal() is proportional
|
||||||
Task t = q->PopFront();
|
// to num_threads_ and we assume that new work is scheduled at a
|
||||||
if (!t.f) {
|
// constant rate, so we set spin_count to 5000 / num_threads_. The
|
||||||
t = Steal();
|
// constant was picked based on a fair dice roll, tune it.
|
||||||
|
const int spin_count =
|
||||||
|
allow_spinning_ && num_threads_ > 0 ? 5000 / num_threads_ : 0;
|
||||||
|
if (num_threads_ == 1) {
|
||||||
|
// For num_threads_ == 1 there is no point in going through the expensive
|
||||||
|
// steal loop. Moreover, since Steal() calls PopBack() on the victim
|
||||||
|
// queues it might reverse the order in which ops are executed compared to
|
||||||
|
// the order in which they are scheduled, which tends to be
|
||||||
|
// counter-productive for the types of I/O workloads the single thread
|
||||||
|
// pools tend to be used for.
|
||||||
|
while (!cancelled_) {
|
||||||
|
Task t = q->PopFront();
|
||||||
|
for (int i = 0; i < spin_count && !t.f; i++) {
|
||||||
|
if (!cancelled_.load(std::memory_order_relaxed)) {
|
||||||
|
t = q->PopFront();
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!t.f) {
|
if (!t.f) {
|
||||||
// Leave one thread spinning. This reduces latency.
|
if (!WaitForWork(waiter, &t)) {
|
||||||
// TODO(dvyukov): 1000 iterations is based on fair dice roll, tune it.
|
return;
|
||||||
// Also, the time it takes to attempt to steal work 1000 times depends
|
}
|
||||||
// on the size of the thread pool. However the speed at which the user
|
}
|
||||||
// of the thread pool submit tasks is independent of the size of the
|
if (t.f) {
|
||||||
// pool. Consider a time based limit instead.
|
env_.ExecuteTask(t);
|
||||||
if (!spinning_ && !spinning_.exchange(true)) {
|
}
|
||||||
for (int i = 0; i < 1000 && !t.f; i++) {
|
}
|
||||||
if (!cancelled_.load(std::memory_order_relaxed)) {
|
} else {
|
||||||
t = Steal();
|
while (!cancelled_) {
|
||||||
} else {
|
Task t = q->PopFront();
|
||||||
|
if (!t.f) {
|
||||||
|
t = Steal();
|
||||||
|
if (!t.f) {
|
||||||
|
// Leave one thread spinning. This reduces latency.
|
||||||
|
if (allow_spinning_ && !spinning_ && !spinning_.exchange(true)) {
|
||||||
|
for (int i = 0; i < spin_count && !t.f; i++) {
|
||||||
|
if (!cancelled_.load(std::memory_order_relaxed)) {
|
||||||
|
t = Steal();
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spinning_ = false;
|
||||||
|
}
|
||||||
|
if (!t.f) {
|
||||||
|
if (!WaitForWork(waiter, &t)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
spinning_ = false;
|
|
||||||
}
|
|
||||||
if (!t.f) {
|
|
||||||
if (!WaitForWork(waiter, &t)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (t.f) {
|
||||||
if (t.f) {
|
env_.ExecuteTask(t);
|
||||||
env_.ExecuteTask(t);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -244,7 +278,7 @@ class NonBlockingThreadPoolTempl : public Eigen::ThreadPoolInterface {
|
|||||||
// If we are shutting down and all worker threads blocked without work,
|
// If we are shutting down and all worker threads blocked without work,
|
||||||
// that's we are done.
|
// that's we are done.
|
||||||
blocked_++;
|
blocked_++;
|
||||||
if (done_ && blocked_ == threads_.size()) {
|
if (done_ && blocked_ == num_threads_) {
|
||||||
ec_.CancelWait(waiter);
|
ec_.CancelWait(waiter);
|
||||||
// Almost done, but need to re-check queues.
|
// Almost done, but need to re-check queues.
|
||||||
// Consider that all queues are empty and all worker threads are preempted
|
// Consider that all queues are empty and all worker threads are preempted
|
||||||
|
@ -169,6 +169,7 @@ template <typename T> class array<T, 0> {
|
|||||||
|
|
||||||
#if EIGEN_HAS_VARIADIC_TEMPLATES
|
#if EIGEN_HAS_VARIADIC_TEMPLATES
|
||||||
EIGEN_DEVICE_FUNC array(std::initializer_list<T> l) : dummy() {
|
EIGEN_DEVICE_FUNC array(std::initializer_list<T> l) : dummy() {
|
||||||
|
EIGEN_UNUSED_VARIABLE(l);
|
||||||
eigen_assert(l.size() == 0);
|
eigen_assert(l.size() == 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -108,7 +108,9 @@ class AutoDiffScalar
|
|||||||
template<typename OtherDerType>
|
template<typename OtherDerType>
|
||||||
AutoDiffScalar(const AutoDiffScalar<OtherDerType>& other
|
AutoDiffScalar(const AutoDiffScalar<OtherDerType>& other
|
||||||
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||||
, typename internal::enable_if<internal::is_same<Scalar, typename internal::traits<typename internal::remove_all<OtherDerType>::type>::Scalar>::value,void*>::type = 0
|
, typename internal::enable_if<
|
||||||
|
internal::is_same<Scalar, typename internal::traits<typename internal::remove_all<OtherDerType>::type>::Scalar>::value
|
||||||
|
&& internal::is_convertible<OtherDerType,DerType>::value , void*>::type = 0
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
: m_value(other.value()), m_derivatives(other.derivatives())
|
: m_value(other.value()), m_derivatives(other.derivatives())
|
||||||
|
@ -23,11 +23,11 @@ static void test_create_destroy_empty_pool()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void test_parallelism()
|
static void test_parallelism(bool allow_spinning)
|
||||||
{
|
{
|
||||||
// Test we never-ever fail to match available tasks with idle threads.
|
// Test we never-ever fail to match available tasks with idle threads.
|
||||||
const int kThreads = 16; // code below expects that this is a multiple of 4
|
const int kThreads = 16; // code below expects that this is a multiple of 4
|
||||||
NonBlockingThreadPool tp(kThreads);
|
NonBlockingThreadPool tp(kThreads, allow_spinning);
|
||||||
VERIFY_IS_EQUAL(tp.NumThreads(), kThreads);
|
VERIFY_IS_EQUAL(tp.NumThreads(), kThreads);
|
||||||
VERIFY_IS_EQUAL(tp.CurrentThreadId(), -1);
|
VERIFY_IS_EQUAL(tp.CurrentThreadId(), -1);
|
||||||
for (int iter = 0; iter < 100; ++iter) {
|
for (int iter = 0; iter < 100; ++iter) {
|
||||||
@ -119,6 +119,7 @@ static void test_cancel()
|
|||||||
void test_cxx11_non_blocking_thread_pool()
|
void test_cxx11_non_blocking_thread_pool()
|
||||||
{
|
{
|
||||||
CALL_SUBTEST(test_create_destroy_empty_pool());
|
CALL_SUBTEST(test_create_destroy_empty_pool());
|
||||||
CALL_SUBTEST(test_parallelism());
|
CALL_SUBTEST(test_parallelism(true));
|
||||||
|
CALL_SUBTEST(test_parallelism(false));
|
||||||
CALL_SUBTEST(test_cancel());
|
CALL_SUBTEST(test_cancel());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user