FairRoot/PandaRoot
PndCAVector.h
Go to the documentation of this file.
1 /**************************************************************************
2  * This file is property of and copyright by the ALICE HLT Project *
3  * All rights reserved. *
4  * *
5  * Primary Authors: *
6  * Copyright 2009 Matthias Kretz <kretz@kde.org> *
7  * *
8  * Permission to use, copy, modify and distribute this software and its *
9  * documentation strictly for non-commercial purposes is hereby granted *
10  * without fee, provided that the above copyright notice appears in all *
11  * copies and that both the copyright notice and this permission notice *
12  * appear in the supporting documentation. The authors make no claims *
13  * about the suitability of this software for any purpose. It is *
14  * provided "as is" without express or implied warranty. *
15  **************************************************************************/
16 
17 #ifndef ALIHLTVECTOR_H
18 #define ALIHLTVECTOR_H
19 
20 #include "PndCADef.h"
21 #include "PndCAMath.h"
22 
23 
24 static inline uint_m validHitIndexes( const uint_v &v )
25 {
26  return static_cast<int_v>( v ) >= int_v( Vc::Zero );
27 }
28 
29 namespace CAMath
30 {
31  template<> inline Vc::int_v Abs <Vc::int_v >( const Vc::int_v &x ) { return Vc::abs( x ); }
32 #define SPECIALIZATION( T ) \
33  template<> inline Vc::T Min <Vc::T>( const Vc::T &x, const Vc::T &y ) { return Vc::min( x, y ); } \
34  template<> inline Vc::T Max <Vc::T>( const Vc::T &x, const Vc::T &y ) { return Vc::max( x, y ); }
35  //SPECIALIZATION( int_v )
36  //SPECIALIZATION( uint_v )
37 #ifndef ENABLE_LARRABEE
38  //template<> inline Vc::int_v Abs <Vc::int_v >( const Vc::int_v &x ) { return Vc::abs( x ); }
39  //SPECIALIZATION( int_v )
40  //SPECIALIZATION( uint_v )
41 #endif // ENABLE_LARRABEE
42 #undef SPECIALIZATION
43 #define SPECIALIZATION( T ) \
44  template<> inline T Min <T>( const T &x, const T &y ) { return Vc::min( x, y ); } \
45  template<> inline T Max <T>( const T &x, const T &y ) { return Vc::max( x, y ); } \
46  template<> inline T Sqrt <T>( const T &x ) { return Vc::sqrt( x ); } \
47  template<> inline T Abs <T>( const T &x ) { return Vc::abs( x ); } \
48  template<> inline T Log <T>( const T &x ) { return Vc::log( x ); } \
49  template<> inline T Reciprocal<T>( const T &x ) { return Vc::reciprocal( x ); } \
50  template<> inline T Round<T>( const T &x ) { return Vc::round( x ); } \
51  template<> inline T RSqrt<T>( const T &x ) { return Vc::rsqrt( x ); } \
52  template<> struct FiniteReturnTypeHelper<T> { typedef T::Mask R; }; \
53  template<> inline FiniteReturnTypeHelper<T>::R Finite<T>( const T &x ) { return Vc::isfinite( x ); } \
54  template<> inline T ATan2<T>( const T &x, const T &y ) { return Vc::atan2( x, y ); } \
55  template<> inline T ASin<T> ( const T &x ) { return Vc::asin( x ); } \
56  template<> inline T Sin <T>( const T &x ) { return Vc::sin( x ); } \
57  template<> inline T Cos <T>( const T &x ) { return Vc::cos( x ); }
58 
59  //SPECIALIZATION( float_v )
60 #if VC_IMPL_SSE
61  SPECIALIZATION( float_v )
62 #endif // VC_IMPL_SSE
63  SPECIALIZATION( double_v )
64 #undef SPECIALIZATION
65 
66 #ifdef USE_TBB
67  static void AtomicMax( unsigned int volatile *addr, uint_v val ) {
68  for ( int i = 0; i < uint_v::Size; ++i ) {
69  AtomicMax( &addr[i], val[i] );
70  }
71  }
72 #endif //USE_TBB
73 } // namespace CAMath
74 
75 #endif // ALIHLTVECTOR_H
#define SPECIALIZATION(T)
Definition: PndCAVector.h:43
Int_t i
Definition: run_full.C:25
Double_t val[nBoxes][nFEBox]
Definition: createCalib.C:11
static const fvec Zero
__m128 v
Definition: P4_F32vec4.h:4
static uint_m validHitIndexes(const uint_v &v)
Definition: PndCAVector.h:24
Double_t x