PandaRoot
PndFTSVector.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 /**************************************************************************
14  * This file is property of and copyright by the ALICE HLT Project *
15  * All rights reserved. *
16  * *
17  * Primary Authors: *
18  * Copyright 2009 Matthias Kretz <kretz@kde.org> *
19  * *
20  * Permission to use, copy, modify and distribute this software and its *
21  * documentation strictly for non-commercial purposes is hereby granted *
22  * without fee, provided that the above copyright notice appears in all *
23  * copies and that both the copyright notice and this permission notice *
24  * appear in the supporting documentation. The authors make no claims *
25  * about the suitability of this software for any purpose. It is *
26  * provided "as is" without express or implied warranty. *
27  **************************************************************************/
28 
29 #ifndef PNDFTSVECTOR_H
30 #define PNDFTSVECTOR_H
31 
32 #include "PndFTSCADef.h"
33 #include "PndFTSCAMath.h"
34 
35 static inline uint_m validHitIndexes(const uint_v &v)
36 {
37  return static_cast<int_v>(v) >= int_v(Vc::Zero);
38 }
39 
40 namespace CAMath {
41 template <>
42 inline Vc::int_v Abs<Vc::int_v>(const Vc::int_v &x)
43 {
44  return Vc::abs(x);
45 }
46 #define SPECIALIZATION(T) \
47  template <> \
48  inline Vc::T Min<Vc::T>(const Vc::T &x, const Vc::T &y) \
49  { \
50  return Vc::min(x, y); \
51  } \
52  template <> \
53  inline Vc::T Max<Vc::T>(const Vc::T &x, const Vc::T &y) \
54  { \
55  return Vc::max(x, y); \
56  }
57 SPECIALIZATION(int_v)
58 SPECIALIZATION(uint_v)
59 #undef SPECIALIZATION
60 #define SPECIALIZATION(T) \
61  template <> \
62  inline T Min<T>(const T &x, const T &y) \
63  { \
64  return Vc::min(x, y); \
65  } \
66  template <> \
67  inline T Max<T>(const T &x, const T &y) \
68  { \
69  return Vc::max(x, y); \
70  } \
71  template <> \
72  inline T Sqrt<T>(const T &x) \
73  { \
74  return Vc::sqrt(x); \
75  } \
76  template <> \
77  inline T Abs<T>(const T &x) \
78  { \
79  return Vc::abs(x); \
80  } \
81  template <> \
82  inline T Log<T>(const T &x) \
83  { \
84  return Vc::log(x); \
85  } \
86  template <> \
87  inline T Reciprocal<T>(const T &x) \
88  { \
89  return Vc::reciprocal(x); \
90  } \
91  template <> \
92  inline T Round<T>(const T &x) \
93  { \
94  return Vc::round(x); \
95  } \
96  template <> \
97  inline T RSqrt<T>(const T &x) \
98  { \
99  return Vc::rsqrt(x); \
100  } \
101  template <> \
102  struct FiniteReturnTypeHelper<T> { \
103  typedef T::Mask R; \
104  }; \
105  template <> \
106  inline FiniteReturnTypeHelper<T>::R Finite<T>(const T &x) \
107  { \
108  return Vc::isfinite(x); \
109  } \
110  template <> \
111  inline T ATan2<T>(const T &x, const T &y) \
112  { \
113  return Vc::atan2(x, y); \
114  } \
115  template <> \
116  inline T ASin<T>(const T &x) \
117  { \
118  return Vc::asin(x); \
119  } \
120  template <> \
121  inline T Sin<T>(const T &x) \
122  { \
123  return Vc::sin(x); \
124  } \
125  template <> \
126  inline T Cos<T>(const T &x) \
127  { \
128  return Vc::cos(x); \
129  }
130 
131 SPECIALIZATION(float_v)
132 SPECIALIZATION(double_v)
133 #undef SPECIALIZATION
134 
135 #ifdef USE_TBB
136 static void AtomicMax(unsigned int volatile *addr, uint_v val)
137 {
138  for (int i = 0; i < uint_v::Size; ++i) {
139  AtomicMax(&addr[i], val[i]);
140  }
141 }
142 #endif // USE_TBB
143 } // namespace CAMath
144 
145 #endif // PNDFTSVECTOR_H
#define SPECIALIZATION(T)
Definition: PndFTSVector.h:60
__m128 v
Definition: P4_F32vec4.h:15
unsigned int i
Definition: P4_F32vec4.h:33
static uint_m validHitIndexes(const uint_v &v)
Definition: PndFTSVector.h:35