reduce.hpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. [auto_generated]
  3. boost/numeric/odeint/algebra/detail/reduce.hpp
  4. [begin_description]
  5. Default reduce implementation.
  6. [end_description]
  7. Copyright 2009-2011 Karsten Ahnert
  8. Copyright 2009-2011 Mario Mulansky
  9. Distributed under the Boost Software License, Version 1.0.
  10. (See accompanying file LICENSE_1_0.txt or
  11. copy at http://www.boost.org/LICENSE_1_0.txt)
  12. */
  13. #ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_REDUCE_HPP_INCLUDED
  14. #define BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_REDUCE_HPP_INCLUDED
  15. namespace boost {
  16. namespace numeric {
  17. namespace odeint {
  18. namespace detail {
  19. template< class ValueType , class Iterator1 , class Reduction >
  20. inline ValueType reduce( Iterator1 first1 , Iterator1 last1 , Reduction red, ValueType init)
  21. {
  22. for( ; first1 != last1 ; )
  23. init = red( init , *first1++ );
  24. return init;
  25. }
  26. template< class ValueType , class Iterator1 , class Iterator2 , class Reduction >
  27. inline ValueType reduce2( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Reduction red, ValueType init)
  28. {
  29. for( ; first1 != last1 ; )
  30. init = red( init , *first1++ , *first2++ );
  31. return init;
  32. }
  33. template< class ValueType , class Iterator1 , class Iterator2 , class Iterator3 , class Reduction >
  34. inline ValueType reduce3( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3 , Reduction red, ValueType init)
  35. {
  36. for( ; first1 != last1 ; )
  37. init = red( init , *first1++ , *first2++ , *first3++ );
  38. return init;
  39. }
  40. template< class ValueType , class Iterator1 , class Iterator2 , class Iterator3 , class Iterator4 , class Reduction >
  41. inline ValueType reduce4( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3 , Iterator4 first4 , Reduction red, ValueType init)
  42. {
  43. for( ; first1 != last1 ; )
  44. init = red( init , *first1++ , *first2++ , *first3++ , *first4++ );
  45. return init;
  46. }
  47. } // detail
  48. } // odeint
  49. } // numeric
  50. } // boost
  51. #endif // BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_REDUCE_HPP_INCLUDED