mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-15 02:43:14 +08:00
* Give Konstantinos a copyright line
* Fix compilation of Inverse.h with vectorisation * Introduce EIGEN_GNUC_AT_LEAST(x,y) macro doing future-proof (e.g. gcc v5.0) check * Only use ProductWIP if vectorisation is enabled * rename EIGEN_ALWAYS_INLINE -> EIGEN_INLINE with fall-back to inline keyword * some cleanup/indentation
This commit is contained in:
parent
4f6d7abc87
commit
3562b01105
45
Eigen/Core
45
Eigen/Core
@ -3,26 +3,31 @@
|
||||
|
||||
#define EIGEN_WIP_PRODUCT
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define EIGEN_GNUC_AT_LEAST(x,y) (__GNUC__>=x && __GNUC_MINOR__>=y) || __GNUC__>x
|
||||
#else
|
||||
#define EIGEN_GNUC_AT_LEAST(x,y) false
|
||||
#endif
|
||||
|
||||
#ifndef EIGEN_DONT_VECTORIZE
|
||||
#if ((defined __SSE2__) && ( (!defined __GNUC__) || (__GNUC__>=4 && __GNUC_MINOR__>=2)))
|
||||
#define EIGEN_VECTORIZE
|
||||
#define EIGEN_VECTORIZE_SSE
|
||||
#include <emmintrin.h>
|
||||
#include <xmmintrin.h>
|
||||
#ifdef __SSE3__
|
||||
#include <pmmintrin.h>
|
||||
#endif
|
||||
//#ifdef __SSSE3__
|
||||
//#include <tmmintrin.h>
|
||||
//#endif
|
||||
#endif
|
||||
#ifdef __ALTIVEC__ // There are zero chances of both __SSE2__ AND __ALTIVEC__ been defined
|
||||
#define EIGEN_VECTORIZE
|
||||
#define EIGEN_VECTORIZE_ALTIVEC
|
||||
#include <altivec.h>
|
||||
// We _need_ to #undef bool as it's defined in <altivec.h> for some reason.
|
||||
#undef bool
|
||||
#endif
|
||||
#if (defined __SSE2__) && ( (!defined __GNUC__) || EIGEN_GNUC_AT_LEAST(4,2) )
|
||||
#define EIGEN_VECTORIZE
|
||||
#define EIGEN_VECTORIZE_SSE
|
||||
#include <emmintrin.h>
|
||||
#include <xmmintrin.h>
|
||||
#ifdef __SSE3__
|
||||
#include <pmmintrin.h>
|
||||
#endif
|
||||
//#ifdef __SSSE3__
|
||||
//#include <tmmintrin.h>
|
||||
//#endif
|
||||
#elif (defined __ALTIVEC__)
|
||||
#define EIGEN_VECTORIZE
|
||||
#define EIGEN_VECTORIZE_ALTIVEC
|
||||
#include <altivec.h>
|
||||
// We _need_ to #undef bool as it's defined in <altivec.h> for some reason.
|
||||
#undef bool
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
@ -63,7 +68,7 @@ namespace Eigen {
|
||||
#include "src/Core/CwiseBinaryOp.h"
|
||||
#include "src/Core/CwiseUnaryOp.h"
|
||||
#include "src/Core/CwiseNullaryOp.h"
|
||||
#ifdef EIGEN_WIP_PRODUCT
|
||||
#if (defined EIGEN_WIP_PRODUCT) && (defined EIGEN_VECTORIZE)
|
||||
#include "src/Core/ProductWIP.h"
|
||||
#else
|
||||
#include "src/Core/Product.h"
|
||||
|
@ -184,7 +184,6 @@ struct ei_assignment_impl<Derived, OtherDerived, true, false>
|
||||
static void execute(Derived & dst, const OtherDerived & src)
|
||||
{
|
||||
const bool unroll = Derived::SizeAtCompileTime * OtherDerived::CoeffReadCost <= EIGEN_UNROLLING_LIMIT;
|
||||
ei_assert(dst.rows() == src.rows() && dst.cols() == src.cols());
|
||||
if(unroll)
|
||||
{
|
||||
// std::cout << "vectorized unrolled\n";
|
||||
|
@ -45,8 +45,8 @@ inline int ei_exp(int) { ei_assert(false); return 0; }
|
||||
inline int ei_log(int) { ei_assert(false); return 0; }
|
||||
inline int ei_sin(int) { ei_assert(false); return 0; }
|
||||
inline int ei_cos(int) { ei_assert(false); return 0; }
|
||||
// FIXME naive GCC version test, e.g. 5.0 would not pass
|
||||
#if (defined __ICC) || (defined __GNUC__ && (__GNUC__<4 || __GNUC_MINOR__<3))
|
||||
|
||||
#if EIGEN_GNUC_AT_LEAST(4,3)
|
||||
inline int ei_pow(int x, int y) { return int(std::pow(double(x), y)); }
|
||||
#else
|
||||
inline int ei_pow(int x, int y) { return std::pow(x, y); }
|
||||
|
@ -409,7 +409,7 @@ template<typename Derived> class MatrixBase
|
||||
template<typename NewType>
|
||||
const CwiseUnaryOp<ei_scalar_cast_op<typename ei_traits<Derived>::Scalar, NewType>, Derived> cast() const;
|
||||
|
||||
const typename ei_eval<Derived>::type eval() const EIGEN_ALWAYS_INLINE
|
||||
EIGEN_INLINE const typename ei_eval<Derived>::type eval() const
|
||||
{
|
||||
return typename ei_eval<Derived>::type(derived());
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
// This file is part of Eigen, a lightweight C++ template library
|
||||
// for linear algebra. Eigen itself is part of the KDE project.
|
||||
//
|
||||
// Copyright (C) 2008 Konstantinos Margaritis <markos@codex.gr>
|
||||
// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
|
||||
//
|
||||
// Eigen is free software; you can redistribute it and/or
|
||||
@ -29,10 +30,7 @@
|
||||
#error include PacketMath_Altivec without EIGEN_VECTORIZE_ALTIVEC
|
||||
#endif
|
||||
|
||||
#ifdef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD
|
||||
#undef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD
|
||||
#define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 4
|
||||
#endif
|
||||
|
||||
static const vector int v0i = vec_splat_u32(0);
|
||||
static const vector int v16i_ = vec_splat_u32(-16);
|
||||
|
@ -85,10 +85,10 @@ using Eigen::MatrixBase;
|
||||
// gcc 3.4.x reports the following compilation error:
|
||||
// Eval.h:91: sorry, unimplemented: inlining failed in call to 'const Eigen::Eval<Derived> Eigen::MatrixBase<Scalar, Derived>::eval() const'
|
||||
// : function body not available
|
||||
#if (defined __GNUC__) && (__GNUC__!=3)
|
||||
#define EIGEN_ALWAYS_INLINE __attribute__((always_inline))
|
||||
#if EIGEN_GNUC_AT_LEAST(4,0)
|
||||
#define EIGEN_INLINE __attribute__((always_inline))
|
||||
#else
|
||||
#define EIGEN_ALWAYS_INLINE
|
||||
#define EIGEN_INLINE inline
|
||||
#endif
|
||||
|
||||
#if (defined __GNUC__)
|
||||
|
@ -84,9 +84,10 @@ template<typename MatrixType, bool CheckExistence> class Inverse : ei_no_assignm
|
||||
return m_inverse.coeff(row, col);
|
||||
}
|
||||
|
||||
template<int LoadMode>
|
||||
PacketScalar _packetCoeff(int row, int col) const
|
||||
{
|
||||
return m_inverse.packetCoeff(row, col);
|
||||
return m_inverse.template packetCoeff<LoadMode>(row, col);
|
||||
}
|
||||
|
||||
enum { _Size = MatrixType::RowsAtCompileTime };
|
||||
|
Loading…
x
Reference in New Issue
Block a user