32 #define FN_SPECIFIERS inline __host__ __device__ 34 #define FN_SPECIFIERS inline 42 template <
class T,
int N>
48 template <
class... TInit>
52 for (
int i = 0; i < N; ++i)
operator[](i) = ptr[i];
60 for (
int i = 0; i < N; ++i) a[i] = T2(
operator[](i));
66 for (
int i = 0; i < N; ++i) result +=
operator[](i) * a[i];
72 for (
int i = 0; i < N; ++i) r[i] = std::abs(
operator[](i));
82 for (
int i = 0; i < N; ++i) r[i] = floorf(a[i]);
89 for (
int i = 0; i < N; ++i) r[i] =
std::floor(a[i]);
93 template <
class T,
int N>
96 for (
int i = 0; i < N && result; ++i) result = result && a[i] == b[i];
100 template <
class T,
int N>
105 template <
class T,
int N>
108 for (
int i = 0; i < N; ++i) r[i] = -a[i];
112 #define DEFINE_OPERATOR(op, opas) \ 113 template <class T, int N> \ 114 FN_SPECIFIERS MiniVec<T, N> operator op(const MiniVec<T, N>& a, \ 115 const MiniVec<T, N>& b) { \ 117 for (int i = 0; i < N; ++i) c[i] = a[i] op b[i]; \ 121 template <class T, int N> \ 122 FN_SPECIFIERS void operator opas(MiniVec<T, N>& a, \ 123 const MiniVec<T, N>& b) { \ 124 for (int i = 0; i < N; ++i) a[i] opas b[i]; \ 127 template <class T, int N> \ 128 FN_SPECIFIERS MiniVec<T, N> operator op(const MiniVec<T, N>& a, T b) { \ 130 for (int i = 0; i < N; ++i) c[i] = a[i] op b; \ 134 template <class T, int N> \ 135 FN_SPECIFIERS MiniVec<T, N> operator op(T a, const MiniVec<T, N>& b) { \ 137 for (int i = 0; i < N; ++i) c[i] = a op b[i]; \ 141 template <class T, int N> \ 142 FN_SPECIFIERS void operator opas(MiniVec<T, N>& a, T b) { \ 143 for (int i = 0; i < N; ++i) a[i] opas b; \ 150 #undef DEFINE_OPERATOR T Scalar_t
Definition: MiniVec.h:44
FN_SPECIFIERS MiniVec(TInit... as)
Definition: MiniVec.h:49
FN_SPECIFIERS bool operator!=(const MiniVec< T, N > &a, const MiniVec< T, N > &b)
Definition: MiniVec.h:101
FN_SPECIFIERS T & operator[](size_t i)
Definition: MiniVec.h:56
FN_SPECIFIERS const T operator[](size_t i) const
Definition: MiniVec.h:55
#define FN_SPECIFIERS
Definition: MiniVec.h:34
FN_SPECIFIERS MiniVec< double, N > floor(const MiniVec< double, N > &a)
Definition: MiniVec.h:87
FN_SPECIFIERS MiniVec< T, N > operator-(const MiniVec< T, N > &a)
Definition: MiniVec.h:106
FN_SPECIFIERS MiniVec< float, N > floor(const MiniVec< float, N > &a)
Definition: MiniVec.h:80
FN_SPECIFIERS MiniVec< T, N > abs() const
Definition: MiniVec.h:70
FN_SPECIFIERS T dot(const MiniVec< T, N > &a) const
Definition: MiniVec.h:64
Definition: PinholeCameraIntrinsic.cpp:35
#define DEFINE_OPERATOR(op, opas)
Definition: MiniVec.h:112
FN_SPECIFIERS MiniVec()
Definition: MiniVec.h:46
FN_SPECIFIERS MiniVec(const T *const ptr)
Definition: MiniVec.h:51
FN_SPECIFIERS bool operator==(const MiniVec< T, N > &a, const MiniVec< T, N > &b)
Definition: MiniVec.h:94
FN_SPECIFIERS MiniVec< T2, N > cast() const
Definition: MiniVec.h:58
T arr[N]
Definition: MiniVec.h:76