/* *****************************************************
   THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT EDIT.
   *****************************************************

   Generated by:
     scitbx.source_generators.array_family.generate_reductions
 */

#ifndef SCITBX_ARRAY_FAMILY_VERSA_REDUCTIONS_H
#define SCITBX_ARRAY_FAMILY_VERSA_REDUCTIONS_H

#ifndef DOXYGEN_SHOULD_SKIP_THIS

#include <scitbx/array_family/ref_reductions.h>
#include <scitbx/array_family/versa_plain.h>

namespace scitbx { namespace af {

  template <typename ElementType1, typename AccessorType1,
            typename ElementType2, typename AccessorType2>
  int
  inline
  order(
    versa_plain<ElementType1, AccessorType1> const& a1,
    versa_plain<ElementType2, AccessorType2> const& a2)
  {
    return order(a1.const_ref(), a2.const_ref());
  }

  template <typename ElementType, typename AccessorType>
  inline
  std::size_t
  max_index(versa_plain<ElementType, AccessorType> const& a)
  {
    return max_index(a.const_ref());
  }

  template <typename ElementType, typename AccessorType>
  inline
  std::size_t
  min_index(versa_plain<ElementType, AccessorType> const& a)
  {
    return min_index(a.const_ref());
  }

  template <typename ElementType, typename AccessorType>
  inline
  ElementType
  max(versa_plain<ElementType, AccessorType> const& a)
  {
    return max(a.const_ref());
  }

  template <typename ElementType, typename AccessorType>
  inline
  ElementType
  min(versa_plain<ElementType, AccessorType> const& a)
  {
    return min(a.const_ref());
  }

  template <typename ElementType, typename AccessorType>
  inline
  ElementType
  max_absolute(versa_plain<ElementType, AccessorType> const& a)
  {
    return max_absolute(a.const_ref());
  }

  template <typename ElementType, typename AccessorType>
  inline
  ElementType
  sum(versa_plain<ElementType, AccessorType> const& a)
  {
    return sum(a.const_ref());
  }

  template <typename ElementType, typename AccessorType>
  inline
  ElementType
  sum_sq(versa_plain<ElementType, AccessorType> const& a)
  {
    return sum_sq(a.const_ref());
  }

  template <typename ElementType, typename AccessorType>
  inline
  ElementType
  product(versa_plain<ElementType, AccessorType> const& a)
  {
    return product(a.const_ref());
  }

  template <typename ElementType, typename AccessorType>
  inline
  ElementType
  mean(versa_plain<ElementType, AccessorType> const& a)
  {
    return mean(a.const_ref());
  }

  template <typename ElementType, typename AccessorType>
  inline
  ElementType
  mean_sq(versa_plain<ElementType, AccessorType> const& a)
  {
    return mean_sq(a.const_ref());
  }

  template <typename ElementTypeValues, typename AccessorType1,
            typename ElementTypeWeights, typename AccessorType2>
  inline
  ElementTypeValues
  mean_weighted(
    versa_plain<ElementTypeValues, AccessorType1> const& values,
    versa_plain<ElementTypeWeights, AccessorType2> const& weights)
  {
    return mean_weighted(values.const_ref(), weights.const_ref());
  }

  template <typename ElementTypeValues, typename AccessorType1,
            typename ElementTypeWeights, typename AccessorType2>
  inline
  ElementTypeValues
  mean_sq_weighted(
    versa_plain<ElementTypeValues, AccessorType1> const& values,
    versa_plain<ElementTypeWeights, AccessorType2> const& weights)
  {
    return mean_sq_weighted(values.const_ref(), weights.const_ref());
  }

  template <typename ElementType, typename AccessorType, class PredicateType>
  inline
  boost::optional<std::size_t>
  first_index(versa_plain<ElementType, AccessorType> const& a,
               PredicateType p)
  {
    return first_index(a.const_ref(), p);
  }

  template <typename ElementType, typename AccessorType, class PredicateType>
  inline
  boost::optional<std::size_t>
  last_index(versa_plain<ElementType, AccessorType> const& a,
               PredicateType p)
  {
    return last_index(a.const_ref(), p);
  }

}} // namespace scitbx::af

#endif // DOXYGEN_SHOULD_SKIP_THIS

#endif // SCITBX_ARRAY_FAMILY_VERSA_REDUCTIONS_H

