37 #ifndef VIGRA_TINYVECTOR_HXX
38 #define VIGRA_TINYVECTOR_HXX
45 #include "metaprogramming.hxx"
46 #include "numerictraits.hxx"
48 #include "mathutil.hxx"
51 #ifdef VIGRA_CHECK_BOUNDS
52 #define VIGRA_ASSERT_INSIDE(diff) \
53 vigra_precondition(diff >= 0, "Index out of bounds");\
54 vigra_precondition(diff < SIZE, "Index out of bounds");
56 #define VIGRA_ASSERT_INSIDE(diff)
66 template <
class V1,
int SIZE,
class D1,
class D2>
69 template <
class V1,
int SIZE,
class D1,
class D2>
71 typename TinyVectorBase<V1, SIZE, D1, D2>::SquaredNormType
72 squaredNorm(TinyVectorBase<V1, SIZE, D1, D2>
const & t);
77 #define VIGRA_EXEC_LOOP(NAME, OPER) \
78 template <class T1, class T2> \
79 static void NAME(T1 * left, T2 const * right) \
81 for(int i=0; i<LEVEL; ++i) \
82 (left[i]) OPER (right[i]); \
85 #define VIGRA_EXEC_LOOP_SCALAR(NAME, OPER) \
86 template <class T1, class T2> \
87 static void NAME(T1 * left, T2 right) \
89 for(int i=0; i<LEVEL; ++i) \
90 (left[i]) = detail::RequiresExplicitCast<T1>::cast((left[i]) OPER (right)); \
96 template <
class T1,
class T2>
97 static void assignCast(T1 * left, T2
const * right)
99 for(
int i=0; i<LEVEL; ++i)
100 left[i] = detail::RequiresExplicitCast<T1>::cast(right[i]);
103 template <
class T1,
class T2>
104 static void reverseAssign(T1 * left, T2
const * right)
106 for(
int i=0; i<LEVEL; ++i)
110 template <
class T1,
class T2>
111 static void assignScalar(T1 * left, T2 right)
113 for(
int i=0; i<LEVEL; ++i)
114 left[i] = detail::RequiresExplicitCast<T1>::cast(right);
117 VIGRA_EXEC_LOOP(assign, =)
118 VIGRA_EXEC_LOOP(
add, +=)
119 VIGRA_EXEC_LOOP(
sub, -=)
120 VIGRA_EXEC_LOOP(
mul, *=)
121 VIGRA_EXEC_LOOP(
div, /=)
122 VIGRA_EXEC_LOOP(neg, = -)
123 VIGRA_EXEC_LOOP(
abs, = vigra::abs)
124 VIGRA_EXEC_LOOP(
floor, = vigra::floor)
125 VIGRA_EXEC_LOOP(
ceil, = vigra::ceil)
126 VIGRA_EXEC_LOOP(fromPromote, = NumericTraits<T1>::fromPromote)
127 VIGRA_EXEC_LOOP(fromRealPromote, = NumericTraits<T1>::fromRealPromote)
128 VIGRA_EXEC_LOOP_SCALAR(mulScalar, *)
129 VIGRA_EXEC_LOOP_SCALAR(divScalar, /)
131 template <class T1, class T2>
132 static
bool notEqual(T1 const * left, T2 const * right)
134 for(
int i=0; i<LEVEL; ++i)
135 if(left[i] != right[i])
141 static typename NumericTraits<T>::Promote
144 typename NumericTraits<T>::Promote res(*d * *d);
145 for(
int i=1; i<LEVEL; ++i)
150 template <
class T1,
class T2>
151 static typename PromoteTraits<T1, T2>::Promote
152 dot(T1
const * left, T2
const * right)
154 typename PromoteTraits<T1, T2>::Promote res(*left * *right);
155 for(
int i=1; i<LEVEL; ++i)
156 res += left[i] * right[i];
161 static typename NormTraits<T>::SquaredNormType
165 for(
int i=1; i<LEVEL; ++i)
175 static typename NumericTraits<T>::Promote
181 template <
class T1,
class T2>
182 static typename PromoteTraits<T1, T2>::Promote
183 dot(T1
const * left, T2
const * right)
193 static typename NumericTraits<T>::Promote
199 template <
class T1,
class T2>
200 static typename PromoteTraits<T1, T2>::Promote
201 dot(T1
const * left, T2
const * right)
203 return *left * *right;
208 struct UnrollSquaredNorm
211 static typename NormTraits<T>::SquaredNormType
217 static std::ptrdiff_t
225 struct UnrollSquaredNorm<1>
228 static typename NormTraits<T>::SquaredNormType
234 static std::ptrdiff_t
241 #undef VIGRA_EXEC_LOOP
242 #undef VIGRA_EXEC_LOOP_SCALAR
244 #define VIGRA_UNROLL_LOOP(NAME, OPER) \
245 template <class T1, class T2> \
246 static void NAME(T1 * left, T2 const * right) \
248 (*left) OPER (*right); \
249 UnrollLoop<LEVEL-1>::NAME(left+1, right+1); \
252 #define VIGRA_UNROLL_LOOP_SCALAR(NAME, OPER) \
253 template <class T1, class T2> \
254 static void NAME(T1 * left, T2 right) \
256 (*left) = detail::RequiresExplicitCast<T1>::cast((*left) OPER (right)); \
257 UnrollLoop<LEVEL-1>::NAME(left+1, right); \
264 template <
class T1,
class T2>
265 static void reverseAssign(T1 * left, T2
const * right)
268 UnrollLoop<LEVEL-1>::reverseAssign(left+1, right-1);
271 template <
class T1,
class T2>
272 static void assignCast(T1 * left, T2
const * right)
274 *left = detail::RequiresExplicitCast<T1>::cast(*right);
275 UnrollLoop<LEVEL-1>::assignCast(left+1, right+1);
278 template <
class T1,
class T2>
279 static void assignScalar(T1 * left, T2 right)
281 *left = detail::RequiresExplicitCast<T1>::cast(right);
282 UnrollLoop<LEVEL-1>::assignScalar(left+1, right);
285 VIGRA_UNROLL_LOOP(assign, =)
286 VIGRA_UNROLL_LOOP(add, +=)
287 VIGRA_UNROLL_LOOP(sub, -=)
288 VIGRA_UNROLL_LOOP(mul, *=)
289 VIGRA_UNROLL_LOOP(div, /=)
290 VIGRA_UNROLL_LOOP(neg, = -)
291 VIGRA_UNROLL_LOOP(abs, = vigra::abs)
292 VIGRA_UNROLL_LOOP(floor, = vigra::floor)
293 VIGRA_UNROLL_LOOP(ceil, = vigra::ceil)
294 VIGRA_UNROLL_LOOP(fromPromote, = NumericTraits<T1>::fromPromote)
295 VIGRA_UNROLL_LOOP(fromRealPromote, = NumericTraits<T1>::fromRealPromote)
296 VIGRA_UNROLL_LOOP_SCALAR(mulScalar, *)
297 VIGRA_UNROLL_LOOP_SCALAR(divScalar, /)
299 template <class T1, class T2>
300 static
bool notEqual(T1 const * left, T2 const * right)
302 return (*left != *right) || UnrollLoop<LEVEL - 1>::notEqual(left+1, right+1);
306 static typename NumericTraits<T>::Promote
312 template <
class T1,
class T2>
313 static typename PromoteTraits<T1, T2>::Promote
314 dot(T1
const * left, T2
const * right)
320 static typename NormTraits<T>::SquaredNormType
327 #undef VIGRA_UNROLL_LOOP
328 #undef VIGRA_UNROLL_LOOP_SCALAR
333 template <
class T1,
class T2>
334 static void reverseAssign(T1, T2) {}
335 template <
class T1,
class T2>
336 static void assignCast(T1, T2) {}
337 template <
class T1,
class T2>
338 static void assign(T1, T2) {}
339 template <
class T1,
class T2>
340 static void assignScalar(T1, T2) {}
341 template <
class T1,
class T2>
342 static void add(T1, T2) {}
343 template <
class T1,
class T2>
344 static void sub(T1, T2) {}
345 template <
class T1,
class T2>
346 static void mul(T1, T2) {}
347 template <
class T1,
class T2>
348 static void mulScalar(T1, T2) {}
349 template <
class T1,
class T2>
350 static void div(T1, T2) {}
351 template <
class T1,
class T2>
352 static void divScalar(T1, T2) {}
353 template <
class T1,
class T2>
354 static void fromPromote(T1, T2) {}
355 template <
class T1,
class T2>
356 static void fromRealPromote(T1, T2) {}
357 template <
class T1,
class T2>
358 static void neg(T1, T2) {}
359 template <
class T1,
class T2>
360 static void abs(T1, T2) {}
361 template <
class T1,
class T2>
362 static void floor(T1, T2) {}
363 template <
class T1,
class T2>
364 static void ceil(T1, T2) {}
365 template <
class T1,
class T2>
366 static bool notEqual(T1, T2) {
return false; }
372 typedef typename IfBool<(SIZE < 5), UnrollLoop<SIZE>, ExecLoop<SIZE> >::type type;
378 inline DontInit dontInit() {
return DontInit(); }
382 template <
class T,
int SIZE>
385 template <
class T,
int SIZE>
386 class TinyVectorView;
403 template <
class VALUETYPE,
int SIZE,
class DATA,
class DERIVED>
412 typedef typename detail::LoopType<SIZE>::type Loop;
464 typedef typename SquareRootTraits<SquaredNormType>::SquareRootResult
NormType;
468 enum { static_size = SIZE };
472 template <
class Iterator>
475 vigra_precondition(end-i == SIZE,
476 "TinyVector::init(): Sequence has wrong size.");
477 Loop::assignCast(data_, i);
484 Loop::assignScalar(data_, initial);
489 template <
class T1,
class D1,
class D2>
493 return static_cast<DERIVED &
>(*this);
498 template <
class T1,
class D1,
class D2>
502 return static_cast<DERIVED &
>(*this);
507 template <
class T1,
class D1,
class D2>
511 return static_cast<DERIVED &
>(*this);
516 template <
class T1,
class D1,
class D2>
520 return static_cast<DERIVED &
>(*this);
527 Loop::mulScalar(data_, r);
528 return static_cast<DERIVED &
>(*this);
535 Loop::divScalar(data_, r);
536 return static_cast<DERIVED &
>(*this);
543 return sqrt(
static_cast<typename
544 SquareRootTraits<SquaredNormType>::SquareRootArgument
>(
squaredMagnitude()));
558 VIGRA_ASSERT_INSIDE(i);
566 VIGRA_ASSERT_INSIDE(i);
589 pointer data() {
return data_; }
626 template <
class T,
int SIZE>
631 typedef typename BaseType::Loop Loop;
648 enum ReverseCopyTag { ReverseCopy };
663 BaseType::data_[0] = detail::RequiresExplicitCast<T>::cast(initial.
x);
664 BaseType::data_[1] = detail::RequiresExplicitCast<T>::cast(initial.
y);
673 BaseType::data_[0] = i1;
674 BaseType::data_[1] = i2;
683 BaseType::data_[0] = i1;
684 BaseType::data_[1] = i2;
685 BaseType::data_[2] = i3;
695 BaseType::data_[0] = i1;
696 BaseType::data_[1] = i2;
697 BaseType::data_[2] = i3;
698 BaseType::data_[3] = i4;
709 BaseType::data_[0] = i1;
710 BaseType::data_[1] = i2;
711 BaseType::data_[2] = i3;
712 BaseType::data_[3] = i4;
713 BaseType::data_[4] = i5;
720 Loop::assignScalar(BaseType::data_, NumericTraits<value_type>::zero());
728 Loop::assign(BaseType::data_, r.data_);
736 Loop::assign(BaseType::data_, data);
750 Loop::reverseAssign(BaseType::data_, data+SIZE-1);
757 Loop::assign(BaseType::data_, r.data_);
765 BaseType::data_[0] = detail::RequiresExplicitCast<T>::cast(r.
x);
766 BaseType::data_[1] = detail::RequiresExplicitCast<T>::cast(r.
y);
776 Loop::assignCast(BaseType::data_, r.
begin());
781 template <
class U,
class DATA,
class DERIVED>
785 Loop::assignCast(BaseType::data_, r.
begin());
790 template <
class U,
class DATA,
class DERIVED>
793 Loop::assignCast(BaseType::data_, r.
begin());
835 template <
class T,
int SIZE>
840 typedef typename BaseType::Loop Loop;
871 BaseType::data_ =
const_cast<pointer>(data);
879 BaseType::data_ =
const_cast<pointer>(other.data_);
884 template <
class DATA,
class DERIVED>
888 BaseType::data_ =
const_cast<pointer>(other.data());
895 Loop::assign(BaseType::data_, r.
begin());
901 template <
class U,
class DATA,
class DERIVED>
904 Loop::assignCast(BaseType::data_, r.
begin());
927 template <
class V1,
int SIZE,
class D1,
class D2,
class V2,
class D3,
class D4>
936 template <
class V1,
int SIZE,
class D1,
class D2,
class V2,
class D3,
class D4>
941 typedef typename detail::LoopType<SIZE>::type ltype;
952 template <
class V1,
int SIZE,
class DATA,
class DERIVED>
954 operator<<(std::ostream & out, TinyVectorBase<V1, SIZE, DATA, DERIVED>
const & l)
958 for(i=0; i<SIZE-1; ++i)
1017 #if !defined(NO_PARTIAL_TEMPLATE_SPECIALIZATION)
1019 template <
class T,
int SIZE>
1020 struct NumericTraits<TinyVector<T, SIZE> >
1022 typedef TinyVector<T, SIZE> Type;
1023 typedef TinyVector<typename NumericTraits<T>::Promote, SIZE> Promote;
1024 typedef TinyVector<typename NumericTraits<T>::RealPromote, SIZE> RealPromote;
1025 typedef TinyVector<typename NumericTraits<T>::ComplexPromote, SIZE> ComplexPromote;
1026 typedef T ValueType;
1028 typedef typename NumericTraits<T>::isIntegral isIntegral;
1029 typedef VigraFalseType isScalar;
1030 typedef typename NumericTraits<T>::isSigned isSigned;
1031 typedef VigraFalseType isOrdered;
1032 typedef VigraFalseType isComplex;
1034 static TinyVector<T, SIZE> zero() {
1035 return TinyVector<T, SIZE>(NumericTraits<T>::zero());
1037 static TinyVector<T, SIZE> one() {
1038 return TinyVector<T, SIZE>(NumericTraits<T>::one());
1040 static TinyVector<T, SIZE> nonZero() {
1041 return TinyVector<T, SIZE>(NumericTraits<T>::nonZero());
1044 template <
class D1,
class D2>
1045 static Promote toPromote(TinyVectorBase<T, SIZE, D1, D2>
const & v)
1050 template <
class D1,
class D2>
1051 static RealPromote toRealPromote(TinyVectorBase<T, SIZE, D1, D2>
const & v)
1053 return RealPromote(v);
1056 template <
class D1,
class D2>
1057 static TinyVector<T, SIZE>
1058 fromPromote(TinyVectorBase<
typename NumericTraits<T>::Promote, SIZE, D1, D2>
const & v)
1060 TinyVector<T, SIZE> res(detail::dontInit());
1061 typedef typename detail::LoopType<SIZE>::type ltype;
1062 ltype::fromPromote(res.begin(), v.begin());
1066 template <
class D1,
class D2>
1067 static TinyVector<T, SIZE>
1068 fromRealPromote(TinyVectorBase<
typename NumericTraits<T>::RealPromote, SIZE, D1, D2>
const & v)
1070 TinyVector<T, SIZE> res(detail::dontInit());
1071 typedef typename detail::LoopType<SIZE>::type ltype;
1072 ltype::fromRealPromote(res.begin(), v.begin());
1077 template <
class T,
int SIZE>
1078 struct NumericTraits<TinyVectorView<T, SIZE> >
1079 :
public NumericTraits<TinyVector<T, SIZE> >
1081 typedef TinyVector<T, SIZE> Type;
1082 typedef TinyVector<typename NumericTraits<T>::Promote, SIZE> Promote;
1083 typedef TinyVector<typename NumericTraits<T>::RealPromote, SIZE> RealPromote;
1084 typedef TinyVector<typename NumericTraits<T>::ComplexPromote, SIZE> ComplexPromote;
1085 typedef T ValueType;
1087 typedef typename NumericTraits<T>::isIntegral isIntegral;
1088 typedef VigraFalseType isScalar;
1089 typedef typename NumericTraits<T>::isSigned isSigned;
1090 typedef VigraFalseType isOrdered;
1091 typedef VigraFalseType isComplex;
1094 template <
class T,
int SIZE>
1095 struct NormTraits<TinyVector<T, SIZE> >
1097 typedef TinyVector<T, SIZE> Type;
1098 typedef typename Type::SquaredNormType SquaredNormType;
1099 typedef typename Type::NormType NormType;
1102 template <
class T,
int SIZE>
1103 struct NormTraits<TinyVectorView<T, SIZE> >
1105 typedef TinyVector<T, SIZE> Type;
1106 typedef typename Type::SquaredNormType SquaredNormType;
1107 typedef typename Type::NormType NormType;
1110 template <
class T1,
class T2,
int SIZE>
1111 struct PromoteTraits<TinyVector<T1, SIZE>, TinyVector<T2, SIZE> >
1113 typedef TinyVector<typename PromoteTraits<T1, T2>::Promote, SIZE> Promote;
1116 template <
class T1,
class T2,
int SIZE>
1117 struct PromoteTraits<TinyVectorView<T1, SIZE>, TinyVectorView<T2, SIZE> >
1119 typedef TinyVector<typename PromoteTraits<T1, T2>::Promote, SIZE> Promote;
1122 template <
class T1,
class T2,
int SIZE>
1123 struct PromoteTraits<TinyVectorView<T1, SIZE>, TinyVector<T2, SIZE> >
1125 typedef TinyVector<typename PromoteTraits<T1, T2>::Promote, SIZE> Promote;
1128 template <
class T1,
class T2,
int SIZE>
1129 struct PromoteTraits<TinyVector<T1, SIZE>, TinyVectorView<T2, SIZE> >
1131 typedef TinyVector<typename PromoteTraits<T1, T2>::Promote, SIZE> Promote;
1134 template <
class T,
int SIZE>
1135 struct PromoteTraits<TinyVector<T, SIZE>, double >
1137 typedef TinyVector<typename NumericTraits<T>::RealPromote, SIZE> Promote;
1140 template <
class T,
int SIZE>
1141 struct PromoteTraits<double, TinyVector<T, SIZE> >
1143 typedef TinyVector<typename NumericTraits<T>::RealPromote, SIZE> Promote;
1146 template <
class T,
int SIZE>
1147 struct PromoteTraits<TinyVectorView<T, SIZE>, double >
1149 typedef TinyVector<typename NumericTraits<T>::RealPromote, SIZE> Promote;
1152 template <
class T,
int SIZE>
1153 struct PromoteTraits<double, TinyVectorView<T, SIZE> >
1155 typedef TinyVector<typename NumericTraits<T>::RealPromote, SIZE> Promote;
1158 template<
class T,
int SIZE>
1159 struct CanSkipInitialization<TinyVectorView<T, SIZE> >
1161 typedef typename CanSkipInitialization<T>::type type;
1162 static const bool value = type::asBool;
1165 template<
class T,
int SIZE>
1166 struct CanSkipInitialization<TinyVector<T, SIZE> >
1168 typedef typename CanSkipInitialization<T>::type type;
1169 static const bool value = type::asBool;
1174 #else // NO_PARTIAL_TEMPLATE_SPECIALIZATION
1177 #define TINYVECTOR_NUMTRAITS(T, SIZE) \
1179 struct NumericTraits<TinyVector<T, SIZE> >\
1181 typedef TinyVector<T, SIZE> Type;\
1182 typedef TinyVector<NumericTraits<T>::Promote, SIZE> Promote;\
1183 typedef TinyVector<NumericTraits<T>::RealPromote, SIZE> RealPromote;\
1184 typedef TinyVector<NumericTraits<T>::ComplexPromote, SIZE> ComplexPromote;\
1185 typedef T ValueType; \
1186 typedef NumericTraits<T>::isIntegral isIntegral;\
1187 typedef VigraFalseType isScalar;\
1188 typedef NumericTraits<T>::isSigned isSigned; \
1189 typedef VigraFalseType isOrdered;\
1190 typedef VigraFalseType isComplex;\
1192 static TinyVector<T, SIZE> zero() { \
1193 return TinyVector<T, SIZE>(NumericTraits<T>::zero()); \
1195 static TinyVector<T, SIZE> one() { \
1196 return TinyVector<T, SIZE>(NumericTraits<T>::one()); \
1198 static TinyVector<T, SIZE> nonZero() { \
1199 return TinyVector<T, SIZE>(NumericTraits<T>::nonZero()); \
1202 static Promote toPromote(TinyVector<T, SIZE> const & v) { \
1203 return Promote(v); \
1205 static RealPromote toRealPromote(TinyVector<T, SIZE> const & v) { \
1206 return RealPromote(v); \
1208 static TinyVector<T, SIZE> fromPromote(Promote const & v) { \
1209 TinyVector<T, SIZE> res;\
1210 TinyVector<T, SIZE>::iterator d = res.begin(), dend = res.end();\
1211 Promote::const_iterator s = v.begin();\
1212 for(; d != dend; ++d, ++s)\
1213 *d = NumericTraits<T>::fromPromote(*s);\
1216 static TinyVector<T, SIZE> fromRealPromote(RealPromote const & v) {\
1217 TinyVector<T, SIZE> res;\
1218 TinyVector<T, SIZE>::iterator d = res.begin(), dend = res.end();\
1219 RealPromote::const_iterator s = v.begin();\
1220 for(; d != dend; ++d, ++s)\
1221 *d = NumericTraits<T>::fromRealPromote(*s);\
1226 struct NormTraits<TinyVector<T, SIZE> >\
1228 typedef TinyVector<T, SIZE> Type;\
1229 typedef Type::SquaredNormType SquaredNormType; \
1230 typedef Type::NormType NormType; \
1233 #define TINYVECTOR_PROMTRAITS1(type1, SIZE) \
1235 struct PromoteTraits<TinyVector<type1, SIZE>, TinyVector<type1, SIZE> > \
1237 typedef TinyVector<PromoteTraits<type1, type1>::Promote, SIZE> Promote; \
1238 static Promote toPromote(TinyVector<type1, SIZE> const & v) { \
1239 return static_cast<Promote>(v); } \
1242 #define TINYVECTOR_PROMTRAITS2(type1, type2, SIZE) \
1244 struct PromoteTraits<TinyVector<type1, SIZE>, TinyVector<type2, SIZE> > \
1246 typedef TinyVector<PromoteTraits<type1, type2>::Promote, SIZE> Promote; \
1247 static Promote toPromote(TinyVector<type1, SIZE> const & v) { \
1248 return static_cast<Promote>(v); } \
1249 static Promote toPromote(TinyVector<type2, SIZE> const & v) { \
1250 return static_cast<Promote>(v); } \
1253 #define TINYVECTOR_TRAITS(SIZE) \
1254 TINYVECTOR_NUMTRAITS(unsigned char, SIZE)\
1255 TINYVECTOR_NUMTRAITS(int, SIZE)\
1256 TINYVECTOR_NUMTRAITS(float, SIZE)\
1257 TINYVECTOR_NUMTRAITS(double, SIZE)\
1258 TINYVECTOR_PROMTRAITS1(unsigned char, SIZE)\
1259 TINYVECTOR_PROMTRAITS1(int, SIZE)\
1260 TINYVECTOR_PROMTRAITS1(float, SIZE)\
1261 TINYVECTOR_PROMTRAITS1(double, SIZE)\
1262 TINYVECTOR_PROMTRAITS2(float, unsigned char, SIZE)\
1263 TINYVECTOR_PROMTRAITS2(unsigned char, float, SIZE)\
1264 TINYVECTOR_PROMTRAITS2(int, unsigned char, SIZE)\
1265 TINYVECTOR_PROMTRAITS2(unsigned char, int, SIZE)\
1266 TINYVECTOR_PROMTRAITS2(int, float, SIZE)\
1267 TINYVECTOR_PROMTRAITS2(float, int, SIZE)\
1268 TINYVECTOR_PROMTRAITS2(double, unsigned char, SIZE)\
1269 TINYVECTOR_PROMTRAITS2(unsigned char, double, SIZE)\
1270 TINYVECTOR_PROMTRAITS2(int, double, SIZE)\
1271 TINYVECTOR_PROMTRAITS2(double, int, SIZE)\
1272 TINYVECTOR_PROMTRAITS2(double, float, SIZE)\
1273 TINYVECTOR_PROMTRAITS2(float, double, SIZE)
1275 TINYVECTOR_TRAITS(2)
1276 TINYVECTOR_TRAITS(3)
1277 TINYVECTOR_TRAITS(4)
1279 #undef TINYVECTOR_NUMTRAITS
1280 #undef TINYVECTOR_PROMTRAITS1
1281 #undef TINYVECTOR_PROMTRAITS2
1282 #undef TINYVECTOR_TRAITS
1284 #endif // NO_PARTIAL_TEMPLATE_SPECIALIZATION
1298 template <
class V1,
int SIZE,
class D1,
class D2,
class V2,
class D3,
class D4>
1300 typename PromoteTraits<TinyVector<V1, SIZE>, TinyVector<V2, SIZE> >::Promote
1308 template <
class V1,
int SIZE,
class D1,
class D2,
class V2,
class D3,
class D4>
1310 typename PromoteTraits<TinyVector<V1, SIZE>, TinyVector<V2, SIZE> >::Promote
1318 template <
class V1,
int SIZE,
class D1,
class D2,
class V2,
class D3,
class D4>
1320 typename PromoteTraits<TinyVector<V1, SIZE>, TinyVector<V2, SIZE> >::Promote
1328 template <
class V1,
int SIZE,
class D1,
class D2,
class V2,
class D3,
class D4>
1330 typename PromoteTraits<TinyVector<V1, SIZE>, TinyVector<V2, SIZE> >::Promote
1338 template <
class V,
int SIZE,
class D1,
class D2>
1340 typename NumericTraits<TinyVector<V, SIZE> >::RealPromote
1343 return typename NumericTraits<TinyVector<V, SIZE> >::RealPromote(r) *= v;
1347 template <
class V,
int SIZE,
class D1,
class D2>
1349 typename NumericTraits<TinyVector<V, SIZE> >::RealPromote
1352 return typename NumericTraits<TinyVector<V, SIZE> >::RealPromote(l) *= v;
1356 template <
class V,
int SIZE,
class D1,
class D2>
1358 typename NumericTraits<TinyVector<V, SIZE> >::RealPromote
1361 return typename NumericTraits<TinyVector<V, SIZE> >::RealPromote(l) /= v;
1367 template <
class V,
int SIZE,
class D1,
class D2>
1373 typedef typename detail::LoopType<SIZE>::type ltype;
1379 template <
class V,
int SIZE,
class D1,
class D2>
1385 typedef typename detail::LoopType<SIZE>::type ltype;
1392 template <
class V,
int SIZE,
class D1,
class D2>
1398 typedef typename detail::LoopType<SIZE>::type ltype;
1405 template <
class V,
int SIZE,
class D1,
class D2>
1411 typedef typename detail::LoopType<SIZE>::type ltype;
1417 template <
class V1,
class D1,
class D2,
class V2,
class D3,
class D4>
1419 TinyVector<typename PromoteTraits<V1, V2>::Promote, 3>
1425 return Res(r1[1]*r2[2] - r1[2]*r2[1],
1426 r1[2]*r2[0] - r1[0]*r2[2],
1427 r1[0]*r2[1] - r1[1]*r2[0]);
1431 template <
class V1,
int SIZE,
class D1,
class D2,
class V2,
class D3,
class D4>
1433 typename PromoteTraits<V1, V2>::Promote
1437 typedef typename detail::LoopType<SIZE>::type ltype;
1443 template <
class V1,
int SIZE,
class D1,
class D2>
1445 typename TinyVectorBase<V1, SIZE, D1, D2>::SquaredNormType
1452 template <
class V,
int SIZE>
1454 typename TinyVector<V, SIZE>::SquaredNormType
1463 #undef VIGRA_ASSERT_INSIDE
1464 #endif // VIGRA_TINYVECTOR_HXX