00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef MTL_MAX_INCLUDE
00013 #define MTL_MAX_INCLUDE
00014
00015 #include <iostream>
00016 #include <cmath>
00017
00018 #include <boost/numeric/mtl/concept/collection.hpp>
00019 #include <boost/numeric/mtl/utility/tag.hpp>
00020 #include <boost/numeric/mtl/utility/category.hpp>
00021 #include <boost/numeric/mtl/vector/reduction.hpp>
00022 #include <boost/numeric/mtl/vector/reduction_functors.hpp>
00023
00024
00025 namespace mtl { namespace vector {
00026
00027 namespace impl {
00028
00029
00030
00031
00032 template <unsigned long Unroll, typename Vector>
00033 typename Collection<Vector>::value_type
00034 inline max(const Vector& vector, tag::vector)
00035 {
00036 typedef typename Collection<Vector>::value_type result_type;
00037 return vector::reduction<Unroll, vector::max_functor, result_type>::apply(vector);
00038 }
00039
00040 }
00041
00043 template <unsigned long Unroll, typename Value>
00044 typename Collection<Value>::value_type
00045 inline max(const Value& value)
00046 {
00047 return impl::max<Unroll>(value, typename traits::category<Value>::type());
00048 }
00049
00050 template <typename Value>
00051 typename Collection<Value>::value_type
00052 inline max(const Value& value)
00053 {
00054 return max<8>(value);
00055 }
00056
00057 }
00058
00059 using vector::max;
00060
00061 }
00062
00063 #endif // MTL_MAX_INCLUDE