mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-05-01 00:04:14 +08:00
Merged eigen/eigen into default
This commit is contained in:
commit
2bfece5cd1
@ -380,7 +380,7 @@ else()
|
||||
)
|
||||
endif()
|
||||
set(CMAKEPACKAGE_INSTALL_DIR
|
||||
"${CMAKE_INSTALL_LIBDIR}/cmake/eigen3"
|
||||
"${CMAKE_INSTALL_DATADIR}/eigen3/cmake"
|
||||
CACHE PATH "The directory relative to CMAKE_PREFIX_PATH where Eigen3Config.cmake is installed"
|
||||
)
|
||||
set(PKGCONFIG_INSTALL_DIR
|
||||
@ -510,15 +510,66 @@ set ( EIGEN_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}" )
|
||||
set ( EIGEN_INCLUDE_DIRS ${EIGEN_INCLUDE_DIR} )
|
||||
set ( EIGEN_ROOT_DIR ${CMAKE_INSTALL_PREFIX} )
|
||||
|
||||
configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Eigen3Config.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/Eigen3Config.cmake
|
||||
@ONLY ESCAPE_QUOTES
|
||||
)
|
||||
# Interface libraries require at least CMake 3.0
|
||||
if (NOT CMAKE_VERSION VERSION_LESS 3.0)
|
||||
include (CMakePackageConfigHelpers)
|
||||
|
||||
install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/UseEigen3.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/Eigen3Config.cmake
|
||||
DESTINATION ${CMAKEPACKAGE_INSTALL_DIR}
|
||||
)
|
||||
# Imported target support
|
||||
add_library (eigen INTERFACE)
|
||||
|
||||
target_compile_definitions (eigen INTERFACE ${EIGEN_DEFINITIONS})
|
||||
target_include_directories (eigen INTERFACE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>
|
||||
)
|
||||
|
||||
# Export as title case Eigen
|
||||
set_target_properties (eigen PROPERTIES EXPORT_NAME Eigen)
|
||||
|
||||
install (TARGETS eigen EXPORT Eigen3Targets)
|
||||
|
||||
configure_package_config_file (
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/Eigen3Config.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/Eigen3Config.cmake
|
||||
INSTALL_DESTINATION ${CMAKEPACKAGE_INSTALL_DIR}
|
||||
NO_CHECK_REQUIRED_COMPONENTS_MACRO # Eigen does not provide components
|
||||
)
|
||||
# Remove CMAKE_SIZEOF_VOID_P from Eigen3ConfigVersion.cmake since Eigen does
|
||||
# not depend on architecture specific settings or libraries. More
|
||||
# specifically, an Eigen3Config.cmake generated from a 64 bit target can be
|
||||
# used for 32 bit targets as well (and vice versa).
|
||||
set (_Eigen3_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
|
||||
unset (CMAKE_SIZEOF_VOID_P)
|
||||
write_basic_package_version_file (Eigen3ConfigVersion.cmake
|
||||
VERSION ${EIGEN_VERSION_NUMBER} COMPATIBILITY SameMajorVersion)
|
||||
set (CMAKE_SIZEOF_VOID_P ${_Eigen3_CMAKE_SIZEOF_VOID_P})
|
||||
|
||||
# The Eigen target will be located in the Eigen3 namespace. Other CMake
|
||||
# targets can refer to it using Eigen3::Eigen.
|
||||
export (TARGETS eigen NAMESPACE Eigen3:: FILE Eigen3Targets.cmake)
|
||||
# Export Eigen3 package to CMake registry such that it can be easily found by
|
||||
# CMake even if it has not been installed to a standard directory.
|
||||
export (PACKAGE Eigen3)
|
||||
|
||||
install (EXPORT Eigen3Targets NAMESPACE Eigen3:: DESTINATION
|
||||
${CMAKEPACKAGE_INSTALL_DIR})
|
||||
install (FILES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/Eigen3Config.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/Eigen3ConfigVersion.cmake
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/UseEigen3.cmake
|
||||
DESTINATION ${CMAKEPACKAGE_INSTALL_DIR})
|
||||
else (NOT CMAKE_VERSION VERSION_LESS 3.0)
|
||||
# Fallback to legacy Eigen3Config.cmake without the imported target
|
||||
configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Eigen3ConfigLegacy.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/Eigen3Config.cmake
|
||||
@ONLY ESCAPE_QUOTES
|
||||
)
|
||||
|
||||
install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/UseEigen3.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/Eigen3Config.cmake
|
||||
DESTINATION ${CMAKEPACKAGE_INSTALL_DIR}
|
||||
)
|
||||
endif (NOT CMAKE_VERSION VERSION_LESS 3.0)
|
||||
|
||||
# Add uninstall target
|
||||
add_custom_target ( uninstall
|
||||
|
@ -70,9 +70,11 @@ MatrixBase<Derived>::dot(const MatrixBase<OtherDerived>& other) const
|
||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
|
||||
EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived)
|
||||
#if !(defined(EIGEN_NO_STATIC_ASSERT) && defined(EIGEN_NO_DEBUG))
|
||||
typedef internal::scalar_conj_product_op<Scalar,typename OtherDerived::Scalar> func;
|
||||
EIGEN_CHECK_BINARY_COMPATIBILIY(func,Scalar,typename OtherDerived::Scalar);
|
||||
|
||||
#endif
|
||||
|
||||
eigen_assert(size() == other.size());
|
||||
|
||||
return internal::dot_nocheck<Derived,OtherDerived>::run(*this, other);
|
||||
|
@ -224,50 +224,65 @@ template<> struct gemv_dense_selector<OnTheRight,ColMajor,true>
|
||||
// on, the other hand it is good for the cache to pack the vector anyways...
|
||||
EvalToDestAtCompileTime = (ActualDest::InnerStrideAtCompileTime==1),
|
||||
ComplexByReal = (NumTraits<LhsScalar>::IsComplex) && (!NumTraits<RhsScalar>::IsComplex),
|
||||
MightCannotUseDest = (ActualDest::InnerStrideAtCompileTime!=1) || ComplexByReal
|
||||
MightCannotUseDest = (!EvalToDestAtCompileTime) || ComplexByReal
|
||||
};
|
||||
|
||||
gemv_static_vector_if<ResScalar,ActualDest::SizeAtCompileTime,ActualDest::MaxSizeAtCompileTime,MightCannotUseDest> static_dest;
|
||||
|
||||
const bool alphaIsCompatible = (!ComplexByReal) || (numext::imag(actualAlpha)==RealScalar(0));
|
||||
const bool evalToDest = EvalToDestAtCompileTime && alphaIsCompatible;
|
||||
|
||||
RhsScalar compatibleAlpha = get_factor<ResScalar,RhsScalar>::run(actualAlpha);
|
||||
|
||||
ei_declare_aligned_stack_constructed_variable(ResScalar,actualDestPtr,dest.size(),
|
||||
evalToDest ? dest.data() : static_dest.data());
|
||||
|
||||
if(!evalToDest)
|
||||
{
|
||||
#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
|
||||
Index size = dest.size();
|
||||
EIGEN_DENSE_STORAGE_CTOR_PLUGIN
|
||||
#endif
|
||||
if(!alphaIsCompatible)
|
||||
{
|
||||
MappedDest(actualDestPtr, dest.size()).setZero();
|
||||
compatibleAlpha = RhsScalar(1);
|
||||
}
|
||||
else
|
||||
MappedDest(actualDestPtr, dest.size()) = dest;
|
||||
}
|
||||
|
||||
typedef const_blas_data_mapper<LhsScalar,Index,ColMajor> LhsMapper;
|
||||
typedef const_blas_data_mapper<RhsScalar,Index,RowMajor> RhsMapper;
|
||||
general_matrix_vector_product
|
||||
<Index,LhsScalar,LhsMapper,ColMajor,LhsBlasTraits::NeedToConjugate,RhsScalar,RhsMapper,RhsBlasTraits::NeedToConjugate>::run(
|
||||
actualLhs.rows(), actualLhs.cols(),
|
||||
LhsMapper(actualLhs.data(), actualLhs.outerStride()),
|
||||
RhsMapper(actualRhs.data(), actualRhs.innerStride()),
|
||||
actualDestPtr, 1,
|
||||
compatibleAlpha);
|
||||
RhsScalar compatibleAlpha = get_factor<ResScalar,RhsScalar>::run(actualAlpha);
|
||||
|
||||
if (!evalToDest)
|
||||
if(!MightCannotUseDest)
|
||||
{
|
||||
if(!alphaIsCompatible)
|
||||
dest.matrix() += actualAlpha * MappedDest(actualDestPtr, dest.size());
|
||||
else
|
||||
dest = MappedDest(actualDestPtr, dest.size());
|
||||
// shortcut if we are sure to be able to use dest directly,
|
||||
// this ease the compiler to generate cleaner and more optimzized code for most common cases
|
||||
general_matrix_vector_product
|
||||
<Index,LhsScalar,LhsMapper,ColMajor,LhsBlasTraits::NeedToConjugate,RhsScalar,RhsMapper,RhsBlasTraits::NeedToConjugate>::run(
|
||||
actualLhs.rows(), actualLhs.cols(),
|
||||
LhsMapper(actualLhs.data(), actualLhs.outerStride()),
|
||||
RhsMapper(actualRhs.data(), actualRhs.innerStride()),
|
||||
dest.data(), 1,
|
||||
compatibleAlpha);
|
||||
}
|
||||
else
|
||||
{
|
||||
gemv_static_vector_if<ResScalar,ActualDest::SizeAtCompileTime,ActualDest::MaxSizeAtCompileTime,MightCannotUseDest> static_dest;
|
||||
|
||||
const bool alphaIsCompatible = (!ComplexByReal) || (numext::imag(actualAlpha)==RealScalar(0));
|
||||
const bool evalToDest = EvalToDestAtCompileTime && alphaIsCompatible;
|
||||
|
||||
ei_declare_aligned_stack_constructed_variable(ResScalar,actualDestPtr,dest.size(),
|
||||
evalToDest ? dest.data() : static_dest.data());
|
||||
|
||||
if(!evalToDest)
|
||||
{
|
||||
#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
|
||||
Index size = dest.size();
|
||||
EIGEN_DENSE_STORAGE_CTOR_PLUGIN
|
||||
#endif
|
||||
if(!alphaIsCompatible)
|
||||
{
|
||||
MappedDest(actualDestPtr, dest.size()).setZero();
|
||||
compatibleAlpha = RhsScalar(1);
|
||||
}
|
||||
else
|
||||
MappedDest(actualDestPtr, dest.size()) = dest;
|
||||
}
|
||||
|
||||
general_matrix_vector_product
|
||||
<Index,LhsScalar,LhsMapper,ColMajor,LhsBlasTraits::NeedToConjugate,RhsScalar,RhsMapper,RhsBlasTraits::NeedToConjugate>::run(
|
||||
actualLhs.rows(), actualLhs.cols(),
|
||||
LhsMapper(actualLhs.data(), actualLhs.outerStride()),
|
||||
RhsMapper(actualRhs.data(), actualRhs.innerStride()),
|
||||
actualDestPtr, 1,
|
||||
compatibleAlpha);
|
||||
|
||||
if (!evalToDest)
|
||||
{
|
||||
if(!alphaIsCompatible)
|
||||
dest.matrix() += actualAlpha * MappedDest(actualDestPtr, dest.size());
|
||||
else
|
||||
dest = MappedDest(actualDestPtr, dest.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -763,6 +763,7 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
|
||||
{
|
||||
// NOTE MSVC 2008 complains if we directly put bool(NumTraits<T>::IsInteger) as the EIGEN_STATIC_ASSERT argument.
|
||||
const bool is_integer = NumTraits<T>::IsInteger;
|
||||
EIGEN_UNUSED_VARIABLE(is_integer);
|
||||
EIGEN_STATIC_ASSERT(is_integer,
|
||||
FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED)
|
||||
resize(size);
|
||||
|
@ -158,10 +158,7 @@ struct Assignment<DstXprType, Product<Lhs,Rhs,Options>, internal::add_assign_op<
|
||||
static EIGEN_STRONG_INLINE
|
||||
void run(DstXprType &dst, const SrcXprType &src, const internal::add_assign_op<Scalar,Scalar> &)
|
||||
{
|
||||
Index dstRows = src.rows();
|
||||
Index dstCols = src.cols();
|
||||
if((dst.rows()!=dstRows) || (dst.cols()!=dstCols))
|
||||
dst.resize(dstRows, dstCols);
|
||||
eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols());
|
||||
// FIXME shall we handle nested_eval here?
|
||||
generic_product_impl<Lhs, Rhs>::addTo(dst, src.lhs(), src.rhs());
|
||||
}
|
||||
@ -176,10 +173,7 @@ struct Assignment<DstXprType, Product<Lhs,Rhs,Options>, internal::sub_assign_op<
|
||||
static EIGEN_STRONG_INLINE
|
||||
void run(DstXprType &dst, const SrcXprType &src, const internal::sub_assign_op<Scalar,Scalar> &)
|
||||
{
|
||||
Index dstRows = src.rows();
|
||||
Index dstCols = src.cols();
|
||||
if((dst.rows()!=dstRows) || (dst.cols()!=dstCols))
|
||||
dst.resize(dstRows, dstCols);
|
||||
eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols());
|
||||
// FIXME shall we handle nested_eval here?
|
||||
generic_product_impl<Lhs, Rhs>::subTo(dst, src.lhs(), src.rhs());
|
||||
}
|
||||
@ -377,7 +371,6 @@ struct generic_product_impl<Lhs,Rhs,DenseShape,DenseShape,GemvProduct>
|
||||
{
|
||||
LhsNested actual_lhs(lhs);
|
||||
RhsNested actual_rhs(rhs);
|
||||
|
||||
internal::gemv_dense_selector<Side,
|
||||
(int(MatrixType::Flags)&RowMajorBit) ? RowMajor : ColMajor,
|
||||
bool(internal::blas_traits<MatrixType>::HasUsableDirectAccess)
|
||||
|
@ -53,7 +53,7 @@ namespace half_impl {
|
||||
|
||||
// Make our own __half definition that is similar to CUDA's.
|
||||
struct __half {
|
||||
EIGEN_DEVICE_FUNC __half() {}
|
||||
EIGEN_DEVICE_FUNC __half() : x(0) {}
|
||||
explicit EIGEN_DEVICE_FUNC __half(unsigned short raw) : x(raw) {}
|
||||
unsigned short x;
|
||||
};
|
||||
|
@ -523,7 +523,7 @@ template<typename T> struct smart_memmove_helper<T,true> {
|
||||
template<typename T> struct smart_memmove_helper<T,false> {
|
||||
static inline void run(const T* start, const T* end, T* target)
|
||||
{
|
||||
if (uintptr_t(target) < uintptr_t(start))
|
||||
if (UIntPtr(target) < UIntPtr(start))
|
||||
{
|
||||
std::copy(start, end, target);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -261,8 +261,8 @@ class SparseCompressedBase<Derived>::ReverseInnerIterator
|
||||
const StorageIndex* m_indices;
|
||||
typedef internal::variable_if_dynamic<Index,Derived::IsVectorAtCompileTime?0:Dynamic> OuterType;
|
||||
const OuterType m_outer;
|
||||
Index m_id;
|
||||
Index m_start;
|
||||
Index m_id;
|
||||
};
|
||||
|
||||
namespace internal {
|
||||
@ -273,7 +273,6 @@ struct evaluator<SparseCompressedBase<Derived> >
|
||||
{
|
||||
typedef typename Derived::Scalar Scalar;
|
||||
typedef typename Derived::InnerIterator InnerIterator;
|
||||
typedef typename Derived::ReverseInnerIterator ReverseInnerIterator;
|
||||
|
||||
enum {
|
||||
CoeffReadCost = NumTraits<Scalar>::ReadCost,
|
||||
|
@ -68,7 +68,6 @@ protected:
|
||||
typedef typename XprType::StorageIndex StorageIndex;
|
||||
public:
|
||||
|
||||
class ReverseInnerIterator;
|
||||
class InnerIterator
|
||||
{
|
||||
public:
|
||||
@ -161,7 +160,6 @@ protected:
|
||||
typedef typename XprType::StorageIndex StorageIndex;
|
||||
public:
|
||||
|
||||
class ReverseInnerIterator;
|
||||
class InnerIterator
|
||||
{
|
||||
enum { IsRowMajor = (int(Rhs::Flags)&RowMajorBit)==RowMajorBit };
|
||||
@ -249,7 +247,6 @@ protected:
|
||||
typedef typename XprType::StorageIndex StorageIndex;
|
||||
public:
|
||||
|
||||
class ReverseInnerIterator;
|
||||
class InnerIterator
|
||||
{
|
||||
enum { IsRowMajor = (int(Lhs::Flags)&RowMajorBit)==RowMajorBit };
|
||||
@ -402,7 +399,6 @@ protected:
|
||||
typedef typename traits<XprType>::Scalar Scalar;
|
||||
public:
|
||||
|
||||
class ReverseInnerIterator;
|
||||
class InnerIterator
|
||||
{
|
||||
public:
|
||||
@ -487,7 +483,6 @@ protected:
|
||||
typedef typename traits<XprType>::Scalar Scalar;
|
||||
public:
|
||||
|
||||
class ReverseInnerIterator;
|
||||
class InnerIterator
|
||||
{
|
||||
enum { IsRowMajor = (int(RhsArg::Flags)&RowMajorBit)==RowMajorBit };
|
||||
@ -561,7 +556,6 @@ protected:
|
||||
typedef typename traits<XprType>::Scalar Scalar;
|
||||
public:
|
||||
|
||||
class ReverseInnerIterator;
|
||||
class InnerIterator
|
||||
{
|
||||
enum { IsRowMajor = (int(LhsArg::Flags)&RowMajorBit)==RowMajorBit };
|
||||
|
@ -22,7 +22,6 @@ struct unary_evaluator<CwiseUnaryOp<UnaryOp,ArgType>, IteratorBased>
|
||||
typedef CwiseUnaryOp<UnaryOp, ArgType> XprType;
|
||||
|
||||
class InnerIterator;
|
||||
class ReverseInnerIterator;
|
||||
|
||||
enum {
|
||||
CoeffReadCost = evaluator<ArgType>::CoeffReadCost + functor_traits<UnaryOp>::Cost,
|
||||
@ -41,7 +40,6 @@ struct unary_evaluator<CwiseUnaryOp<UnaryOp,ArgType>, IteratorBased>
|
||||
|
||||
protected:
|
||||
typedef typename evaluator<ArgType>::InnerIterator EvalIterator;
|
||||
// typedef typename evaluator<ArgType>::ReverseInnerIterator EvalReverseIterator;
|
||||
|
||||
const UnaryOp m_functor;
|
||||
evaluator<ArgType> m_argImpl;
|
||||
@ -70,33 +68,6 @@ class unary_evaluator<CwiseUnaryOp<UnaryOp,ArgType>, IteratorBased>::InnerIterat
|
||||
Scalar& valueRef();
|
||||
};
|
||||
|
||||
// template<typename UnaryOp, typename ArgType>
|
||||
// class unary_evaluator<CwiseUnaryOp<UnaryOp,ArgType>, IteratorBased>::ReverseInnerIterator
|
||||
// : public unary_evaluator<CwiseUnaryOp<UnaryOp,ArgType>, IteratorBased>::EvalReverseIterator
|
||||
// {
|
||||
// typedef typename XprType::Scalar Scalar;
|
||||
// typedef typename unary_evaluator<CwiseUnaryOp<UnaryOp,ArgType>, IteratorBased>::EvalReverseIterator Base;
|
||||
// public:
|
||||
//
|
||||
// EIGEN_STRONG_INLINE ReverseInnerIterator(const XprType& unaryOp, typename XprType::Index outer)
|
||||
// : Base(unaryOp.derived().nestedExpression(),outer), m_functor(unaryOp.derived().functor())
|
||||
// {}
|
||||
//
|
||||
// EIGEN_STRONG_INLINE ReverseInnerIterator& operator--()
|
||||
// { Base::operator--(); return *this; }
|
||||
//
|
||||
// EIGEN_STRONG_INLINE Scalar value() const { return m_functor(Base::value()); }
|
||||
//
|
||||
// protected:
|
||||
// const UnaryOp m_functor;
|
||||
// private:
|
||||
// Scalar& valueRef();
|
||||
// };
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename ViewOp, typename ArgType>
|
||||
struct unary_evaluator<CwiseUnaryView<ViewOp,ArgType>, IteratorBased>
|
||||
: public evaluator_base<CwiseUnaryView<ViewOp,ArgType> >
|
||||
@ -105,7 +76,6 @@ struct unary_evaluator<CwiseUnaryView<ViewOp,ArgType>, IteratorBased>
|
||||
typedef CwiseUnaryView<ViewOp, ArgType> XprType;
|
||||
|
||||
class InnerIterator;
|
||||
class ReverseInnerIterator;
|
||||
|
||||
enum {
|
||||
CoeffReadCost = evaluator<ArgType>::CoeffReadCost + functor_traits<ViewOp>::Cost,
|
||||
@ -120,7 +90,6 @@ struct unary_evaluator<CwiseUnaryView<ViewOp,ArgType>, IteratorBased>
|
||||
|
||||
protected:
|
||||
typedef typename evaluator<ArgType>::InnerIterator EvalIterator;
|
||||
// typedef typename evaluator<ArgType>::ReverseInnerIterator EvalReverseIterator;
|
||||
|
||||
const ViewOp m_functor;
|
||||
evaluator<ArgType> m_argImpl;
|
||||
@ -148,29 +117,6 @@ class unary_evaluator<CwiseUnaryView<ViewOp,ArgType>, IteratorBased>::InnerItera
|
||||
const ViewOp m_functor;
|
||||
};
|
||||
|
||||
// template<typename ViewOp, typename ArgType>
|
||||
// class unary_evaluator<CwiseUnaryView<ViewOp,ArgType>, IteratorBased>::ReverseInnerIterator
|
||||
// : public unary_evaluator<CwiseUnaryView<ViewOp,ArgType>, IteratorBased>::EvalReverseIterator
|
||||
// {
|
||||
// typedef typename XprType::Scalar Scalar;
|
||||
// typedef typename unary_evaluator<CwiseUnaryView<ViewOp,ArgType>, IteratorBased>::EvalReverseIterator Base;
|
||||
// public:
|
||||
//
|
||||
// EIGEN_STRONG_INLINE ReverseInnerIterator(const XprType& unaryOp, typename XprType::Index outer)
|
||||
// : Base(unaryOp.derived().nestedExpression(),outer), m_functor(unaryOp.derived().functor())
|
||||
// {}
|
||||
//
|
||||
// EIGEN_STRONG_INLINE ReverseInnerIterator& operator--()
|
||||
// { Base::operator--(); return *this; }
|
||||
//
|
||||
// EIGEN_STRONG_INLINE Scalar value() const { return m_functor(Base::value()); }
|
||||
// EIGEN_STRONG_INLINE Scalar& valueRef() { return m_functor(Base::valueRef()); }
|
||||
//
|
||||
// protected:
|
||||
// const ViewOp m_functor;
|
||||
// };
|
||||
|
||||
|
||||
} // end namespace internal
|
||||
|
||||
template<typename Derived>
|
||||
|
@ -56,7 +56,6 @@ struct unary_evaluator<Transpose<ArgType>, IteratorBased>
|
||||
: public evaluator_base<Transpose<ArgType> >
|
||||
{
|
||||
typedef typename evaluator<ArgType>::InnerIterator EvalIterator;
|
||||
typedef typename evaluator<ArgType>::ReverseInnerIterator EvalReverseIterator;
|
||||
public:
|
||||
typedef Transpose<ArgType> XprType;
|
||||
|
||||
@ -75,17 +74,6 @@ struct unary_evaluator<Transpose<ArgType>, IteratorBased>
|
||||
Index col() const { return EvalIterator::row(); }
|
||||
};
|
||||
|
||||
class ReverseInnerIterator : public EvalReverseIterator
|
||||
{
|
||||
public:
|
||||
EIGEN_STRONG_INLINE ReverseInnerIterator(const unary_evaluator& unaryOp, Index outer)
|
||||
: EvalReverseIterator(unaryOp.m_argImpl,outer)
|
||||
{}
|
||||
|
||||
Index row() const { return EvalReverseIterator::col(); }
|
||||
Index col() const { return EvalReverseIterator::row(); }
|
||||
};
|
||||
|
||||
enum {
|
||||
CoeffReadCost = evaluator<ArgType>::CoeffReadCost,
|
||||
Flags = XprType::Flags
|
||||
|
@ -1,3 +1,3 @@
|
||||
**Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms.**
|
||||
|
||||
For more information go to http://eigen.tuxfamily.org/.
|
||||
**Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms.**
|
||||
|
||||
For more information go to http://eigen.tuxfamily.org/.
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "action_atv_product.hh"
|
||||
|
||||
#include "action_matrix_matrix_product.hh"
|
||||
// #include "action_ata_product.hh"
|
||||
#include "action_ata_product.hh"
|
||||
#include "action_aat_product.hh"
|
||||
|
||||
#include "action_trisolve.hh"
|
||||
|
@ -46,9 +46,9 @@ public :
|
||||
BLAS_FUNC(gemm)(¬rans,¬rans,&N,&N,&N,&fone,A,&N,B,&N,&fzero,X,&N);
|
||||
}
|
||||
|
||||
// static inline void ata_product(gene_matrix & A, gene_matrix & X, int N){
|
||||
// ssyrk_(&lower,&trans,&N,&N,&fone,A,&N,&fzero,X,&N);
|
||||
// }
|
||||
static inline void ata_product(gene_matrix & A, gene_matrix & X, int N){
|
||||
BLAS_FUNC(syrk)(&lower,&trans,&N,&N,&fone,A,&N,&fzero,X,&N);
|
||||
}
|
||||
|
||||
static inline void aat_product(gene_matrix & A, gene_matrix & X, int N){
|
||||
BLAS_FUNC(syrk)(&lower,¬rans,&N,&N,&fone,A,&N,&fzero,X,&N);
|
||||
|
@ -48,7 +48,7 @@ int main()
|
||||
bench<Action_rot<blas_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
|
||||
|
||||
bench<Action_matrix_matrix_product<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
// bench<Action_ata_product<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
bench<Action_ata_product<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
bench<Action_aat_product<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
|
||||
bench<Action_trisolve<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
|
@ -78,18 +78,18 @@ public :
|
||||
cible[i][j]=source[i][j];
|
||||
}
|
||||
|
||||
// static inline void ata_product(const gene_matrix & A, gene_matrix & X, int N)
|
||||
// {
|
||||
// real somme;
|
||||
// for (int j=0;j<N;j++){
|
||||
// for (int i=0;i<N;i++){
|
||||
// somme=0.0;
|
||||
// for (int k=0;k<N;k++)
|
||||
// somme += A[i][k]*A[j][k];
|
||||
// X[j][i]=somme;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
static inline void ata_product(const gene_matrix & A, gene_matrix & X, int N)
|
||||
{
|
||||
real somme;
|
||||
for (int j=0;j<N;j++){
|
||||
for (int i=0;i<N;i++){
|
||||
somme=0.0;
|
||||
for (int k=0;k<N;k++)
|
||||
somme += A[i][k]*A[j][k];
|
||||
X[j][i]=somme;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void aat_product(const gene_matrix & A, gene_matrix & X, int N)
|
||||
{
|
||||
|
@ -80,35 +80,35 @@ public :
|
||||
}
|
||||
}
|
||||
|
||||
static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){
|
||||
static EIGEN_DONT_INLINE void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){
|
||||
X = (A*B);
|
||||
}
|
||||
|
||||
static inline void transposed_matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){
|
||||
static EIGEN_DONT_INLINE void transposed_matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){
|
||||
X = (trans(A)*trans(B));
|
||||
}
|
||||
|
||||
static inline void ata_product(const gene_matrix & A, gene_matrix & X, int N){
|
||||
static EIGEN_DONT_INLINE void ata_product(const gene_matrix & A, gene_matrix & X, int N){
|
||||
X = (trans(A)*A);
|
||||
}
|
||||
|
||||
static inline void aat_product(const gene_matrix & A, gene_matrix & X, int N){
|
||||
static EIGEN_DONT_INLINE void aat_product(const gene_matrix & A, gene_matrix & X, int N){
|
||||
X = (A*trans(A));
|
||||
}
|
||||
|
||||
static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
|
||||
static EIGEN_DONT_INLINE void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
|
||||
X = (A*B);
|
||||
}
|
||||
|
||||
static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
|
||||
static EIGEN_DONT_INLINE void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
|
||||
X = (trans(A)*B);
|
||||
}
|
||||
|
||||
static inline void axpy(const real coef, const gene_vector & X, gene_vector & Y, int N){
|
||||
static EIGEN_DONT_INLINE void axpy(const real coef, const gene_vector & X, gene_vector & Y, int N){
|
||||
Y += coef * X;
|
||||
}
|
||||
|
||||
static inline void axpby(real a, const gene_vector & X, real b, gene_vector & Y, int N){
|
||||
static EIGEN_DONT_INLINE void axpby(real a, const gene_vector & X, real b, gene_vector & Y, int N){
|
||||
Y = a*X + b*Y;
|
||||
}
|
||||
|
||||
|
@ -30,9 +30,9 @@ int main()
|
||||
|
||||
bench<Action_matrix_vector_product<blaze_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
bench<Action_atv_product<blaze_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
|
||||
// bench<Action_matrix_matrix_product<blaze_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
// bench<Action_ata_product<blaze_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
// bench<Action_aat_product<blaze_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
bench<Action_matrix_matrix_product<blaze_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
bench<Action_ata_product<blaze_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
bench<Action_aat_product<blaze_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -92,9 +92,11 @@ public :
|
||||
X.noalias() = A.transpose()*B.transpose();
|
||||
}
|
||||
|
||||
// static inline void ata_product(const gene_matrix & A, gene_matrix & X, int /*N*/){
|
||||
// X.noalias() = A.transpose()*A;
|
||||
// }
|
||||
static inline void ata_product(const gene_matrix & A, gene_matrix & X, int /*N*/){
|
||||
//X.noalias() = A.transpose()*A;
|
||||
X.template triangularView<Lower>().setZero();
|
||||
X.template selfadjointView<Lower>().rankUpdate(A.transpose());
|
||||
}
|
||||
|
||||
static inline void aat_product(const gene_matrix & A, gene_matrix & X, int /*N*/){
|
||||
X.template triangularView<Lower>().setZero();
|
||||
|
@ -25,7 +25,7 @@ BTL_MAIN;
|
||||
int main()
|
||||
{
|
||||
bench<Action_matrix_matrix_product<eigen3_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
// bench<Action_ata_product<eigen3_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
bench<Action_ata_product<eigen3_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
bench<Action_aat_product<eigen3_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
bench<Action_trmm<eigen3_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
|
||||
|
||||
|
@ -59,3 +59,6 @@ before-evaluators
|
||||
9174:d228bc282ac9 # merge
|
||||
9212:c90098affa7b # Fix performance regression introduced in changeset 8aad8f35c955
|
||||
9213:9f1c14e4694b # Fix performance regression in dgemm introduced by changeset 81d53c711775
|
||||
3.3-beta2
|
||||
3.3-rc1
|
||||
3.3.0
|
||||
|
68
bench/perf_monitoring/gemm/gemv.cpp
Normal file
68
bench/perf_monitoring/gemm/gemv.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <Eigen/Core>
|
||||
#include "../../BenchTimer.h"
|
||||
using namespace Eigen;
|
||||
|
||||
#ifndef SCALAR
|
||||
#error SCALAR must be defined
|
||||
#endif
|
||||
|
||||
typedef SCALAR Scalar;
|
||||
|
||||
typedef Matrix<Scalar,Dynamic,Dynamic> Mat;
|
||||
typedef Matrix<Scalar,Dynamic,1> Vec;
|
||||
|
||||
EIGEN_DONT_INLINE
|
||||
void gemv(const Mat &A, const Vec &B, Vec &C)
|
||||
{
|
||||
C.noalias() += A * B;
|
||||
}
|
||||
|
||||
EIGEN_DONT_INLINE
|
||||
double bench(long m, long n)
|
||||
{
|
||||
Mat A(m,n);
|
||||
Vec B(n);
|
||||
Vec C(m);
|
||||
A.setRandom();
|
||||
B.setRandom();
|
||||
C.setZero();
|
||||
|
||||
BenchTimer t;
|
||||
|
||||
double up = 1e9*4/sizeof(Scalar);
|
||||
double tm0 = 4, tm1 = 10;
|
||||
if(NumTraits<Scalar>::IsComplex)
|
||||
{
|
||||
up /= 4;
|
||||
tm0 = 2;
|
||||
tm1 = 4;
|
||||
}
|
||||
|
||||
double flops = 2. * m * n;
|
||||
long rep = std::max(1., std::min(100., up/flops) );
|
||||
long tries = std::max(tm0, std::min(tm1, up/flops) );
|
||||
|
||||
BENCH(t, tries, rep, gemv(A,B,C));
|
||||
|
||||
return 1e-9 * rep * flops / t.best();
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
std::vector<double> results;
|
||||
|
||||
std::ifstream settings("gemv_settings.txt");
|
||||
long m, n;
|
||||
while(settings >> m >> n)
|
||||
{
|
||||
//std::cerr << " Testing " << m << " " << n << " " << k << std::endl;
|
||||
results.push_back( bench(m, n) );
|
||||
}
|
||||
|
||||
std::cout << RowVectorXd::Map(results.data(), results.size());
|
||||
|
||||
return 0;
|
||||
}
|
11
bench/perf_monitoring/gemm/gemv_settings.txt
Normal file
11
bench/perf_monitoring/gemm/gemv_settings.txt
Normal file
@ -0,0 +1,11 @@
|
||||
8 8
|
||||
9 9
|
||||
24 24
|
||||
239 239
|
||||
240 240
|
||||
2400 24
|
||||
24 2400
|
||||
24 240
|
||||
2400 2400
|
||||
4800 23
|
||||
23 4800
|
@ -1,28 +1,21 @@
|
||||
# -*- cmake -*-
|
||||
#
|
||||
# Eigen3Config.cmake(.in)
|
||||
# This file exports the Eigen3::Eigen CMake target which should be passed to the
|
||||
# target_link_libraries command.
|
||||
|
||||
# Use the following variables to compile and link against Eigen:
|
||||
# EIGEN3_FOUND - True if Eigen was found on your system
|
||||
# EIGEN3_USE_FILE - The file making Eigen usable
|
||||
# EIGEN3_DEFINITIONS - Definitions needed to build with Eigen
|
||||
# EIGEN3_INCLUDE_DIR - Directory where signature_of_eigen3_matrix_library can be found
|
||||
# EIGEN3_INCLUDE_DIRS - List of directories of Eigen and it's dependencies
|
||||
# EIGEN3_ROOT_DIR - The base directory of Eigen
|
||||
# EIGEN3_VERSION_STRING - A human-readable string containing the version
|
||||
# EIGEN3_VERSION_MAJOR - The major version of Eigen
|
||||
# EIGEN3_VERSION_MINOR - The minor version of Eigen
|
||||
# EIGEN3_VERSION_PATCH - The patch version of Eigen
|
||||
@PACKAGE_INIT@
|
||||
|
||||
set ( EIGEN3_FOUND 1 )
|
||||
set ( EIGEN3_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/UseEigen3.cmake" )
|
||||
include ("${CMAKE_CURRENT_LIST_DIR}/Eigen3Targets.cmake")
|
||||
|
||||
set ( EIGEN3_DEFINITIONS "@EIGEN_DEFINITIONS@" )
|
||||
set ( EIGEN3_INCLUDE_DIR "@EIGEN_INCLUDE_DIR@" )
|
||||
set ( EIGEN3_INCLUDE_DIRS "@EIGEN_INCLUDE_DIRS@" )
|
||||
set ( EIGEN3_ROOT_DIR "@EIGEN_ROOT_DIR@" )
|
||||
# Legacy variables, do *not* use. May be removed in the future.
|
||||
|
||||
set ( EIGEN3_VERSION_STRING "@EIGEN_VERSION_STRING@" )
|
||||
set ( EIGEN3_VERSION_MAJOR "@EIGEN_VERSION_MAJOR@" )
|
||||
set ( EIGEN3_VERSION_MINOR "@EIGEN_VERSION_MINOR@" )
|
||||
set ( EIGEN3_VERSION_PATCH "@EIGEN_VERSION_PATCH@" )
|
||||
set (EIGEN3_FOUND 1)
|
||||
set (EIGEN3_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/UseEigen3.cmake")
|
||||
|
||||
set (EIGEN3_DEFINITIONS "@EIGEN_DEFINITIONS@")
|
||||
set (EIGEN3_INCLUDE_DIR "@EIGEN_INCLUDE_DIR@")
|
||||
set (EIGEN3_INCLUDE_DIRS "@EIGEN_INCLUDE_DIRS@")
|
||||
set (EIGEN3_ROOT_DIR "@EIGEN_ROOT_DIR@")
|
||||
|
||||
set (EIGEN3_VERSION_STRING "@EIGEN_VERSION_STRING@")
|
||||
set (EIGEN3_VERSION_MAJOR "@EIGEN_VERSION_MAJOR@")
|
||||
set (EIGEN3_VERSION_MINOR "@EIGEN_VERSION_MINOR@")
|
||||
set (EIGEN3_VERSION_PATCH "@EIGEN_VERSION_PATCH@")
|
||||
|
28
cmake/Eigen3ConfigLegacy.cmake.in
Normal file
28
cmake/Eigen3ConfigLegacy.cmake.in
Normal file
@ -0,0 +1,28 @@
|
||||
# -*- cmake -*-
|
||||
#
|
||||
# Eigen3Config.cmake(.in)
|
||||
|
||||
# Use the following variables to compile and link against Eigen:
|
||||
# EIGEN3_FOUND - True if Eigen was found on your system
|
||||
# EIGEN3_USE_FILE - The file making Eigen usable
|
||||
# EIGEN3_DEFINITIONS - Definitions needed to build with Eigen
|
||||
# EIGEN3_INCLUDE_DIR - Directory where signature_of_eigen3_matrix_library can be found
|
||||
# EIGEN3_INCLUDE_DIRS - List of directories of Eigen and it's dependencies
|
||||
# EIGEN3_ROOT_DIR - The base directory of Eigen
|
||||
# EIGEN3_VERSION_STRING - A human-readable string containing the version
|
||||
# EIGEN3_VERSION_MAJOR - The major version of Eigen
|
||||
# EIGEN3_VERSION_MINOR - The minor version of Eigen
|
||||
# EIGEN3_VERSION_PATCH - The patch version of Eigen
|
||||
|
||||
set ( EIGEN3_FOUND 1 )
|
||||
set ( EIGEN3_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/UseEigen3.cmake" )
|
||||
|
||||
set ( EIGEN3_DEFINITIONS "@EIGEN_DEFINITIONS@" )
|
||||
set ( EIGEN3_INCLUDE_DIR "@EIGEN_INCLUDE_DIR@" )
|
||||
set ( EIGEN3_INCLUDE_DIRS "@EIGEN_INCLUDE_DIRS@" )
|
||||
set ( EIGEN3_ROOT_DIR "@EIGEN_ROOT_DIR@" )
|
||||
|
||||
set ( EIGEN3_VERSION_STRING "@EIGEN_VERSION_STRING@" )
|
||||
set ( EIGEN3_VERSION_MAJOR "@EIGEN_VERSION_MAJOR@" )
|
||||
set ( EIGEN3_VERSION_MINOR "@EIGEN_VERSION_MINOR@" )
|
||||
set ( EIGEN3_VERSION_PATCH "@EIGEN_VERSION_PATCH@" )
|
@ -26,6 +26,7 @@ namespace Eigen {
|
||||
- \subpage TopicPitfalls
|
||||
- \subpage TopicTemplateKeyword
|
||||
- \subpage UserManual_UnderstandingEigen
|
||||
- \subpage TopicCMakeGuide
|
||||
*/
|
||||
|
||||
/** \page UserManual_UnderstandingEigen Understanding Eigen
|
||||
|
49
doc/TopicCMakeGuide.dox
Normal file
49
doc/TopicCMakeGuide.dox
Normal file
@ -0,0 +1,49 @@
|
||||
namespace Eigen {
|
||||
|
||||
/**
|
||||
|
||||
\page TopicCMakeGuide Using %Eigen in CMake Projects
|
||||
|
||||
%Eigen provides native CMake support which allows the library to be easily
|
||||
used in CMake projects.
|
||||
|
||||
\note %CMake 3.0 (or later) is required to enable this functionality.
|
||||
|
||||
%Eigen exports a CMake target called `Eigen3::Eigen` which can be imported
|
||||
using the `find_package` CMake command and used by calling
|
||||
`target_link_libraries` as in the following example:
|
||||
\code{.cmake}
|
||||
cmake_minimum_required (VERSION 3.0)
|
||||
project (myproject)
|
||||
|
||||
find_package (Eigen3 3.3 REQUIRED NO_MODULE)
|
||||
|
||||
add_executable (example example.cpp)
|
||||
target_link_libraries (example Eigen3::Eigen)
|
||||
\endcode
|
||||
|
||||
The above code snippet must be placed in a file called `CMakeLists.txt` alongside
|
||||
`example.cpp`. After running
|
||||
\code{.sh}
|
||||
$ cmake path-to-example-directory
|
||||
\endcode
|
||||
CMake will produce project files that generate an executable called `example`
|
||||
which requires at least version 3.3 of %Eigen. Here, `path-to-example-directory`
|
||||
is the path to the directory that contains both `CMakeLists.txt` and
|
||||
`example.cpp`.
|
||||
|
||||
If the `REQUIRED` option is omitted when locating %Eigen using
|
||||
`find_package`, one can check whether the package was found as follows:
|
||||
\code{.cmake}
|
||||
find_package (Eigen3 3.3 NO_MODULE)
|
||||
|
||||
if (TARGET Eigen3::Eigen)
|
||||
# Use the imported target
|
||||
endif (TARGET Eigen3::Eigen)
|
||||
\endcode
|
||||
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
// vim: set ft=cpp.doxygen
|
Loading…
x
Reference in New Issue
Block a user