mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-19 08:09:36 +08:00
Many files were missing in previous changeset.
This commit is contained in:
parent
f7d5b9323d
commit
aec4814370
@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
#if EIGEN_ALIGN
|
#if EIGEN_MAX_ALIGN_BYTES>0
|
||||||
#define ALIGNMENT EIGEN_ALIGN_BYTES
|
#define ALIGNMENT EIGEN_MAX_ALIGN_BYTES
|
||||||
#else
|
#else
|
||||||
#define ALIGNMENT 1
|
#define ALIGNMENT 1
|
||||||
#endif
|
#endif
|
||||||
@ -106,7 +106,7 @@ template<typename T> void check_custom_new_delete()
|
|||||||
delete[] t;
|
delete[] t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef EIGEN_ALIGN
|
#if EIGEN_MAX_ALIGN_BYTES>0
|
||||||
{
|
{
|
||||||
T* t = static_cast<T *>((T::operator new)(sizeof(T)));
|
T* t = static_cast<T *>((T::operator new)(sizeof(T)));
|
||||||
(T::operator delete)(t, sizeof(T));
|
(T::operator delete)(t, sizeof(T));
|
||||||
@ -143,7 +143,7 @@ void test_dynalloc()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check static allocation, who knows ?
|
// check static allocation, who knows ?
|
||||||
#if EIGEN_ALIGN_STATICALLY
|
#if EIGEN_MAX_STATIC_ALIGN_BYTES
|
||||||
{
|
{
|
||||||
MyStruct foo0; VERIFY(size_t(foo0.avec.data())%ALIGNMENT==0);
|
MyStruct foo0; VERIFY(size_t(foo0.avec.data())%ALIGNMENT==0);
|
||||||
MyClassA fooA; VERIFY(size_t(fooA.avec.data())%ALIGNMENT==0);
|
MyClassA fooA; VERIFY(size_t(fooA.avec.data())%ALIGNMENT==0);
|
||||||
|
@ -155,9 +155,9 @@ template<typename Scalar> void hyperplane_alignment()
|
|||||||
typedef Hyperplane<Scalar,3,AutoAlign> Plane3a;
|
typedef Hyperplane<Scalar,3,AutoAlign> Plane3a;
|
||||||
typedef Hyperplane<Scalar,3,DontAlign> Plane3u;
|
typedef Hyperplane<Scalar,3,DontAlign> Plane3u;
|
||||||
|
|
||||||
EIGEN_ALIGN_DEFAULT Scalar array1[4];
|
EIGEN_ALIGN_MAX Scalar array1[4];
|
||||||
EIGEN_ALIGN_DEFAULT Scalar array2[4];
|
EIGEN_ALIGN_MAX Scalar array2[4];
|
||||||
EIGEN_ALIGN_DEFAULT Scalar array3[4+1];
|
EIGEN_ALIGN_MAX Scalar array3[4+1];
|
||||||
Scalar* array3u = array3+1;
|
Scalar* array3u = array3+1;
|
||||||
|
|
||||||
Plane3a *p1 = ::new(reinterpret_cast<void*>(array1)) Plane3a;
|
Plane3a *p1 = ::new(reinterpret_cast<void*>(array1)) Plane3a;
|
||||||
@ -171,7 +171,7 @@ template<typename Scalar> void hyperplane_alignment()
|
|||||||
VERIFY_IS_APPROX(p1->coeffs(), p2->coeffs());
|
VERIFY_IS_APPROX(p1->coeffs(), p2->coeffs());
|
||||||
VERIFY_IS_APPROX(p1->coeffs(), p3->coeffs());
|
VERIFY_IS_APPROX(p1->coeffs(), p3->coeffs());
|
||||||
|
|
||||||
#if defined(EIGEN_VECTORIZE) && EIGEN_ALIGN_STATICALLY
|
#if defined(EIGEN_VECTORIZE) && EIGEN_MAX_STATIC_ALIGN_BYTES > 0
|
||||||
if(internal::packet_traits<Scalar>::Vectorizable && internal::packet_traits<Scalar>::size<=4)
|
if(internal::packet_traits<Scalar>::Vectorizable && internal::packet_traits<Scalar>::size<=4)
|
||||||
VERIFY_RAISES_ASSERT((::new(reinterpret_cast<void*>(array3u)) Plane3a));
|
VERIFY_RAISES_ASSERT((::new(reinterpret_cast<void*>(array3u)) Plane3a));
|
||||||
#endif
|
#endif
|
||||||
|
@ -66,9 +66,9 @@ template<typename Scalar> void parametrizedline_alignment()
|
|||||||
typedef ParametrizedLine<Scalar,4,AutoAlign> Line4a;
|
typedef ParametrizedLine<Scalar,4,AutoAlign> Line4a;
|
||||||
typedef ParametrizedLine<Scalar,4,DontAlign> Line4u;
|
typedef ParametrizedLine<Scalar,4,DontAlign> Line4u;
|
||||||
|
|
||||||
EIGEN_ALIGN_DEFAULT Scalar array1[16];
|
EIGEN_ALIGN_MAX Scalar array1[16];
|
||||||
EIGEN_ALIGN_DEFAULT Scalar array2[16];
|
EIGEN_ALIGN_MAX Scalar array2[16];
|
||||||
EIGEN_ALIGN_DEFAULT Scalar array3[16+1];
|
EIGEN_ALIGN_MAX Scalar array3[16+1];
|
||||||
Scalar* array3u = array3+1;
|
Scalar* array3u = array3+1;
|
||||||
|
|
||||||
Line4a *p1 = ::new(reinterpret_cast<void*>(array1)) Line4a;
|
Line4a *p1 = ::new(reinterpret_cast<void*>(array1)) Line4a;
|
||||||
@ -85,7 +85,7 @@ template<typename Scalar> void parametrizedline_alignment()
|
|||||||
VERIFY_IS_APPROX(p1->direction(), p2->direction());
|
VERIFY_IS_APPROX(p1->direction(), p2->direction());
|
||||||
VERIFY_IS_APPROX(p1->direction(), p3->direction());
|
VERIFY_IS_APPROX(p1->direction(), p3->direction());
|
||||||
|
|
||||||
#if defined(EIGEN_VECTORIZE) && EIGEN_ALIGN_STATICALLY
|
#if defined(EIGEN_VECTORIZE) && EIGEN_MAX_STATIC_ALIGN_BYTES>0
|
||||||
if(internal::packet_traits<Scalar>::Vectorizable && internal::packet_traits<Scalar>::size<=4)
|
if(internal::packet_traits<Scalar>::Vectorizable && internal::packet_traits<Scalar>::size<=4)
|
||||||
VERIFY_RAISES_ASSERT((::new(reinterpret_cast<void*>(array3u)) Line4a));
|
VERIFY_RAISES_ASSERT((::new(reinterpret_cast<void*>(array3u)) Line4a));
|
||||||
#endif
|
#endif
|
||||||
|
@ -181,9 +181,9 @@ template<typename Scalar> void mapQuaternion(void){
|
|||||||
v1 = Vector3::Random();
|
v1 = Vector3::Random();
|
||||||
Scalar a = internal::random<Scalar>(-Scalar(EIGEN_PI), Scalar(EIGEN_PI));
|
Scalar a = internal::random<Scalar>(-Scalar(EIGEN_PI), Scalar(EIGEN_PI));
|
||||||
|
|
||||||
EIGEN_ALIGN_DEFAULT Scalar array1[4];
|
EIGEN_ALIGN_MAX Scalar array1[4];
|
||||||
EIGEN_ALIGN_DEFAULT Scalar array2[4];
|
EIGEN_ALIGN_MAX Scalar array2[4];
|
||||||
EIGEN_ALIGN_DEFAULT Scalar array3[4+1];
|
EIGEN_ALIGN_MAX Scalar array3[4+1];
|
||||||
Scalar* array3unaligned = array3+1;
|
Scalar* array3unaligned = array3+1;
|
||||||
|
|
||||||
MQuaternionA mq1(array1);
|
MQuaternionA mq1(array1);
|
||||||
@ -232,9 +232,9 @@ template<typename Scalar> void quaternionAlignment(void){
|
|||||||
typedef Quaternion<Scalar,AutoAlign> QuaternionA;
|
typedef Quaternion<Scalar,AutoAlign> QuaternionA;
|
||||||
typedef Quaternion<Scalar,DontAlign> QuaternionUA;
|
typedef Quaternion<Scalar,DontAlign> QuaternionUA;
|
||||||
|
|
||||||
EIGEN_ALIGN_DEFAULT Scalar array1[4];
|
EIGEN_ALIGN_MAX Scalar array1[4];
|
||||||
EIGEN_ALIGN_DEFAULT Scalar array2[4];
|
EIGEN_ALIGN_MAX Scalar array2[4];
|
||||||
EIGEN_ALIGN_DEFAULT Scalar array3[4+1];
|
EIGEN_ALIGN_MAX Scalar array3[4+1];
|
||||||
Scalar* arrayunaligned = array3+1;
|
Scalar* arrayunaligned = array3+1;
|
||||||
|
|
||||||
QuaternionA *q1 = ::new(reinterpret_cast<void*>(array1)) QuaternionA;
|
QuaternionA *q1 = ::new(reinterpret_cast<void*>(array1)) QuaternionA;
|
||||||
@ -247,7 +247,7 @@ template<typename Scalar> void quaternionAlignment(void){
|
|||||||
|
|
||||||
VERIFY_IS_APPROX(q1->coeffs(), q2->coeffs());
|
VERIFY_IS_APPROX(q1->coeffs(), q2->coeffs());
|
||||||
VERIFY_IS_APPROX(q1->coeffs(), q3->coeffs());
|
VERIFY_IS_APPROX(q1->coeffs(), q3->coeffs());
|
||||||
#if defined(EIGEN_VECTORIZE) && EIGEN_ALIGN_STATICALLY
|
#if defined(EIGEN_VECTORIZE) && EIGEN_MAX_STATIC_ALIGN_BYTES>0
|
||||||
if(internal::packet_traits<Scalar>::Vectorizable && internal::packet_traits<Scalar>::size<=4)
|
if(internal::packet_traits<Scalar>::Vectorizable && internal::packet_traits<Scalar>::size<=4)
|
||||||
VERIFY_RAISES_ASSERT((::new(reinterpret_cast<void*>(arrayunaligned)) QuaternionA));
|
VERIFY_RAISES_ASSERT((::new(reinterpret_cast<void*>(arrayunaligned)) QuaternionA));
|
||||||
#endif
|
#endif
|
||||||
|
@ -470,9 +470,9 @@ template<typename Scalar> void transform_alignment()
|
|||||||
typedef Transform<Scalar,3,Projective,AutoAlign> Projective3a;
|
typedef Transform<Scalar,3,Projective,AutoAlign> Projective3a;
|
||||||
typedef Transform<Scalar,3,Projective,DontAlign> Projective3u;
|
typedef Transform<Scalar,3,Projective,DontAlign> Projective3u;
|
||||||
|
|
||||||
EIGEN_ALIGN_DEFAULT Scalar array1[16];
|
EIGEN_ALIGN_MAX Scalar array1[16];
|
||||||
EIGEN_ALIGN_DEFAULT Scalar array2[16];
|
EIGEN_ALIGN_MAX Scalar array2[16];
|
||||||
EIGEN_ALIGN_DEFAULT Scalar array3[16+1];
|
EIGEN_ALIGN_MAX Scalar array3[16+1];
|
||||||
Scalar* array3u = array3+1;
|
Scalar* array3u = array3+1;
|
||||||
|
|
||||||
Projective3a *p1 = ::new(reinterpret_cast<void*>(array1)) Projective3a;
|
Projective3a *p1 = ::new(reinterpret_cast<void*>(array1)) Projective3a;
|
||||||
@ -488,7 +488,7 @@ template<typename Scalar> void transform_alignment()
|
|||||||
|
|
||||||
VERIFY_IS_APPROX( (*p1) * (*p1), (*p2)*(*p3));
|
VERIFY_IS_APPROX( (*p1) * (*p1), (*p2)*(*p3));
|
||||||
|
|
||||||
#if defined(EIGEN_VECTORIZE) && EIGEN_ALIGN_STATICALLY
|
#if defined(EIGEN_VECTORIZE) && EIGEN_MAX_STATIC_ALIGN_BYTES>0
|
||||||
if(internal::packet_traits<Scalar>::Vectorizable)
|
if(internal::packet_traits<Scalar>::Vectorizable)
|
||||||
VERIFY_RAISES_ASSERT((::new(reinterpret_cast<void*>(array3u)) Projective3a));
|
VERIFY_RAISES_ASSERT((::new(reinterpret_cast<void*>(array3u)) Projective3a));
|
||||||
#endif
|
#endif
|
||||||
|
@ -25,7 +25,7 @@ template<typename VectorType> void map_class_vector(const VectorType& m)
|
|||||||
Scalar* array1 = internal::aligned_new<Scalar>(size);
|
Scalar* array1 = internal::aligned_new<Scalar>(size);
|
||||||
Scalar* array2 = internal::aligned_new<Scalar>(size);
|
Scalar* array2 = internal::aligned_new<Scalar>(size);
|
||||||
Scalar* array3 = new Scalar[size+1];
|
Scalar* array3 = new Scalar[size+1];
|
||||||
Scalar* array3unaligned = size_t(array3)%EIGEN_ALIGN_BYTES == 0 ? array3+1 : array3;
|
Scalar* array3unaligned = size_t(array3)%EIGEN_MAX_ALIGN_BYTES == 0 ? array3+1 : array3;
|
||||||
Scalar array4[EIGEN_TESTMAP_MAX_SIZE];
|
Scalar array4[EIGEN_TESTMAP_MAX_SIZE];
|
||||||
|
|
||||||
Map<VectorType, Aligned>(array1, size) = VectorType::Random(size);
|
Map<VectorType, Aligned>(array1, size) = VectorType::Random(size);
|
||||||
@ -65,7 +65,7 @@ template<typename MatrixType> void map_class_matrix(const MatrixType& m)
|
|||||||
// array3unaligned -> unaligned pointer to heap
|
// array3unaligned -> unaligned pointer to heap
|
||||||
Scalar* array3 = new Scalar[size+1];
|
Scalar* array3 = new Scalar[size+1];
|
||||||
for(int i = 0; i < size+1; i++) array3[i] = Scalar(1);
|
for(int i = 0; i < size+1; i++) array3[i] = Scalar(1);
|
||||||
Scalar* array3unaligned = size_t(array3)%EIGEN_ALIGN_BYTES == 0 ? array3+1 : array3;
|
Scalar* array3unaligned = size_t(array3)%EIGEN_MAX_ALIGN_BYTES == 0 ? array3+1 : array3;
|
||||||
Scalar array4[256];
|
Scalar array4[256];
|
||||||
if(size<=256)
|
if(size<=256)
|
||||||
for(int i = 0; i < size; i++) array4[i] = Scalar(1);
|
for(int i = 0; i < size; i++) array4[i] = Scalar(1);
|
||||||
@ -129,7 +129,7 @@ template<typename VectorType> void map_static_methods(const VectorType& m)
|
|||||||
Scalar* array1 = internal::aligned_new<Scalar>(size);
|
Scalar* array1 = internal::aligned_new<Scalar>(size);
|
||||||
Scalar* array2 = internal::aligned_new<Scalar>(size);
|
Scalar* array2 = internal::aligned_new<Scalar>(size);
|
||||||
Scalar* array3 = new Scalar[size+1];
|
Scalar* array3 = new Scalar[size+1];
|
||||||
Scalar* array3unaligned = size_t(array3)%EIGEN_ALIGN_BYTES == 0 ? array3+1 : array3;
|
Scalar* array3unaligned = size_t(array3)%EIGEN_MAX_ALIGN_BYTES == 0 ? array3+1 : array3;
|
||||||
|
|
||||||
VectorType::MapAligned(array1, size) = VectorType::Random(size);
|
VectorType::MapAligned(array1, size) = VectorType::Random(size);
|
||||||
VectorType::Map(array2, size) = VectorType::Map(array1, size);
|
VectorType::Map(array2, size) = VectorType::Map(array1, size);
|
||||||
|
@ -70,7 +70,7 @@ template<int Alignment,typename MatrixType> void map_class_matrix(const MatrixTy
|
|||||||
if(Alignment!=Aligned)
|
if(Alignment!=Aligned)
|
||||||
array2 = (Scalar*)(std::ptrdiff_t(a_array2) + (internal::packet_traits<Scalar>::AlignedOnScalar?sizeof(Scalar):sizeof(typename NumTraits<Scalar>::Real)));
|
array2 = (Scalar*)(std::ptrdiff_t(a_array2) + (internal::packet_traits<Scalar>::AlignedOnScalar?sizeof(Scalar):sizeof(typename NumTraits<Scalar>::Real)));
|
||||||
else
|
else
|
||||||
array2 = (Scalar*)(((std::size_t(a_array2)+EIGEN_ALIGN_BYTES-1)/EIGEN_ALIGN_BYTES)*EIGEN_ALIGN_BYTES);
|
array2 = (Scalar*)(((std::size_t(a_array2)+EIGEN_MAX_ALIGN_BYTES-1)/EIGEN_MAX_ALIGN_BYTES)*EIGEN_MAX_ALIGN_BYTES);
|
||||||
Index maxsize2 = a_array2 - array2 + 256;
|
Index maxsize2 = a_array2 - array2 + 256;
|
||||||
|
|
||||||
// test no inner stride and some dynamic outer stride
|
// test no inner stride and some dynamic outer stride
|
||||||
|
@ -106,10 +106,10 @@ template<typename Scalar> void packetmath()
|
|||||||
|
|
||||||
const int max_size = PacketSize > 4 ? PacketSize : 4;
|
const int max_size = PacketSize > 4 ? PacketSize : 4;
|
||||||
const int size = PacketSize*max_size;
|
const int size = PacketSize*max_size;
|
||||||
EIGEN_ALIGN_DEFAULT Scalar data1[size];
|
EIGEN_ALIGN_MAX Scalar data1[size];
|
||||||
EIGEN_ALIGN_DEFAULT Scalar data2[size];
|
EIGEN_ALIGN_MAX Scalar data2[size];
|
||||||
EIGEN_ALIGN_DEFAULT Packet packets[PacketSize*2];
|
EIGEN_ALIGN_MAX Packet packets[PacketSize*2];
|
||||||
EIGEN_ALIGN_DEFAULT Scalar ref[size];
|
EIGEN_ALIGN_MAX Scalar ref[size];
|
||||||
RealScalar refvalue = 0;
|
RealScalar refvalue = 0;
|
||||||
for (int i=0; i<size; ++i)
|
for (int i=0; i<size; ++i)
|
||||||
{
|
{
|
||||||
@ -265,13 +265,13 @@ template<typename Scalar> void packetmath()
|
|||||||
if (internal::packet_traits<Scalar>::HasBlend) {
|
if (internal::packet_traits<Scalar>::HasBlend) {
|
||||||
Packet thenPacket = internal::pload<Packet>(data1);
|
Packet thenPacket = internal::pload<Packet>(data1);
|
||||||
Packet elsePacket = internal::pload<Packet>(data2);
|
Packet elsePacket = internal::pload<Packet>(data2);
|
||||||
EIGEN_ALIGN_DEFAULT internal::Selector<PacketSize> selector;
|
EIGEN_ALIGN_MAX internal::Selector<PacketSize> selector;
|
||||||
for (int i = 0; i < PacketSize; ++i) {
|
for (int i = 0; i < PacketSize; ++i) {
|
||||||
selector.select[i] = i;
|
selector.select[i] = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
Packet blend = internal::pblend(selector, thenPacket, elsePacket);
|
Packet blend = internal::pblend(selector, thenPacket, elsePacket);
|
||||||
EIGEN_ALIGN_DEFAULT Scalar result[size];
|
EIGEN_ALIGN_MAX Scalar result[size];
|
||||||
internal::pstore(result, blend);
|
internal::pstore(result, blend);
|
||||||
for (int i = 0; i < PacketSize; ++i) {
|
for (int i = 0; i < PacketSize; ++i) {
|
||||||
VERIFY(isApproxAbs(result[i], (selector.select[i] ? data1[i] : data2[i]), refvalue));
|
VERIFY(isApproxAbs(result[i], (selector.select[i] ? data1[i] : data2[i]), refvalue));
|
||||||
@ -286,9 +286,9 @@ template<typename Scalar> void packetmath_real()
|
|||||||
const int PacketSize = internal::packet_traits<Scalar>::size;
|
const int PacketSize = internal::packet_traits<Scalar>::size;
|
||||||
|
|
||||||
const int size = PacketSize*4;
|
const int size = PacketSize*4;
|
||||||
EIGEN_ALIGN_DEFAULT Scalar data1[internal::packet_traits<Scalar>::size*4];
|
EIGEN_ALIGN_MAX Scalar data1[internal::packet_traits<Scalar>::size*4];
|
||||||
EIGEN_ALIGN_DEFAULT Scalar data2[internal::packet_traits<Scalar>::size*4];
|
EIGEN_ALIGN_MAX Scalar data2[internal::packet_traits<Scalar>::size*4];
|
||||||
EIGEN_ALIGN_DEFAULT Scalar ref[internal::packet_traits<Scalar>::size*4];
|
EIGEN_ALIGN_MAX Scalar ref[internal::packet_traits<Scalar>::size*4];
|
||||||
|
|
||||||
for (int i=0; i<size; ++i)
|
for (int i=0; i<size; ++i)
|
||||||
{
|
{
|
||||||
@ -392,9 +392,9 @@ template<typename Scalar> void packetmath_notcomplex()
|
|||||||
typedef typename internal::packet_traits<Scalar>::type Packet;
|
typedef typename internal::packet_traits<Scalar>::type Packet;
|
||||||
const int PacketSize = internal::packet_traits<Scalar>::size;
|
const int PacketSize = internal::packet_traits<Scalar>::size;
|
||||||
|
|
||||||
EIGEN_ALIGN_DEFAULT Scalar data1[internal::packet_traits<Scalar>::size*4];
|
EIGEN_ALIGN_MAX Scalar data1[internal::packet_traits<Scalar>::size*4];
|
||||||
EIGEN_ALIGN_DEFAULT Scalar data2[internal::packet_traits<Scalar>::size*4];
|
EIGEN_ALIGN_MAX Scalar data2[internal::packet_traits<Scalar>::size*4];
|
||||||
EIGEN_ALIGN_DEFAULT Scalar ref[internal::packet_traits<Scalar>::size*4];
|
EIGEN_ALIGN_MAX Scalar ref[internal::packet_traits<Scalar>::size*4];
|
||||||
|
|
||||||
Array<Scalar,Dynamic,1>::Map(data1, internal::packet_traits<Scalar>::size*4).setRandom();
|
Array<Scalar,Dynamic,1>::Map(data1, internal::packet_traits<Scalar>::size*4).setRandom();
|
||||||
|
|
||||||
@ -452,10 +452,10 @@ template<typename Scalar> void packetmath_complex()
|
|||||||
const int PacketSize = internal::packet_traits<Scalar>::size;
|
const int PacketSize = internal::packet_traits<Scalar>::size;
|
||||||
|
|
||||||
const int size = PacketSize*4;
|
const int size = PacketSize*4;
|
||||||
EIGEN_ALIGN_DEFAULT Scalar data1[PacketSize*4];
|
EIGEN_ALIGN_MAX Scalar data1[PacketSize*4];
|
||||||
EIGEN_ALIGN_DEFAULT Scalar data2[PacketSize*4];
|
EIGEN_ALIGN_MAX Scalar data2[PacketSize*4];
|
||||||
EIGEN_ALIGN_DEFAULT Scalar ref[PacketSize*4];
|
EIGEN_ALIGN_MAX Scalar ref[PacketSize*4];
|
||||||
EIGEN_ALIGN_DEFAULT Scalar pval[PacketSize*4];
|
EIGEN_ALIGN_MAX Scalar pval[PacketSize*4];
|
||||||
|
|
||||||
for (int i=0; i<size; ++i)
|
for (int i=0; i<size; ++i)
|
||||||
{
|
{
|
||||||
@ -480,7 +480,7 @@ template<typename Scalar> void packetmath_scatter_gather() {
|
|||||||
typedef typename internal::packet_traits<Scalar>::type Packet;
|
typedef typename internal::packet_traits<Scalar>::type Packet;
|
||||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||||
const int PacketSize = internal::packet_traits<Scalar>::size;
|
const int PacketSize = internal::packet_traits<Scalar>::size;
|
||||||
EIGEN_ALIGN_DEFAULT Scalar data1[PacketSize];
|
EIGEN_ALIGN_MAX Scalar data1[PacketSize];
|
||||||
RealScalar refvalue = 0;
|
RealScalar refvalue = 0;
|
||||||
for (int i=0; i<PacketSize; ++i) {
|
for (int i=0; i<PacketSize; ++i) {
|
||||||
data1[i] = internal::random<Scalar>()/RealScalar(PacketSize);
|
data1[i] = internal::random<Scalar>()/RealScalar(PacketSize);
|
||||||
@ -488,7 +488,7 @@ template<typename Scalar> void packetmath_scatter_gather() {
|
|||||||
|
|
||||||
int stride = internal::random<int>(1,20);
|
int stride = internal::random<int>(1,20);
|
||||||
|
|
||||||
EIGEN_ALIGN_DEFAULT Scalar buffer[PacketSize*20];
|
EIGEN_ALIGN_MAX Scalar buffer[PacketSize*20];
|
||||||
memset(buffer, 0, 20*sizeof(Packet));
|
memset(buffer, 0, 20*sizeof(Packet));
|
||||||
Packet packet = internal::pload<Packet>(data1);
|
Packet packet = internal::pload<Packet>(data1);
|
||||||
internal::pscatter<Scalar, Packet>(buffer, packet, stride);
|
internal::pscatter<Scalar, Packet>(buffer, packet, stride);
|
||||||
|
@ -75,7 +75,7 @@ class Tensor : public TensorBase<Tensor<Scalar_, NumIndices_, Options_, IndexTyp
|
|||||||
typedef typename Base::PacketReturnType PacketReturnType;
|
typedef typename Base::PacketReturnType PacketReturnType;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
IsAligned = bool(EIGEN_ALIGN) & !(Options_&DontAlign),
|
IsAligned = bool(EIGEN_MAX_ALIGN_BYTES>0) & !(Options_&DontAlign),
|
||||||
PacketAccess = (internal::packet_traits<Scalar>::size > 1),
|
PacketAccess = (internal::packet_traits<Scalar>::size > 1),
|
||||||
Layout = Options_ & RowMajor ? RowMajor : ColMajor,
|
Layout = Options_ & RowMajor ? RowMajor : ColMajor,
|
||||||
CoordAccess = true,
|
CoordAccess = true,
|
||||||
|
@ -262,7 +262,7 @@ struct TensorEvaluator<const TensorBroadcastingOp<Broadcast, ArgType>, Device>
|
|||||||
if (innermostLoc + packetSize <= m_impl.dimensions()[0]) {
|
if (innermostLoc + packetSize <= m_impl.dimensions()[0]) {
|
||||||
return m_impl.template packet<Unaligned>(inputIndex);
|
return m_impl.template packet<Unaligned>(inputIndex);
|
||||||
} else {
|
} else {
|
||||||
EIGEN_ALIGN_DEFAULT typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
EIGEN_ALIGN_MAX typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
||||||
values[0] = m_impl.coeff(inputIndex);
|
values[0] = m_impl.coeff(inputIndex);
|
||||||
for (int i = 1; i < packetSize; ++i) {
|
for (int i = 1; i < packetSize; ++i) {
|
||||||
values[i] = coeffColMajor(originalIndex+i);
|
values[i] = coeffColMajor(originalIndex+i);
|
||||||
@ -315,7 +315,7 @@ struct TensorEvaluator<const TensorBroadcastingOp<Broadcast, ArgType>, Device>
|
|||||||
if (innermostLoc + packetSize <= m_impl.dimensions()[NumDims-1]) {
|
if (innermostLoc + packetSize <= m_impl.dimensions()[NumDims-1]) {
|
||||||
return m_impl.template packet<Unaligned>(inputIndex);
|
return m_impl.template packet<Unaligned>(inputIndex);
|
||||||
} else {
|
} else {
|
||||||
EIGEN_ALIGN_DEFAULT typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
EIGEN_ALIGN_MAX typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
||||||
values[0] = m_impl.coeff(inputIndex);
|
values[0] = m_impl.coeff(inputIndex);
|
||||||
for (int i = 1; i < packetSize; ++i) {
|
for (int i = 1; i < packetSize; ++i) {
|
||||||
values[i] = coeffRowMajor(originalIndex+i);
|
values[i] = coeffRowMajor(originalIndex+i);
|
||||||
|
@ -213,7 +213,7 @@ struct TensorEvaluator<const TensorChippingOp<DimId, ArgType>, Device>
|
|||||||
// m_stride is equal to 1, so let's avoid the integer division.
|
// m_stride is equal to 1, so let's avoid the integer division.
|
||||||
eigen_assert(m_stride == 1);
|
eigen_assert(m_stride == 1);
|
||||||
Index inputIndex = index * m_inputStride + m_inputOffset;
|
Index inputIndex = index * m_inputStride + m_inputOffset;
|
||||||
EIGEN_ALIGN_DEFAULT typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
EIGEN_ALIGN_MAX typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
||||||
for (int i = 0; i < packetSize; ++i) {
|
for (int i = 0; i < packetSize; ++i) {
|
||||||
values[i] = m_impl.coeff(inputIndex);
|
values[i] = m_impl.coeff(inputIndex);
|
||||||
inputIndex += m_inputStride;
|
inputIndex += m_inputStride;
|
||||||
@ -233,7 +233,7 @@ struct TensorEvaluator<const TensorChippingOp<DimId, ArgType>, Device>
|
|||||||
return m_impl.template packet<LoadMode>(inputIndex);
|
return m_impl.template packet<LoadMode>(inputIndex);
|
||||||
} else {
|
} else {
|
||||||
// Cross the stride boundary. Fallback to slow path.
|
// Cross the stride boundary. Fallback to slow path.
|
||||||
EIGEN_ALIGN_DEFAULT typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
EIGEN_ALIGN_MAX typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
||||||
for (int i = 0; i < packetSize; ++i) {
|
for (int i = 0; i < packetSize; ++i) {
|
||||||
values[i] = coeff(index);
|
values[i] = coeff(index);
|
||||||
++index;
|
++index;
|
||||||
@ -328,7 +328,7 @@ struct TensorEvaluator<TensorChippingOp<DimId, ArgType>, Device>
|
|||||||
(static_cast<int>(this->Layout) == static_cast<int>(RowMajor) && this->m_dim.actualDim() == NumInputDims-1)) {
|
(static_cast<int>(this->Layout) == static_cast<int>(RowMajor) && this->m_dim.actualDim() == NumInputDims-1)) {
|
||||||
// m_stride is equal to 1, so let's avoid the integer division.
|
// m_stride is equal to 1, so let's avoid the integer division.
|
||||||
eigen_assert(this->m_stride == 1);
|
eigen_assert(this->m_stride == 1);
|
||||||
EIGEN_ALIGN_DEFAULT typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
EIGEN_ALIGN_MAX typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
||||||
internal::pstore<CoeffReturnType, PacketReturnType>(values, x);
|
internal::pstore<CoeffReturnType, PacketReturnType>(values, x);
|
||||||
Index inputIndex = index * this->m_inputStride + this->m_inputOffset;
|
Index inputIndex = index * this->m_inputStride + this->m_inputOffset;
|
||||||
for (int i = 0; i < packetSize; ++i) {
|
for (int i = 0; i < packetSize; ++i) {
|
||||||
@ -348,7 +348,7 @@ struct TensorEvaluator<TensorChippingOp<DimId, ArgType>, Device>
|
|||||||
this->m_impl.template writePacket<StoreMode>(inputIndex, x);
|
this->m_impl.template writePacket<StoreMode>(inputIndex, x);
|
||||||
} else {
|
} else {
|
||||||
// Cross stride boundary. Fallback to slow path.
|
// Cross stride boundary. Fallback to slow path.
|
||||||
EIGEN_ALIGN_DEFAULT typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
EIGEN_ALIGN_MAX typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
||||||
internal::pstore<CoeffReturnType, PacketReturnType>(values, x);
|
internal::pstore<CoeffReturnType, PacketReturnType>(values, x);
|
||||||
for (int i = 0; i < packetSize; ++i) {
|
for (int i = 0; i < packetSize; ++i) {
|
||||||
this->coeffRef(index) = values[i];
|
this->coeffRef(index) = values[i];
|
||||||
|
@ -253,7 +253,7 @@ struct TensorEvaluator<const TensorConcatenationOp<Axis, LeftArgType, RightArgTy
|
|||||||
EIGEN_STATIC_ASSERT(packetSize > 1, YOU_MADE_A_PROGRAMMING_MISTAKE)
|
EIGEN_STATIC_ASSERT(packetSize > 1, YOU_MADE_A_PROGRAMMING_MISTAKE)
|
||||||
eigen_assert(index + packetSize - 1 < dimensions().TotalSize());
|
eigen_assert(index + packetSize - 1 < dimensions().TotalSize());
|
||||||
|
|
||||||
EIGEN_ALIGN_DEFAULT CoeffReturnType values[packetSize];
|
EIGEN_ALIGN_MAX CoeffReturnType values[packetSize];
|
||||||
for (int i = 0; i < packetSize; ++i) {
|
for (int i = 0; i < packetSize; ++i) {
|
||||||
values[i] = coeff(index+i);
|
values[i] = coeff(index+i);
|
||||||
}
|
}
|
||||||
@ -333,7 +333,7 @@ template<typename Axis, typename LeftArgType, typename RightArgType, typename De
|
|||||||
EIGEN_STATIC_ASSERT(packetSize > 1, YOU_MADE_A_PROGRAMMING_MISTAKE)
|
EIGEN_STATIC_ASSERT(packetSize > 1, YOU_MADE_A_PROGRAMMING_MISTAKE)
|
||||||
eigen_assert(index + packetSize - 1 < this->dimensions().TotalSize());
|
eigen_assert(index + packetSize - 1 < this->dimensions().TotalSize());
|
||||||
|
|
||||||
EIGEN_ALIGN_DEFAULT CoeffReturnType values[packetSize];
|
EIGEN_ALIGN_MAX CoeffReturnType values[packetSize];
|
||||||
internal::pstore<CoeffReturnType, PacketReturnType>(values, x);
|
internal::pstore<CoeffReturnType, PacketReturnType>(values, x);
|
||||||
for (int i = 0; i < packetSize; ++i) {
|
for (int i = 0; i < packetSize; ++i) {
|
||||||
coeffRef(index+i) = values[i];
|
coeffRef(index+i) = values[i];
|
||||||
|
@ -291,7 +291,7 @@ class TensorContractionInputMapper
|
|||||||
return this->m_tensor.template packet<Alignment>(first);
|
return this->m_tensor.template packet<Alignment>(first);
|
||||||
}
|
}
|
||||||
|
|
||||||
EIGEN_ALIGN_DEFAULT Scalar data[packet_size];
|
EIGEN_ALIGN_MAX Scalar data[packet_size];
|
||||||
|
|
||||||
data[0] = this->m_tensor.coeff(first);
|
data[0] = this->m_tensor.coeff(first);
|
||||||
for (Index k = 1; k < packet_size - 1; k += 2) {
|
for (Index k = 1; k < packet_size - 1; k += 2) {
|
||||||
@ -313,7 +313,7 @@ class TensorContractionInputMapper
|
|||||||
if (half_packet_size == packet_size) {
|
if (half_packet_size == packet_size) {
|
||||||
return loadPacket(i, j);
|
return loadPacket(i, j);
|
||||||
}
|
}
|
||||||
EIGEN_ALIGN_DEFAULT Scalar data[half_packet_size];
|
EIGEN_ALIGN_MAX Scalar data[half_packet_size];
|
||||||
for (Index k = 0; k < half_packet_size; k++) {
|
for (Index k = 0; k < half_packet_size; k++) {
|
||||||
data[k] = operator()(i + k, j);
|
data[k] = operator()(i + k, j);
|
||||||
}
|
}
|
||||||
@ -355,7 +355,7 @@ class TensorContractionInputMapper<Scalar, Index, side, Tensor, nocontract_t, co
|
|||||||
typedef typename packet_traits<Scalar>::type Packet;
|
typedef typename packet_traits<Scalar>::type Packet;
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
EIGEN_STRONG_INLINE Packet loadPacket(Index i, Index j) const {
|
EIGEN_STRONG_INLINE Packet loadPacket(Index i, Index j) const {
|
||||||
EIGEN_ALIGN_DEFAULT Scalar data[1];
|
EIGEN_ALIGN_MAX Scalar data[1];
|
||||||
data[0] = this->m_tensor.coeff(this->computeIndex(i, j));
|
data[0] = this->m_tensor.coeff(this->computeIndex(i, j));
|
||||||
return pload<typename packet_traits<Scalar>::type>(data);
|
return pload<typename packet_traits<Scalar>::type>(data);
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ struct PacketConverter<TensorEvaluator, SrcPacket, TgtPacket, 1, 2> {
|
|||||||
return internal::pcast<SrcPacket, TgtPacket>(m_impl.template packet<Unaligned>(index));
|
return internal::pcast<SrcPacket, TgtPacket>(m_impl.template packet<Unaligned>(index));
|
||||||
} else {
|
} else {
|
||||||
const int TgtPacketSize = internal::unpacket_traits<TgtPacket>::size;
|
const int TgtPacketSize = internal::unpacket_traits<TgtPacket>::size;
|
||||||
EIGEN_ALIGN_DEFAULT typename internal::unpacket_traits<TgtPacket>::type values[TgtPacketSize];
|
EIGEN_ALIGN_MAX typename internal::unpacket_traits<TgtPacket>::type values[TgtPacketSize];
|
||||||
for (int i = 0; i < TgtPacketSize; ++i) {
|
for (int i = 0; i < TgtPacketSize; ++i) {
|
||||||
values[i] = m_impl.coeff(index+i);
|
values[i] = m_impl.coeff(index+i);
|
||||||
}
|
}
|
||||||
|
@ -438,7 +438,7 @@ struct TensorEvaluator<const TensorConvolutionOp<Indices, InputArgType, KernelAr
|
|||||||
convolvePacket(startInputs[0], 0, NumKernelDims-1, result);
|
convolvePacket(startInputs[0], 0, NumKernelDims-1, result);
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
EIGEN_ALIGN_DEFAULT Scalar data[PacketSize];
|
EIGEN_ALIGN_MAX Scalar data[PacketSize];
|
||||||
data[0] = Scalar(0);
|
data[0] = Scalar(0);
|
||||||
convolve(startInputs[0], 0, NumKernelDims-1, data[0]);
|
convolve(startInputs[0], 0, NumKernelDims-1, data[0]);
|
||||||
for (int i = 1; i < PacketSize-1; ++i) {
|
for (int i = 1; i < PacketSize-1; ++i) {
|
||||||
|
@ -40,7 +40,7 @@ class TensorFixedSize : public TensorBase<TensorFixedSize<Scalar_, Dimensions_,
|
|||||||
static const int Options = Options_;
|
static const int Options = Options_;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
IsAligned = bool(EIGEN_ALIGN),
|
IsAligned = bool(EIGEN_MAX_ALIGN_BYTES>0),
|
||||||
PacketAccess = (internal::packet_traits<Scalar>::size > 1),
|
PacketAccess = (internal::packet_traits<Scalar>::size > 1),
|
||||||
Layout = Options_ & RowMajor ? RowMajor : ColMajor,
|
Layout = Options_ & RowMajor ? RowMajor : ColMajor,
|
||||||
CoordAccess = true,
|
CoordAccess = true,
|
||||||
|
@ -265,7 +265,7 @@ template <typename T> class UniformRandomGenerator {
|
|||||||
template<typename Index>
|
template<typename Index>
|
||||||
typename internal::packet_traits<T>::type packetOp(Index, Index = 0) const {
|
typename internal::packet_traits<T>::type packetOp(Index, Index = 0) const {
|
||||||
const int packetSize = internal::packet_traits<T>::size;
|
const int packetSize = internal::packet_traits<T>::size;
|
||||||
EIGEN_ALIGN_DEFAULT T values[packetSize];
|
EIGEN_ALIGN_MAX T values[packetSize];
|
||||||
for (int i = 0; i < packetSize; ++i) {
|
for (int i = 0; i < packetSize; ++i) {
|
||||||
values[i] = random<T>();
|
values[i] = random<T>();
|
||||||
}
|
}
|
||||||
@ -298,7 +298,7 @@ template <> class UniformRandomGenerator<float> {
|
|||||||
template<typename Index>
|
template<typename Index>
|
||||||
typename internal::packet_traits<float>::type packetOp(Index i, Index j = 0) const {
|
typename internal::packet_traits<float>::type packetOp(Index i, Index j = 0) const {
|
||||||
const int packetSize = internal::packet_traits<float>::size;
|
const int packetSize = internal::packet_traits<float>::size;
|
||||||
EIGEN_ALIGN_DEFAULT float values[packetSize];
|
EIGEN_ALIGN_MAX float values[packetSize];
|
||||||
for (int k = 0; k < packetSize; ++k) {
|
for (int k = 0; k < packetSize; ++k) {
|
||||||
values[k] = this->operator()(i, j);
|
values[k] = this->operator()(i, j);
|
||||||
}
|
}
|
||||||
@ -335,7 +335,7 @@ template <> class UniformRandomGenerator<double> {
|
|||||||
template<typename Index>
|
template<typename Index>
|
||||||
typename internal::packet_traits<double>::type packetOp(Index i, Index j = 0) const {
|
typename internal::packet_traits<double>::type packetOp(Index i, Index j = 0) const {
|
||||||
const int packetSize = internal::packet_traits<double>::size;
|
const int packetSize = internal::packet_traits<double>::size;
|
||||||
EIGEN_ALIGN_DEFAULT double values[packetSize];
|
EIGEN_ALIGN_MAX double values[packetSize];
|
||||||
for (int k = 0; k < packetSize; ++k) {
|
for (int k = 0; k < packetSize; ++k) {
|
||||||
values[k] = this->operator()(i, j);
|
values[k] = this->operator()(i, j);
|
||||||
}
|
}
|
||||||
@ -495,7 +495,7 @@ template <typename T> class NormalRandomGenerator {
|
|||||||
template<typename Index>
|
template<typename Index>
|
||||||
typename internal::packet_traits<T>::type packetOp(Index, Index = 0) const {
|
typename internal::packet_traits<T>::type packetOp(Index, Index = 0) const {
|
||||||
const int packetSize = internal::packet_traits<T>::size;
|
const int packetSize = internal::packet_traits<T>::size;
|
||||||
EIGEN_ALIGN_DEFAULT T values[packetSize];
|
EIGEN_ALIGN_MAX T values[packetSize];
|
||||||
for (int i = 0; i < packetSize; ++i) {
|
for (int i = 0; i < packetSize; ++i) {
|
||||||
values[i] = m_distribution(m_generator);
|
values[i] = m_distribution(m_generator);
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ struct TensorEvaluator<const TensorGeneratorOp<Generator, ArgType>, Device>
|
|||||||
EIGEN_STATIC_ASSERT(packetSize > 1, YOU_MADE_A_PROGRAMMING_MISTAKE)
|
EIGEN_STATIC_ASSERT(packetSize > 1, YOU_MADE_A_PROGRAMMING_MISTAKE)
|
||||||
eigen_assert(index+packetSize-1 < dimensions().TotalSize());
|
eigen_assert(index+packetSize-1 < dimensions().TotalSize());
|
||||||
|
|
||||||
EIGEN_ALIGN_DEFAULT typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
EIGEN_ALIGN_MAX typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
||||||
for (int i = 0; i < packetSize; ++i) {
|
for (int i = 0; i < packetSize; ++i) {
|
||||||
values[i] = coeff(index+i);
|
values[i] = coeff(index+i);
|
||||||
}
|
}
|
||||||
|
@ -493,7 +493,7 @@ struct TensorEvaluator<const TensorImagePatchOp<Rows, Cols, ArgType>, Device>
|
|||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packetWithPossibleZero(Index index) const
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packetWithPossibleZero(Index index) const
|
||||||
{
|
{
|
||||||
const int packetSize = internal::unpacket_traits<PacketReturnType>::size;
|
const int packetSize = internal::unpacket_traits<PacketReturnType>::size;
|
||||||
EIGEN_ALIGN_DEFAULT typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
EIGEN_ALIGN_MAX typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
||||||
for (int i = 0; i < packetSize; ++i) {
|
for (int i = 0; i < packetSize; ++i) {
|
||||||
values[i] = coeff(index+i);
|
values[i] = coeff(index+i);
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ struct TensorEvaluator<const TensorInflationOp<Strides, ArgType>, Device>
|
|||||||
EIGEN_STATIC_ASSERT(packetSize > 1, YOU_MADE_A_PROGRAMMING_MISTAKE)
|
EIGEN_STATIC_ASSERT(packetSize > 1, YOU_MADE_A_PROGRAMMING_MISTAKE)
|
||||||
eigen_assert(index+packetSize-1 < dimensions().TotalSize());
|
eigen_assert(index+packetSize-1 < dimensions().TotalSize());
|
||||||
|
|
||||||
EIGEN_ALIGN_DEFAULT typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
EIGEN_ALIGN_MAX typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
||||||
for (int i = 0; i < packetSize; ++i) {
|
for (int i = 0; i < packetSize; ++i) {
|
||||||
values[i] = coeff(index+i);
|
values[i] = coeff(index+i);
|
||||||
}
|
}
|
||||||
|
@ -595,7 +595,7 @@ struct TensorEvaluator<TensorSlicingOp<StartIndices, Sizes, ArgType>, Device>
|
|||||||
this->m_impl.template writePacket<StoreMode>(inputIndices[0], x);
|
this->m_impl.template writePacket<StoreMode>(inputIndices[0], x);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
EIGEN_ALIGN_DEFAULT CoeffReturnType values[packetSize];
|
EIGEN_ALIGN_MAX CoeffReturnType values[packetSize];
|
||||||
internal::pstore<CoeffReturnType, PacketReturnType>(values, x);
|
internal::pstore<CoeffReturnType, PacketReturnType>(values, x);
|
||||||
this->m_impl.coeffRef(inputIndices[0]) = values[0];
|
this->m_impl.coeffRef(inputIndices[0]) = values[0];
|
||||||
this->m_impl.coeffRef(inputIndices[1]) = values[packetSize-1];
|
this->m_impl.coeffRef(inputIndices[1]) = values[packetSize-1];
|
||||||
|
@ -342,7 +342,7 @@ struct TensorEvaluator<const TensorPaddingOp<PaddingDimensions, ArgType>, Device
|
|||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packetWithPossibleZero(Index index) const
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packetWithPossibleZero(Index index) const
|
||||||
{
|
{
|
||||||
const int packetSize = internal::unpacket_traits<PacketReturnType>::size;
|
const int packetSize = internal::unpacket_traits<PacketReturnType>::size;
|
||||||
EIGEN_ALIGN_DEFAULT typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
EIGEN_ALIGN_MAX typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
||||||
for (int i = 0; i < packetSize; ++i) {
|
for (int i = 0; i < packetSize; ++i) {
|
||||||
values[i] = coeff(index+i);
|
values[i] = coeff(index+i);
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,7 @@ struct TensorEvaluator<const TensorPatchOp<PatchDim, ArgType>, Device>
|
|||||||
return rslt;
|
return rslt;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
EIGEN_ALIGN_DEFAULT CoeffReturnType values[packetSize];
|
EIGEN_ALIGN_MAX CoeffReturnType values[packetSize];
|
||||||
values[0] = m_impl.coeff(inputIndices[0]);
|
values[0] = m_impl.coeff(inputIndices[0]);
|
||||||
values[packetSize-1] = m_impl.coeff(inputIndices[1]);
|
values[packetSize-1] = m_impl.coeff(inputIndices[1]);
|
||||||
for (int i = 1; i < packetSize-1; ++i) {
|
for (int i = 1; i < packetSize-1; ++i) {
|
||||||
|
@ -694,7 +694,7 @@ struct TensorEvaluator<const TensorReductionOp<Op, Dims, ArgType>, Device>
|
|||||||
EIGEN_STATIC_ASSERT(packetSize > 1, YOU_MADE_A_PROGRAMMING_MISTAKE)
|
EIGEN_STATIC_ASSERT(packetSize > 1, YOU_MADE_A_PROGRAMMING_MISTAKE)
|
||||||
eigen_assert(index + packetSize - 1 < dimensions().TotalSize());
|
eigen_assert(index + packetSize - 1 < dimensions().TotalSize());
|
||||||
|
|
||||||
EIGEN_ALIGN_DEFAULT typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
EIGEN_ALIGN_MAX typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
||||||
if (ReducingInnerMostDims) {
|
if (ReducingInnerMostDims) {
|
||||||
const Index num_values_to_reduce =
|
const Index num_values_to_reduce =
|
||||||
(static_cast<int>(Layout) == static_cast<int>(ColMajor)) ? m_preservedStrides[0] : m_preservedStrides[NumOutputDims - 1];
|
(static_cast<int>(Layout) == static_cast<int>(ColMajor)) ? m_preservedStrides[0] : m_preservedStrides[NumOutputDims - 1];
|
||||||
|
@ -200,7 +200,7 @@ struct TensorEvaluator<const TensorReverseOp<ReverseDimensions, ArgType>, Device
|
|||||||
|
|
||||||
// TODO(ndjaitly): write a better packing routine that uses
|
// TODO(ndjaitly): write a better packing routine that uses
|
||||||
// local structure.
|
// local structure.
|
||||||
EIGEN_ALIGN_DEFAULT typename internal::remove_const<CoeffReturnType>::type
|
EIGEN_ALIGN_MAX typename internal::remove_const<CoeffReturnType>::type
|
||||||
values[packetSize];
|
values[packetSize];
|
||||||
for (int i = 0; i < packetSize; ++i) {
|
for (int i = 0; i < packetSize; ++i) {
|
||||||
values[i] = coeff(index+i);
|
values[i] = coeff(index+i);
|
||||||
@ -259,7 +259,7 @@ struct TensorEvaluator<TensorReverseOp<ReverseDimensions, ArgType>, Device>
|
|||||||
eigen_assert(index+packetSize-1 < dimensions().TotalSize());
|
eigen_assert(index+packetSize-1 < dimensions().TotalSize());
|
||||||
|
|
||||||
// This code is pilfered from TensorMorphing.h
|
// This code is pilfered from TensorMorphing.h
|
||||||
EIGEN_ALIGN_DEFAULT CoeffReturnType values[packetSize];
|
EIGEN_ALIGN_MAX CoeffReturnType values[packetSize];
|
||||||
internal::pstore<CoeffReturnType, PacketReturnType>(values, x);
|
internal::pstore<CoeffReturnType, PacketReturnType>(values, x);
|
||||||
for (int i = 0; i < packetSize; ++i) {
|
for (int i = 0; i < packetSize; ++i) {
|
||||||
this->coeffRef(index+i) = values[i];
|
this->coeffRef(index+i) = values[i];
|
||||||
|
@ -172,7 +172,7 @@ struct TensorEvaluator<const TensorShufflingOp<Shuffle, ArgType>, Device>
|
|||||||
EIGEN_STATIC_ASSERT(packetSize > 1, YOU_MADE_A_PROGRAMMING_MISTAKE)
|
EIGEN_STATIC_ASSERT(packetSize > 1, YOU_MADE_A_PROGRAMMING_MISTAKE)
|
||||||
eigen_assert(index+packetSize-1 < dimensions().TotalSize());
|
eigen_assert(index+packetSize-1 < dimensions().TotalSize());
|
||||||
|
|
||||||
EIGEN_ALIGN_DEFAULT typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
EIGEN_ALIGN_MAX typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
||||||
for (int i = 0; i < packetSize; ++i) {
|
for (int i = 0; i < packetSize; ++i) {
|
||||||
values[i] = coeff(index+i);
|
values[i] = coeff(index+i);
|
||||||
}
|
}
|
||||||
@ -245,7 +245,7 @@ struct TensorEvaluator<TensorShufflingOp<Shuffle, ArgType>, Device>
|
|||||||
static const int packetSize = internal::unpacket_traits<PacketReturnType>::size;
|
static const int packetSize = internal::unpacket_traits<PacketReturnType>::size;
|
||||||
EIGEN_STATIC_ASSERT(packetSize > 1, YOU_MADE_A_PROGRAMMING_MISTAKE)
|
EIGEN_STATIC_ASSERT(packetSize > 1, YOU_MADE_A_PROGRAMMING_MISTAKE)
|
||||||
|
|
||||||
EIGEN_ALIGN_DEFAULT typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
EIGEN_ALIGN_MAX typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
||||||
internal::pstore<CoeffReturnType, PacketReturnType>(values, x);
|
internal::pstore<CoeffReturnType, PacketReturnType>(values, x);
|
||||||
for (int i = 0; i < packetSize; ++i) {
|
for (int i = 0; i < packetSize; ++i) {
|
||||||
this->coeffRef(index+i) = values[i];
|
this->coeffRef(index+i) = values[i];
|
||||||
|
@ -41,7 +41,7 @@ class TensorStorage<T, FixedDimensions, Options_>
|
|||||||
private:
|
private:
|
||||||
static const std::size_t Size = FixedDimensions::total_size;
|
static const std::size_t Size = FixedDimensions::total_size;
|
||||||
|
|
||||||
EIGEN_ALIGN_DEFAULT T m_data[Size];
|
EIGEN_ALIGN_MAX T m_data[Size];
|
||||||
FixedDimensions m_dimensions;
|
FixedDimensions m_dimensions;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -200,7 +200,7 @@ struct TensorEvaluator<const TensorStridingOp<Strides, ArgType>, Device>
|
|||||||
return rslt;
|
return rslt;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
EIGEN_ALIGN_DEFAULT typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
EIGEN_ALIGN_MAX typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
||||||
values[0] = m_impl.coeff(inputIndices[0]);
|
values[0] = m_impl.coeff(inputIndices[0]);
|
||||||
values[packetSize-1] = m_impl.coeff(inputIndices[1]);
|
values[packetSize-1] = m_impl.coeff(inputIndices[1]);
|
||||||
for (int i = 1; i < packetSize-1; ++i) {
|
for (int i = 1; i < packetSize-1; ++i) {
|
||||||
@ -308,7 +308,7 @@ struct TensorEvaluator<TensorStridingOp<Strides, ArgType>, Device>
|
|||||||
this->m_impl.template writePacket<Unaligned>(inputIndices[0], x);
|
this->m_impl.template writePacket<Unaligned>(inputIndices[0], x);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
EIGEN_ALIGN_DEFAULT Scalar values[packetSize];
|
EIGEN_ALIGN_MAX Scalar values[packetSize];
|
||||||
internal::pstore<Scalar, PacketReturnType>(values, x);
|
internal::pstore<Scalar, PacketReturnType>(values, x);
|
||||||
this->m_impl.coeffRef(inputIndices[0]) = values[0];
|
this->m_impl.coeffRef(inputIndices[0]) = values[0];
|
||||||
this->m_impl.coeffRef(inputIndices[1]) = values[packetSize-1];
|
this->m_impl.coeffRef(inputIndices[1]) = values[packetSize-1];
|
||||||
|
@ -23,13 +23,13 @@ class compute_tensor_flags
|
|||||||
aligned_bit =
|
aligned_bit =
|
||||||
(
|
(
|
||||||
((Options&DontAlign)==0) && (
|
((Options&DontAlign)==0) && (
|
||||||
#if EIGEN_ALIGN_STATICALLY
|
#if EIGEN_MAX_STATIC_ALIGN_BYTES>0
|
||||||
(!is_dynamic_size_storage)
|
(!is_dynamic_size_storage)
|
||||||
#else
|
#else
|
||||||
0
|
0
|
||||||
#endif
|
#endif
|
||||||
||
|
||
|
||||||
#if EIGEN_ALIGN
|
#if EIGEN_MAX_ALIGN_BYTES>0
|
||||||
is_dynamic_size_storage
|
is_dynamic_size_storage
|
||||||
#else
|
#else
|
||||||
0
|
0
|
||||||
|
@ -594,7 +594,7 @@ struct TensorEvaluator<const TensorVolumePatchOp<Planes, Rows, Cols, ArgType>, D
|
|||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packetWithPossibleZero(Index index) const
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packetWithPossibleZero(Index index) const
|
||||||
{
|
{
|
||||||
const int packetSize = internal::unpacket_traits<PacketReturnType>::size;
|
const int packetSize = internal::unpacket_traits<PacketReturnType>::size;
|
||||||
EIGEN_ALIGN_DEFAULT typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
EIGEN_ALIGN_MAX typename internal::remove_const<CoeffReturnType>::type values[packetSize];
|
||||||
for (int i = 0; i < packetSize; ++i) {
|
for (int i = 0; i < packetSize; ++i) {
|
||||||
values[i] = coeff(index+i);
|
values[i] = coeff(index+i);
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ struct MyGenerator {
|
|||||||
typename internal::packet_traits<int>::type packetOp(
|
typename internal::packet_traits<int>::type packetOp(
|
||||||
Eigen::DenseIndex packet_location, Eigen::DenseIndex /*unused*/ = 0) const {
|
Eigen::DenseIndex packet_location, Eigen::DenseIndex /*unused*/ = 0) const {
|
||||||
const int packetSize = internal::packet_traits<int>::size;
|
const int packetSize = internal::packet_traits<int>::size;
|
||||||
EIGEN_ALIGN_DEFAULT int values[packetSize];
|
EIGEN_ALIGN_MAX int values[packetSize];
|
||||||
for (int i = 0; i < packetSize; ++i) {
|
for (int i = 0; i < packetSize; ++i) {
|
||||||
values[i] = static_cast<int>(3 * (packet_location + i));
|
values[i] = static_cast<int>(3 * (packet_location + i));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user